From: Kees Cook <keescook@chromium.org>
To: Kees Cook <keescook@chromium.org>
Cc: David Gow <davidgow@google.com>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Vitor Massaru Iha <vitor@massaru.org>,
Daniel Latypov <dlatypov@google.com>,
Anton Ivanov <anton.ivanov@cambridgegreys.com>,
Jeff Dike <jdike@addtoit.com>,
Richard Weinberger <richard@nod.at>,
Masahiro Yamada <masahiroy@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org, linux-um@lists.infradead.org,
linux-kbuild@vger.kernel.org, kunit-dev@googlegroups.com,
llvm@lists.linux.dev, x86@kernel.org,
linux-hardening@vger.kernel.org
Subject: [PATCH v3 3/7] um: Cleanup syscall_handler_t definition/cast, fix warning
Date: Sun, 27 Feb 2022 10:45:13 -0800 [thread overview]
Message-ID: <20220227184517.504931-4-keescook@chromium.org> (raw)
In-Reply-To: <20220227184517.504931-1-keescook@chromium.org>
From: David Gow <davidgow@google.com>
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@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220210034353.1065703-1-davidgow@google.com
---
This is just a re-send of the above linked patch, collecting it into this series.
---
arch/x86/um/shared/sysdep/syscalls_64.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/x86/um/shared/sysdep/syscalls_64.h b/arch/x86/um/shared/sysdep/syscalls_64.h
index 48d6cd12f8a5..b6b997225841 100644
--- a/arch/x86/um/shared/sysdep/syscalls_64.h
+++ b/arch/x86/um/shared/sysdep/syscalls_64.h
@@ -10,13 +10,12 @@
#include <linux/msg.h>
#include <linux/shm.h>
-typedef long syscall_handler_t(void);
+typedef long syscall_handler_t(long, long, long, long, long, long);
extern syscall_handler_t *sys_call_table[];
#define EXECUTE_SYSCALL(syscall, regs) \
- (((long (*)(long, long, long, long, long, long)) \
- (*sys_call_table[syscall]))(UPT_SYSCALL_ARG1(®s->regs), \
+ (((*sys_call_table[syscall]))(UPT_SYSCALL_ARG1(®s->regs), \
UPT_SYSCALL_ARG2(®s->regs), \
UPT_SYSCALL_ARG3(®s->regs), \
UPT_SYSCALL_ARG4(®s->regs), \
--
2.32.0
next prev parent reply other threads:[~2022-02-27 18:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-27 18:45 [PATCH v3 0/7] Convert overflow and stackinit to KUnit Kees Cook
2022-02-27 18:45 ` [PATCH v3 1/7] overflow: Provide constant expression struct_size Kees Cook
2022-02-27 18:45 ` [PATCH v3 2/7] lib: overflow: Convert to Kunit Kees Cook
2022-02-27 18:45 ` Kees Cook [this message]
2022-02-27 18:45 ` [PATCH v3 4/7] um: Remove unused timeval_to_ns() function Kees Cook
2022-02-27 18:45 ` [PATCH v3 5/7] um: Allow builds with Clang Kees Cook
2022-02-27 18:45 ` [PATCH v3 6/7] lib: stackinit: Convert to KUnit Kees Cook
2022-02-27 18:45 ` [PATCH v3 7/7] UAPI: Introduce KUnit userspace compatibility Kees Cook
2022-02-27 23:14 ` Kees Cook
2022-03-01 19:56 ` Brendan Higgins
2022-03-03 8:27 ` David Gow
2022-03-03 13:05 ` Greg KH
2022-03-03 17:28 ` Kees Cook
2022-03-03 9:21 ` [PATCH v3 0/7] Convert overflow and stackinit to KUnit David Gow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220227184517.504931-4-keescook@chromium.org \
--to=keescook@chromium.org \
--cc=anton.ivanov@cambridgegreys.com \
--cc=arnd@arndb.de \
--cc=davidgow@google.com \
--cc=dlatypov@google.com \
--cc=gustavoars@kernel.org \
--cc=jdike@addtoit.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=linux@rasmusvillemoes.dk \
--cc=llvm@lists.linux.dev \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=richard@nod.at \
--cc=vitor@massaru.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).