Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 18 Jul 2019 12:37:45 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: time_t progress/findings

Second bit of progress here: stat. First change can be done before any
actual time64 work is done or even decided upon: changing all the
stat-family functions to use fstatat (possibly with AT_EMPTY_PATH) as
their backend, and changing fstatat to do proper fallbacks if
SYS_fstatat is missing. Now there's a single point of potential stat
conversion rather than 4 functions.

Next, add an internal, arch-provided kstat type and make fstatat
translate from this to the public stat type. This eliminates the need
for all the mips*/syscall_arch.h hacks.

Third, add use of SYS_statx when it's available, and translate from it
to the public stat type. Only fallback to SYS_fstatat if SYS_statx is
missing.

At this point we have the kernel giving us 64-bit timespecs for stat,
even if we can't use them. The last step is just changing over the
public types for 32-bit archs (we get to define struct stat entirely,
since it's not filled in by the kernel at all anymore at this point).

The best part of all this is that none of the steps until the last
depend on choices of 64-bit time_t action to take, and all of them are
beneficial changes even without 64-bit time_t.

Final note: some attention may be needed to how O_PATH file
descriptors are handled in the fallback code paths, since this is
presently a delicate issue for fstat() due to old kernel bugs. I think
modern fstatat+AT_EMPTY_PATH and statx+AT_EMPTY_PATH get it right
though.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.