ntpsec | ntp_packetstamp: Fix possible time_t size mismatch. (!1414)

Fred Wright fw at fwright.net
Tue Dec 24 23:21:14 UTC 2024



On Tue, 24 Dec 2024, Gary E. Miller (@garyedmundsmiller) wrote:
> Gary E_ Miller commented: https://gitlab.com/NTPsec/ntpsec/-/merge_requests/1414#note_2273464732
>
>
> I don't know about OSX, but this is not the proper GNU libc fix.
>
> With GNU libc, the size of time_t on 32-bit ABI depends on two #defines.
>
> '-D_FILE_OFFSET_BITS=64', '-D_TIME_BITS=64',
>
> This is the nut of issue #832.  No heuristics needed, just check the two #define.  And they change a more than just time_t.

You're missing the point.  If the format of the timestamp returned with 
the packet differs from the userspace format that the userspace code 
expects (regardless of what that userspace format is), the timestamp needs 
to be converted.  If it doesn't differ, then this simply passes it through 
as is.  There's nothing "heuristic" about checking the size of the 
timestamp provided with the packet.  Unless of course you're worried about 
its returning something entirely different than the expected 
timespec/timeval struct, in which case all bets are off, anyway.

The defines you mention determine userspace expectations.  If they're 
guaranteed to match the supplied timestamp, then fine, no conversion. 
That's definitely not true in at least some OSX cases.

I don't know what issue #832 is, but I don't see any "issues" link on the 
project's GitLab page, making it hard to look up.

Fred Wright


More information about the devel mailing list