This is the mail archive of the libc-alpha@sourceware.org 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]
Other format: [Raw text]

Re: [PATCH] <sys/stat.h>: Use Linux kernel UAPI header if available and useful


* Andreas Schwab:

> On Jun 11 2019, Florian Weimer <fweimer@redhat.com> wrote:
>
>> The emulation code in io/statx_generic.c does not know about the new
>> structure and will initialize the full struct statx object, even if the
>> new flag is not specified.
>
> That looks like a bug, it should only touch the parts related to
> STATX_BASIC_STATS.

This is not how the interface is defined.  It is expected to clear the
entire struct (all 256 bytes).

We can either duplicate the struct definition (like we did before this
change), or add the assert, so that we are told once the duplication
becomes necessary.  I slightly prefer the second approach.

Maybe we could rewrite the code in io/statx_generic.c to avoid the
compound literal, so that we only initialize the first 256 bytes of the
struct, regardless of its definition.  I do not think we have another
dependency on the struct size in the glibc sources that becomes
problematic if the kernel enlarges its definition.

Thanks,
Florian


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