From: Richard Weinberger <richard@nod.at>
To: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: ls -l /proc/1/exe -> Permission denied
Date: Sat, 19 Jul 2014 22:06:16 +0200 [thread overview]
Message-ID: <53CACFB8.2000807@nod.at> (raw)
In-Reply-To: <OF94BC7D2A.31F0FF60-ONC1257D19.00528EC9-C1257D19.0052E7FB@transmode.se>
Am 18.07.2014 17:05, schrieb Joakim Tjernlund:
> Joakim Tjernlund/Transmode wrote on 2014/07/18 15:49:17:
>>
>> Richard Weinberger <richard.weinberger@gmail.com> wrote on 2014/07/18
> 14:58:30:
>>>
>>> On Thu, Jul 17, 2014 at 1:18 PM, Joakim Tjernlund
>>> <joakim.tjernlund@transmode.se> wrote:
>>>> Trying to real /proc/<pid>/exe I noticed I could not read links not
>>>> belonging to my user such as:
>>>> jocke > ls -l /proc/1/exe
>>>> ls: cannot read symbolic link /proc/1/exe: Permission
> denied
>>>>
>>>> Is this expected?
>>>
>>> Why do you think this is unexpected?
>
>> It only shows the full path to the executable, compare with comm which
> shows basename(app).
>>
>> I have an idea for qemu-user which needs to identify which processes
>> are running /usr/bin/qemu-<arch> and which are not so it knows how
>> to munge different /proc/ files.
>
> Just to be clear, I expect to read where /proc/1/exe points, not the
> contents of the file
> pointed to.
>
> It seems that any and all symlinks are forbidden:
>> ls -l /proc/1
> ls: cannot read symbolic link /proc/1/cwd: Permission denied
> ls: cannot read symbolic link /proc/1/root: Permission denied
> ls: cannot read symbolic link /proc/1/exe: Permission denied
Because they all share the same implementation.
See proc_pid_link_inode_operations() in fs/proc/base.c
Happy hacking. :-)
Thanks,
//richard
next prev parent reply other threads:[~2014-07-19 20:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-17 11:18 ls -l /proc/1/exe -> Permission denied Joakim Tjernlund
2014-07-18 12:58 ` Richard Weinberger
2014-07-18 13:49 ` Joakim Tjernlund
[not found] ` <OF542E7A59.842197B0-ONC1257D19.004B7FF4-C1257D19.004BEC7C@LocalDomain>
2014-07-18 15:05 ` Joakim Tjernlund
2014-07-19 20:06 ` Richard Weinberger [this message]
2014-07-19 20:21 ` Andreas Schwab
2014-07-20 9:02 ` Joakim Tjernlund
2014-07-20 10:55 ` Andreas Schwab
2014-07-20 11:06 ` Richard Weinberger
2014-07-20 11:19 ` Joakim Tjernlund
2014-07-20 11:51 ` Andreas Schwab
2014-07-20 12:05 ` Richard Weinberger
2014-07-20 12:05 ` Richard Weinberger
2014-07-20 19:15 ` Joakim Tjernlund
2014-07-20 20:00 ` Richard Weinberger
2014-07-20 22:05 ` Joakim Tjernlund
2014-07-20 12:08 ` Richard Weinberger
2014-07-21 17:48 ` Eric W. Biederman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53CACFB8.2000807@nod.at \
--to=richard@nod.at \
--cc=joakim.tjernlund@transmode.se \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.