Subject: Re: [PATCH fixes] powerpc/vdso32: Fallback on getres syscall when clock is unknown

From: Aurelien Jarno <[email-masked]>
Date: Mon, 11 May 2020 00:15:10 +0200

Hi,

On 2020-05-09 09:42, Christophe Leroy wrote:
> There are other clocks than the standard ones, for instance
> per process clocks. Therefore, being above the last standard clock
> doesn't mean it is a bad clock. So, fallback to syscall instead
> of returning -EINVAL inconditionaly.
> 
> Fixes: e33ffc956b08 ("powerpc/vdso32: implement clock_getres entirely")
> Cc: [email-masked]
> Reported-by: Aurelien Jarno <[email-masked]>
> Signed-off-by: Christophe Leroy <[email-masked]>
> ---
>  arch/powerpc/kernel/vdso32/gettimeofday.S | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S
> index a3951567118a..e7f8f9f1b3f4 100644
> --- a/arch/powerpc/kernel/vdso32/gettimeofday.S
> +++ b/arch/powerpc/kernel/vdso32/gettimeofday.S
> @@ -218,11 +218,11 @@ V_FUNCTION_BEGIN(__kernel_clock_getres)
>  	blr
>  
>  	/*
> -	 * invalid clock
> +	 * syscall fallback
>  	 */
>  99:
> -	li	r3, EINVAL
> -	crset	so
> +	li	r0,__NR_clock_getres
> +	sc
>  	blr
>    .cfi_endproc
>  V_FUNCTION_END(__kernel_clock_getres)

Thanks a lot for the fast answer. I have just tested this patch and I
confirm it fixes the issue.

Tested-by: Aurelien Jarno <[email-masked]>

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email-masked]                 http://www.aurel32.net