Re: [PATCH v4 0/3] tools/accounting: refactor delay fields and share format_timespec() 

<[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.documentation
Message-ID <[email protected]>
>> >> +struct __kernel_old_timespec {
>> >> +	__kernel_long_t		tv_sec;
>> >> +	long			tv_nsec;
>> >Does this hardcoded long for tv_nsec cause an ABI layout mismatch on x32?
>> >The header comment above explicitly mentions avoiding a hardcoded long to
>> >ensure x32 gets the correct struct layout, but tv_nsec is defined as long
>> >here instead of __kernel_long_t. 
>> >If tools compile against this header on x32, it looks like they will get a
>> >32-bit tv_nsec instead of the 64-bit value expected by the core kernel UAPI,
>> >which could result in truncated timestamps or out-of-bounds structure access.
>> 
>> We cannot replace long with __kernel_long_t for tv_nsec.
>
>The UAPI *is* in fact about to use __kernel_long_t for tv_nsec.
>See commit 79ced850e549 ("y2038: uapi: Use 64-bit
>__kernel_old_timespec::tv_nsec on x32") in -next.

Thanks for the clarification. I've verified that commit 79ced850e549 has
been merged into the next branch, where upstream changed `tv_nsec` of
`__kernel_old_timespec` to `__kernel_long_t`. I will update this
structure definition in our local header to keep our UAPI definitions
aligned with the mainline kernel.

Thanks
Yaxin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.