lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 12 Jan 2021 13:48:06 +0100
From:   Christophe Leroy <christophe.leroy@...roup.eu>
To:     Michael Ellerman <mpe@...erman.id.au>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Paul Mackerras <paulus@...ba.org>, schwab@...ux-m68k.org
Cc:     linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH v2] powerpc/vdso: fix clock_gettime_fallback for vdso32



Le 12/01/2021 à 02:13, Michael Ellerman a écrit :
> Christophe Leroy <christophe.leroy@...roup.eu> writes:
>> From: Andreas Schwab <schwab@...ux-m68k.org>
>>
>> The second argument of __kernel_clock_gettime64 points to a struct
>> __kernel_timespec, with 64-bit time_t, so use the clock_gettime64 syscall
>> in the fallback function for the 32-bit vdso.  Similarily,
>> clock_getres_fallback should use the clock_getres_time64 syscall, though
>> it isn't yet called from the 32-bit vdso.
>>
>> Signed-off-by: Andreas Schwab <schwab@...ux-m68k.org>
>> [chleroy: Moved into the #ifdef CONFIG_VDSO32 block]
> 
> That doesn't build for 64-bit with compat VDSO. Should I just take
> Andreas' version, or do you want to send a v3?

Yes, that #ifdef CONFIG_VDSO32 is crazy, should use __powerpc64__ instead, or __VDSO32__ but that 
one is defined in asflags-y so not sure we have it in C.

I sent v3 just before lunch.

Christophe

> 
> cheers
> 
>> Fixes: d0e3fc69d00d ("powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32")
>> Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
>> ---
>>   arch/powerpc/include/asm/vdso/gettimeofday.h | 27 +++++++++++++++-----
>>   1 file changed, 21 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/vdso/gettimeofday.h b/arch/powerpc/include/asm/vdso/gettimeofday.h
>> index 7a215cc5da77..3ecddd9c6302 100644
>> --- a/arch/powerpc/include/asm/vdso/gettimeofday.h
>> +++ b/arch/powerpc/include/asm/vdso/gettimeofday.h
>> @@ -102,22 +102,22 @@ int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tz
>>   	return do_syscall_2(__NR_gettimeofday, (unsigned long)_tv, (unsigned long)_tz);
>>   }
>>   
>> +#ifdef CONFIG_VDSO32
>> +
>> +#define BUILD_VDSO32		1
>> +
>>   static __always_inline
>>   int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
>>   {
>> -	return do_syscall_2(__NR_clock_gettime, _clkid, (unsigned long)_ts);
>> +	return do_syscall_2(__NR_clock_gettime64, _clkid, (unsigned long)_ts);
>>   }
>>   
>>   static __always_inline
>>   int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
>>   {
>> -	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
>> +	return do_syscall_2(__NR_clock_getres_time64, _clkid, (unsigned long)_ts);
>>   }
>>   
>> -#ifdef CONFIG_VDSO32
>> -
>> -#define BUILD_VDSO32		1
>> -
>>   static __always_inline
>>   int clock_gettime32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
>>   {
>> @@ -129,6 +129,21 @@ int clock_getres32_fallback(clockid_t _clkid, struct old_timespec32 *_ts)
>>   {
>>   	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
>>   }
>> +
>> +#else
>> +
>> +static __always_inline
>> +int clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
>> +{
>> +	return do_syscall_2(__NR_clock_gettime, _clkid, (unsigned long)_ts);
>> +}
>> +
>> +static __always_inline
>> +int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
>> +{
>> +	return do_syscall_2(__NR_clock_getres, _clkid, (unsigned long)_ts);
>> +}
>> +
>>   #endif
>>   
>>   static __always_inline u64 __arch_get_hw_counter(s32 clock_mode,
>> -- 
>> 2.25.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ