[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Executable /lib/ld-linux.so breaks noexec



On Tue, May 20, 2003 at 05:15:22PM +0100, Matthew Garrett wrote:
> Martin Pitt wrote:
> >Is there any particular reason to have /lib/ld-linux.so.* exxecutable?
> >If it is used only as a proper library, it need not be executable.
> 
> mjg59@asparagine:~/priv$ sudo chmod a-x /lib/ld-linux.so.2
> Password:
> mjg59@asparagine:~/priv$ ls
> bash: /bin/ls: Permission denied
> mjg59@asparagine:~/priv$ sudo chmod a+x /lib/ld-linux.so.2
> bash: /usr/bin/sudo: Permission denied
> 
> Irritated now.

Indeed; /lib/ld-linux.so.2 is in the PT_INTERP field of the ELF header.
load_elf_binary() in fs/binfmt_elf.c uses open_exec() to open it, which
(fs/exec.c) contains this code:

                        int err = permission(inode, MAY_EXEC);
                        if (!err && !(inode->i_mode & 0111))
                                err = -EACCES;

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: