This is the mail archive of the
libc-alpha@cygnus.com
mailing list for the glibc project.
Re: Anybody experience this type of Dos before?
- To: pjb1008@cam.ac.uk (Peter Benie)
- Subject: Re: Anybody experience this type of Dos before?
- From: Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
- Date: Sun, 11 Oct 1998 19:30:10 -0400
- Cc: libc-alpha@cygnus.com
pjb1008@cam.ac.uk (Peter Benie) said:
> Jay Cox writes ("Re: Anybody experience this type of Dos before?"):
> > Illuminatus Pimpus wrote:
> > > BTW: just an ls -l /dev/* shouldn't open any devices for reading.. it
> > > should only be stat()ing them. I didn't think that would cause linux to
> > > load modules..
> > Its not /dev/* but /dev/*/*. And it does look like it is loading
> > modules like one for this /dev/aztcd. Anyway only bash seems to be
> > affected.
> It seems that the behaviour of opendir has changed in glibc2.
> Here's a trace of libc5 doing opendir("."):
> - stat(".", {st_mode=S_IFDIR|S_ISGID|0755, st_size=3072, ...}) = 0
> - open(".", O_RDONLY) = 3
> - fcntl(3, F_SETFD, FD_CLOEXEC) = 0
>
> And in glibc2:
> - open(".", O_RDONLY|O_NONBLOCK) = 3
> - fcntl(3, F_SETFD, FD_CLOEXEC) = 0
> - fstat(3, {st_mode=0, st_size=0, ...}) = 0
>
> The glibc method is better since it can not be tricked into returning
> non-NULL for something that isn't a directory, but it does have the
> undesirable property that it opens everything in sight, possibly
> rewinding tape devices or setting your controlling terminal. IMO,
> opendir() should do a stat before opening the directory, as well as an
> fstat afterwards.
Note that the current glibc-2.0.97 snapshot does exactly the same here
(i586/100, linux-2.1.125, egcs-1.1, binutils-2.9.1.0.14; strace output):
personality(0 /* PER_??? */) = 0
getpid() = 2760
open(".", O_RDONLY|O_NONBLOCK) = 3
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fstat(3, {st_mode=0, st_size=0, ...}) = 0
--
Horst von Brand vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viņa del Mar, Chile +56 32 672616