Skip to contentSkip to conversation

/bin/ls: cannot read symbolic link /proc/$$/exe: Permission denied

DISCUSSION Olaf Hering 2 participants 6 messages Aug 16, 2004 – Aug 17, 2004 VFS

lore
Share & tools
lore
#0 lore raw

For some reasons ls -l /proc/$$/exe doesnt work all time for me, with 2.6.8.1 on ppc64. Sometimes it does, sometimes not. No pattern. A few printks show that this check in proc_pid_readlink() triggers an -EACCES:

        current->fsuid != inode->i_uid

proc_pid_readlink(755) error -13 ntptrace(11408) fsuid 100 i_uid 0 0 sys_readlink(281) ntptrace(11408) error -13 readlink proc_pid_readlink(755) error -13 ls(11509) fsuid 91 i_uid 0 0 sys_readlink(281) ls(11509) error -13 readlink proc_pid_readlink(755) error -13 ls(11559) fsuid 91 i_uid 0 0 sys_readlink(281) ls(11559) error -13 readlink proc_pid_readlink(755) error -13 ls(11621) fsuid 91 i_uid 0 0 sys_readlink(281) ls(11621) error -13 readlink

any ideas what is supposed to happen here? Who should set the inode->i_uid? ssh to the smp box runs the login scripts, they try to figure out what shell is running via ls -l /proc/$$/exe This works ok with our 2.6.5 kernel at least.

Signature · 3 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
#1 lore raw
Quoted 10 lines · Olaf Hering

For some reasons ls -l /proc/$$/exe doesnt work all time for me, with 2.6.8.1 on ppc64. Sometimes it does, sometimes not. No pattern. A few printks show that this check in proc_pid_readlink() triggers an -EACCES:

        current->fsuid != inode->i_uid

proc_pid_readlink(755) error -13 ntptrace(11408) fsuid 100 i_uid 0 0 sys_readlink(281) ntptrace(11408) error -13 readlink

bprm.interp_flags contains garbage like 0xc0000001, that triggers task->mm->dumpable =0;

please apply.

fs/compat.c +1 -0
diff -p -purN linux-2.6.8.1.omfg/fs/compat.c linux-2.6.8.1/fs/compat.c
@@ -1390,6 +1390,7 @@ int compat_do_execve(char * filename,
 	bprm.sh_bang = 0;
 	bprm.loader = 0;
 	bprm.exec = 0;
+	bprm.interp_flags = 0;
 	bprm.security = NULL;
 	bprm.mm = mm_alloc();
 	retval = -ENOMEM;
Signature · 3 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
#2 lore raw
In reply to Olaf Hering
Quoted 10 lines · Olaf Hering

For some reasons ls -l /proc/$$/exe doesnt work all time for me, with 2.6.8.1 on ppc64. Sometimes it does, sometimes not. No pattern. A few printks show that this check in proc_pid_readlink() triggers an -EACCES:

        current->fsuid != inode->i_uid

proc_pid_readlink(755) error -13 ntptrace(11408) fsuid 100 i_uid 0 0 sys_readlink(281) ntptrace(11408) error -13 readlink

A better one, clear both new fields, just in case.

fs/compat.c +2 -0
diff -p -purN linux-2.6.8.1.omfg/fs/compat.c linux-2.6.8.1/fs/compat.c
@@ -1390,6 +1390,8 @@ int compat_do_execve(char * filename,
 	bprm.sh_bang = 0;
 	bprm.loader = 0;
 	bprm.exec = 0;
+	bprm.interp_flags = 0;
+	bprm.interp_data = 0;
 	bprm.security = NULL;
 	bprm.mm = mm_alloc();
 	retval = -ENOMEM;
Signature · 3 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
#3 lore raw
Quoted 8 lines · Olaf Hering
Quoted 6 lines · Olaf Hering

For some reasons ls -l /proc/$$/exe doesnt work all time for me, with 2.6.8.1 on ppc64. Sometimes it does, sometimes not. No pattern. A few printks show that this check in proc_pid_readlink() triggers an -EACCES:

Quoted 6 lines
Quoted 4 lines
        current->fsuid != inode->i_uid

proc_pid_readlink(755) error -13 ntptrace(11408) fsuid 100 i_uid 0 0 sys_readlink(281) ntptrace(11408) error -13 readlink

A better one, clear both new fields, just in case.

memset?

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#4 lore raw
Quoted 10 lines · Andreas Schwab
Quoted 8 lines · Olaf Hering
Quoted 6 lines · Olaf Hering

For some reasons ls -l /proc/$$/exe doesnt work all time for me, with 2.6.8.1 on ppc64. Sometimes it does, sometimes not. No pattern. A few printks show that this check in proc_pid_readlink() triggers an -EACCES:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
        current->fsuid != inode->i_uid

proc_pid_readlink(755) error -13 ntptrace(11408) fsuid 100 i_uid 0 0 sys_readlink(281) ntptrace(11408) error -13 readlink

A better one, clear both new fields, just in case.

memset?

perhaps too expensive, no idea.

Signature · 3 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
#5 lore raw
Quoted 5 lines · Olaf Hering
Quoted 3 lines
Quoted 1 line

A better one, clear both new fields, just in case.

memset?

perhaps too expensive, no idea.

I don't think that this part of compat_do_execve is exactly time critical.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."