public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* question about /proc/<PID>/mem in 2.4
@ 2004-07-05 13:27 Tigran Aivazian
  2004-07-05 13:37 ` FabF
  0 siblings, 1 reply; 14+ messages in thread
From: Tigran Aivazian @ 2004-07-05 13:27 UTC (permalink / raw)
  To: linux-kernel

Hello,

I noticed that in 2.4.x kernels the fs/proc/base.c:mem_read() function has 
this permission check:

        if (!MAY_PTRACE(task) || !may_ptrace_attach(task))
                return -ESRCH;

Are you sure it shouldn't be like this instead:

        if (!MAY_PTRACE(task) && !may_ptrace_attach(task))
                return -ESRCH;

Because, normally MAY_PTRACE() is 0 (i.e. for any process worth looking at :)
so may_ptrace_attach() is never even called.

Is there any reason for the above check on each read(2)? Shouldn't there 
be a simple check at ->open() time only? I assume this is to close some 
obscure "security hole" but I would like to see the explanation of how 
could any problem arise if a) such check wasn't done at all (except at 
open(2) time) or at least b) there was && instead of ||.

The 2.6.x situation is similar except the addition of the security stuff.

Kind regards
Tigran


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-07-07 16:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-05 13:27 question about /proc/<PID>/mem in 2.4 Tigran Aivazian
2004-07-05 13:37 ` FabF
2004-07-05 14:22   ` Tigran Aivazian
2004-07-05 14:25     ` FabF
2004-07-06 11:14       ` Tigran Aivazian
2004-07-06 10:49         ` Arjan van de Ven
2004-07-06 11:35           ` Tigran Aivazian
2004-07-06 11:04         ` Marcelo Tosatti
2004-07-06 13:08           ` Tigran Aivazian
2004-07-06 16:31             ` Alan Cox
2004-07-07 13:53               ` Tigran Aivazian
2004-07-07 13:26                 ` Tigran Aivazian
2004-07-07 16:21                   ` Daniel Jacobowitz
2004-07-07 16:13                 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox