lkml.org 
[lkml]   [1998]   [Oct]   [21]   [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
Chris Wedgwood wrote:
>
>
> 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?

In the last Unix-like file system implementation I worked on, we specifically
prevented open(.., O_CREAT...) from following trailing symlinks (In fact, none
of the system calls that create a file follow trailing links - mknod(), mkdir(),
symlink(), bind() on AF_UNIX socket, etc.). They rather generate an EEXIST error
if there exists a symbolic link with the passed name. With this approach,
exploits of the type this thread has been discussing can't occur.

Tom

--
Tom Eastep
COMPAQ Computer Corporation
Enterprise Computing Group
Tandem Division
tom.eastep@compaq.com

-
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    [W:0.211 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site