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:   Thu, 17 Feb 2022 09:29:14 -0800
From:   Kees Cook <keescook@...omium.org>
To:     David Gow <davidgow@...gle.com>
Cc:     Jeff Dike <jdike@...toit.com>, Richard Weinberger <richard@....at>,
        Anton Ivanov <anton.ivanov@...bridgegreys.com>,
        Al Viro <viro@...iv.linux.org.uk>, x86@...nel.org,
        linux-um@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] um: Cleanup syscall_handler_t definition/cast, fix
 warning

On Thu, Feb 10, 2022 at 11:43:53AM +0800, David Gow wrote:
> The syscall_handler_t type for x86_64 was defined as 'long (*)(void)',
> but always cast to 'long (*)(long, long, long, long, long, long)' before
> use. This now triggers a warning (see below).
> 
> Define syscall_handler_t as the latter instead, and remove the cast.
> This simplifies the code, and fixes the warning.
> 
> Warning:
> In file included from ../arch/um/include/asm/processor-generic.h:13
>                  from ../arch/x86/um/asm/processor.h:41
>                  from ../include/linux/rcupdate.h:30
>                  from ../include/linux/rculist.h:11
>                  from ../include/linux/pid.h:5
>                  from ../include/linux/sched.h:14
>                  from ../include/linux/ptrace.h:6
>                  from ../arch/um/kernel/skas/syscall.c:7:
> ../arch/um/kernel/skas/syscall.c: In function ‘handle_syscall’:
> ../arch/x86/um/shared/sysdep/syscalls_64.h:18:11: warning: cast between incompatible function types from ‘long int (*)(void)’ to ‘long int (*)(long int,  long int,  long int,  long int,  long int,  long int)’ [
> -Wcast-function-type]
>    18 |         (((long (*)(long, long, long, long, long, long)) \
>       |           ^
> ../arch/x86/um/asm/ptrace.h:36:62: note: in definition of macro ‘PT_REGS_SET_SYSCALL_RETURN’
>    36 | #define PT_REGS_SET_SYSCALL_RETURN(r, res) (PT_REGS_AX(r) = (res))
>       |                                                              ^~~
> ../arch/um/kernel/skas/syscall.c:46:33: note: in expansion of macro ‘EXECUTE_SYSCALL’
>    46 |                                 EXECUTE_SYSCALL(syscall, regs));
>       |                                 ^~~~~~~~~~~~~~~
> 
> Signed-off-by: David Gow <davidgow@...gle.com>

Thanks for this! I was just about to go figure this out too. :)

Reviewed-by: Kees Cook <keescook@...omium.org>
Tested-by: Kees Cook <keescook@...omium.org>

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ