From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>,
Andy Lutomirski <luto@kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Linus Torvalds <torvalds@linux-foundation.org>,
X86 ML <x86@kernel.org>, linux-arch <linux-arch@vger.kernel.org>,
David Miller <davem@davemloft.net>,
"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
Chris Metcalf <cmetcalf@ezchip.com>,
linux-parisc@vger.kernel.org,
"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
sparclinux@vger.kernel.org
Subject: Re: [PATCH v2 14/16] input: Redefine INPUT_COMPAT_TEST as in_compat_syscall()
Date: Wed, 23 Mar 2016 11:42:48 -0700 [thread overview]
Message-ID: <20160323184248.GA25479@dtor-ws> (raw)
In-Reply-To: <20160322135152.78d21ee6d56b702f06c5e01f@linux-foundation.org>
On Tue, Mar 22, 2016 at 01:51:52PM -0700, Andrew Morton wrote:
> On Wed, 27 Jan 2016 13:06:10 -0800 Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
>
> > On Wed, Jan 27, 2016 at 12:29:14PM -0800, Andy Lutomirski wrote:
> > > On Wed, Jan 27, 2016 at 11:17 AM, Dmitry Torokhov
> > > <dmitry.torokhov@gmail.com> wrote:
> > > > Hi Andy,
> > > >
> > > > On Mon, Jan 25, 2016 at 2:24 PM, Andy Lutomirski <luto@kernel.org> wrote:
> > > >> The input compat code should work like all other compat code: for
> > > >> 32-bit syscalls, use the 32-bit ABI and for 64-bit syscalls, use the
> > > >> 64-bit ABI. We have a helper for that (in_compat_syscall()): just
> > > >> use it.
> > > >>
> > > >> Signed-off-by: Andy Lutomirski <luto@kernel.org>
> > > >> ---
> > > >> drivers/input/input-compat.h | 12 +-----------
> > > >> 1 file changed, 1 insertion(+), 11 deletions(-)
> > > >>
> > > >> diff --git a/drivers/input/input-compat.h b/drivers/input/input-compat.h
> > > >> index 148f66fe3205..0f25878d5fa2 100644
> > > >> --- a/drivers/input/input-compat.h
> > > >> +++ b/drivers/input/input-compat.h
> > > >> @@ -17,17 +17,7 @@
> > > >>
> > > >> #ifdef CONFIG_COMPAT
> > > >>
> > > >> -/* Note to the author of this code: did it ever occur to
> > > >> - you why the ifdefs are needed? Think about it again. -AK */
> > > >> -#if defined(CONFIG_X86_64) || defined(CONFIG_TILE)
> > > >> -# define INPUT_COMPAT_TEST is_compat_task()
> > > >> -#elif defined(CONFIG_S390)
> > > >> -# define INPUT_COMPAT_TEST test_thread_flag(TIF_31BIT)
> > > >> -#elif defined(CONFIG_MIPS)
> > > >> -# define INPUT_COMPAT_TEST test_thread_flag(TIF_32BIT_ADDR)
> > > >> -#else
> > > >> -# define INPUT_COMPAT_TEST test_thread_flag(TIF_32BIT)
> > > >> -#endif
> > > >> +#define INPUT_COMPAT_TEST in_compat_syscall()
> > > >>
> > > >
> > > >
> > > > If we now have function that works on all arches I'd prefer if we used
> > > > it directly instead of continuing using INPUT_COMPAT_TEST.
> > >
> > > I'll write a followup patch for that if you don't beat me to it.
> >
> > I promise I wont ;)
>
> Well someone needs beating!
>
> I'm prepping this patch for Linus now. I shall queue up the below for
> later.
Thank you Andrew.
>
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: drivers/input: eliminate INPUT_COMPAT_TEST macro
>
> INPUT_COMPAT_TEST became much simpler after "input: redefine
> INPUT_COMPAT_TEST as in_compat_syscall()" so we can cleanly eliminate it
> altogether.
>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Andy Lutomirski <luto@amacapital.net>
> Cc: Andy Lutomirski <luto@kernel.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>
> drivers/input/input-compat.c | 6 +++---
> drivers/input/input-compat.h | 4 +---
> drivers/input/input.c | 2 +-
> drivers/input/misc/uinput.c | 4 ++--
> 4 files changed, 7 insertions(+), 9 deletions(-)
>
> diff -puN drivers/input/input-compat.h~a drivers/input/input-compat.h
> --- a/drivers/input/input-compat.h~a
> +++ a/drivers/input/input-compat.h
> @@ -17,8 +17,6 @@
>
> #ifdef CONFIG_COMPAT
>
> -#define INPUT_COMPAT_TEST in_compat_syscall()
> -
> struct input_event_compat {
> struct compat_timeval time;
> __u16 type;
> @@ -57,7 +55,7 @@ struct ff_effect_compat {
>
> static inline size_t input_event_size(void)
> {
> - return (INPUT_COMPAT_TEST && !COMPAT_USE_64BIT_TIME) ?
> + return (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) ?
> sizeof(struct input_event_compat) : sizeof(struct input_event);
> }
>
> diff -puN drivers/input/misc/uinput.c~a drivers/input/misc/uinput.c
> --- a/drivers/input/misc/uinput.c~a
> +++ a/drivers/input/misc/uinput.c
> @@ -664,7 +664,7 @@ struct uinput_ff_upload_compat {
> static int uinput_ff_upload_to_user(char __user *buffer,
> const struct uinput_ff_upload *ff_up)
> {
> - if (INPUT_COMPAT_TEST) {
> + if (in_compat_syscall()) {
> struct uinput_ff_upload_compat ff_up_compat;
>
> ff_up_compat.request_id = ff_up->request_id;
> @@ -695,7 +695,7 @@ static int uinput_ff_upload_to_user(char
> static int uinput_ff_upload_from_user(const char __user *buffer,
> struct uinput_ff_upload *ff_up)
> {
> - if (INPUT_COMPAT_TEST) {
> + if (in_compat_syscall()) {
> struct uinput_ff_upload_compat ff_up_compat;
>
> if (copy_from_user(&ff_up_compat, buffer,
> diff -puN drivers/input/input-compat.c~a drivers/input/input-compat.c
> --- a/drivers/input/input-compat.c~a
> +++ a/drivers/input/input-compat.c
> @@ -17,7 +17,7 @@
> int input_event_from_user(const char __user *buffer,
> struct input_event *event)
> {
> - if (INPUT_COMPAT_TEST && !COMPAT_USE_64BIT_TIME) {
> + if (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) {
> struct input_event_compat compat_event;
>
> if (copy_from_user(&compat_event, buffer,
> @@ -41,7 +41,7 @@ int input_event_from_user(const char __u
> int input_event_to_user(char __user *buffer,
> const struct input_event *event)
> {
> - if (INPUT_COMPAT_TEST && !COMPAT_USE_64BIT_TIME) {
> + if (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) {
> struct input_event_compat compat_event;
>
> compat_event.time.tv_sec = event->time.tv_sec;
> @@ -65,7 +65,7 @@ int input_event_to_user(char __user *buf
> int input_ff_effect_from_user(const char __user *buffer, size_t size,
> struct ff_effect *effect)
> {
> - if (INPUT_COMPAT_TEST) {
> + if (in_compat_syscall()) {
> struct ff_effect_compat *compat_effect;
>
> if (size != sizeof(struct ff_effect_compat))
> diff -puN drivers/input/input.c~a drivers/input/input.c
> --- a/drivers/input/input.c~a
> +++ a/drivers/input/input.c
> @@ -1015,7 +1015,7 @@ static int input_bits_to_string(char *bu
> {
> int len = 0;
>
> - if (INPUT_COMPAT_TEST) {
> + if (in_compat_syscall()) {
> u32 dword = bits >> 32;
> if (dword || !skip_empty)
> len += snprintf(buf, buf_size, "%x ", dword);
> _
>
--
Dmitry
next prev parent reply other threads:[~2016-03-23 18:42 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-25 22:24 [PATCH v2 00/16] compat: Introduce and use in_compat_syscall Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
2016-01-25 22:24 ` [PATCH v2 01/16] compat: Add in_compat_syscall to ask whether we're in a compat syscall Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
2016-01-25 22:24 ` [PATCH v2 02/16] sparc/compat: Provide an accurate in_compat_syscall implementation Andy Lutomirski
2016-01-25 22:51 ` David Miller
2016-01-25 22:51 ` David Miller
2016-01-26 6:29 ` Sam Ravnborg
2016-01-26 6:29 ` Sam Ravnborg
2016-01-26 6:51 ` David Miller
2016-01-26 17:44 ` Sam Ravnborg
2016-01-26 17:44 ` Sam Ravnborg
2016-01-26 17:48 ` Andy Lutomirski
2016-01-26 17:48 ` Andy Lutomirski
2016-01-26 18:04 ` David Miller
2016-01-26 18:04 ` David Miller
2016-01-25 22:24 ` [PATCH v2 03/16] sparc/syscall: Fix syscall_get_arch Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
2016-01-25 22:24 ` [PATCH v2 04/16] seccomp: Check in_compat_syscall, not is_compat_task, in strict mode Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
2016-01-25 22:24 ` [PATCH v2 05/16] ptrace: in PEEK_SIGINFO, check syscall bitness, not task bitness Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
2016-01-25 22:24 ` [PATCH v2 06/16] auditsc: For seccomp events, log syscall compat state using in_compat_syscall Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
2016-01-25 22:24 ` [PATCH v2 07/16] staging/lustre: Switch from is_compat_task to in_compat_syscall Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
2016-01-25 22:24 ` [PATCH v2 08/16] ext4: In ext4_dir_llseek, check syscall bitness directly Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
2016-01-25 22:24 ` [PATCH v2 09/16] net/sctp: Use in_compat_syscall for sctp_getsockopt_connectx3 Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
2016-01-25 22:24 ` [PATCH v2 10/16] net/xfrm_user: Use in_compat_syscall to deny compat syscalls Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
2016-01-25 22:24 ` [PATCH v2 11/16] firewire: Use in_compat_syscall to check ioctl compatness Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
2016-01-25 22:24 ` [PATCH v2 12/16] efivars: Use in_compat_syscall to check for compat callers Andy Lutomirski
2016-01-25 22:24 ` [PATCH v2 13/16] amdkfd: Use in_compat_syscall to check open() caller type Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
2016-01-25 22:24 ` [PATCH v2 14/16] input: Redefine INPUT_COMPAT_TEST as in_compat_syscall() Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
2016-01-27 19:17 ` Dmitry Torokhov
2016-01-27 19:17 ` Dmitry Torokhov
2016-01-27 20:29 ` Andy Lutomirski
2016-01-27 20:29 ` Andy Lutomirski
2016-01-27 21:06 ` Dmitry Torokhov
2016-03-22 20:51 ` Andrew Morton
2016-03-22 20:51 ` Andrew Morton
2016-03-23 18:42 ` Dmitry Torokhov [this message]
2016-01-25 22:24 ` [PATCH v2 15/16] uhid: Check write() bitness using in_compat_syscall Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
2016-01-25 22:24 ` [PATCH v2 16/16] x86/compat: Remove is_compat_task Andy Lutomirski
2016-01-25 22:24 ` Andy Lutomirski
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=20160323184248.GA25479@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cmetcalf@ezchip.com \
--cc=davem@davemloft.net \
--cc=linux-arch@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=luto@kernel.org \
--cc=sparclinux@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
--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).