[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Weirdness with stat()



I wrote a program today on my laptop (2.2.16) and it was working fine. I
was using stat to check the permissions on a file, something along the
lines of:

struct stat *st;

   stat(CONFIG, st);
   if ((st->st_uid != 0) || (st->st_mode != 33152)) {
      fprintf(stderr, "Unsecure modes on configuration files\n");
      exit(1);
   }

This worked with absolutly no problems on my laptop. I went to run it on
my desktop (2.4.0-test2 SMP) and it started segfaulting. It wasn't
segfaulting at the stat() call, it was segfaulting in weird places like a
syslog() or a execv(). Odly enough i managed to trace it down to stat(),
and once i commented it out, it was fine. So i switched to access() and
have no problems on either systems.

Would this be my poor implementation of stat, or would this actually be a
kernel bug.


			Jim
			- Sexy Rockstar



Kernel-audit:  discussion list for security and the linux kernel
Archive:       http://mail.nl.linux.org/kernel-audit/