Re: [PATCH] time: copy tai value (International Atomic Time, in seconds) to output __user struct in get_old_timex32().

From: Thomas Gleixner
Date: Thu Dec 01 2022 - 10:18:33 EST


Jake,

On Thu, Dec 01 2022 at 10:00, Jake Macneal wrote:
>>> This is despite all other fields of the corresponding __kernel_timex
>>> struct being copied to the old_timex32 __user struct in this function.
>
>> This is completely backwards. get_old_timex32() copies from the user
>> supplied old_timex32 struct to the __kernel_timex struct, no?
>
> You're totally right, I managed to mix up the order right off the bat.
>
>> I'm not against this change per se, but the justification for it really
>> boils down to:
>
>> Make it consistent with the regular syscall
>

> I agree, that's a better summary. There isn't any effect in the kernel
> now due to get_old_timex32() ignoring the tai value from userspace. So
> this patch would be purely aesthetic, although one might argue that
> copying the userspace tai value into txc is also less likely to lead
> to a bug in the future, were any of the functions do_adjtimex(),
> __do_adjtimex(), or process_adjtimex_modes() to be changed in a way so
> that the userspace tai value became used (I realize this is unlikely).

Right. Unlikely or not, consistency is always a good thing.

> I apologize for any confusion I caused.

No problem. Been there, done that :)

Thanks,

tglx