This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: 32bit UID support for glibc 2.1.3


   From: Ulrich Drepper <drepper@cygnus.com>
   Date: 12 Jan 2000 04:24:43 -0800

   Andreas Jaeger <aj@suse.de> writes:

   > we have to use stat64 and convert struct stat64 to struct stat with
   > checking for overflow

   Look at the reality.  I think that even though those fields have
   larger types the values are not really larger and we can get along
   with a simple assignment.

That may be true now, but will it be true for future Linux kernels?
(Sorry, I haven't been keeping up with the Linux kernel features, so I
don't know.)  It sounds safer to put the checks in anyway, so that you
needn't worry about kernel changes.

To minimize the runtime cost, the code can check all the fields with
one conditional jump.  Something like this:

   if ((a.st_uid ^ b.st_uid) | (a.st_gid ^ b.st_gid) | (a.st_size ^ b.st_size))
     {
       errno = EOVERFLOW;
       return -1;
     }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]