lkml.org 
[lkml]   [1998]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Linux 2.1.125 doesn't dump core on SIGSEGV
On Tue, Oct 20, 1998 at 10:55:27PM +0100, David Woodhouse wrote:

> In the coredump case, I'm not sure - but in general it's because
> there's a race condition. Someone can put the 'evil' symlink in
> place between the stat() and the open().

No, indeed you are correct - there is a race. Doh! Need more coffee.

> Even in the coredump case there's a race, but presumably there's a
> lock somewhere that we can use to make it seem atomic.

How does this look (still a race, but much harder to exploit):


if(fd = (open("core",O_CREAT | O_EXCL)) == -1)
goto end_dump;
lstat("core",&fs1);
fstat(fd,&fs2);

/* compare stat results - don't sump if bad */

Better?


-cw

We _really_ do need O_NOFOLLOW semantics. Anyone looked at how hard
this would be to implement?




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:45    [from the cache]
©2003-2011 Jasper Spaans