linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: James Bottomley <James.Bottomley@HansenPartnership.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	Hannes Reinecke <hare@suse.com>,
	Matthew Wilcox <willy@infradead.org>,
	David Hildenbrand <david@redhat.com>,
	Nikolay Borisov <nborisov@suse.com>,
	linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] io_uring: fix big-endian compat signal mask handling
Date: Mon, 25 Mar 2019 10:23:33 -0600	[thread overview]
Message-ID: <4c77d293-8eb9-01aa-27f8-7f320082e182@kernel.dk> (raw)
In-Reply-To: <1553530766.2955.51.camel@HansenPartnership.com>

On 3/25/19 10:19 AM, James Bottomley wrote:
> On Mon, 2019-03-25 at 15:34 +0100, Arnd Bergmann wrote:
>> On big-endian architectures, the signal masks are differnet
>> between 32-bit and 64-bit tasks, so we have to use a different
>> function for reading them from user space.
>>
>> io_cqring_wait() initially got this wrong, and always interprets
>> this as a native structure. This is ok on x86 and most arm64,
>> but not on s390, ppc64be, mips64be, sparc64 and parisc.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>  fs/io_uring.c | 10 +++++++++-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/io_uring.c b/fs/io_uring.c
>> index 6aaa30580a2b..8f48d29abf76 100644
>> --- a/fs/io_uring.c
>> +++ b/fs/io_uring.c
>> @@ -1968,7 +1968,15 @@ static int io_cqring_wait(struct io_ring_ctx
>> *ctx, int min_events,
>>  		return 0;
>>  
>>  	if (sig) {
>> -		ret = set_user_sigmask(sig, &ksigmask, &sigsaved,
>> sigsz);
>> +#ifdef CONFIG_COMPAT
>> +		if (in_compat_syscall())
>> +			ret = set_compat_user_sigmask((const
>> compat_sigset_t __user *)sig,
>> +						      &ksigmask,
>> &sigsaved, sigsz);
>> +		else
>> +#endif
> 
> This looks a bit suboptimal: shouldn't in_compat_syscall() be hard
> coded to return 0 if CONFIG_COMPAT isn't defined?  That way the
> compiler can do the correct optimization and we don't have to litter
> #ifdefs and worry about undefined variables and other things.

That requires the types to be valid for !CONFIG_COMPAT, as well as the
sigmask helper.

-- 
Jens Axboe


  reply	other threads:[~2019-03-25 16:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25 14:34 [PATCH 1/2] io_uring: fix big-endian compat signal mask handling Arnd Bergmann
2019-03-25 14:47 ` [PATCH 2/2] arch: add pidfd and io_uring syscalls everywhere Arnd Bergmann
2019-03-25 17:37   ` Paul Burton
2019-03-26  8:40     ` Arnd Bergmann
2019-03-30  9:42   ` Heiko Carstens
2019-03-31  9:47   ` Michael Ellerman
2019-03-31 16:28     ` Arnd Bergmann
2019-04-03  1:19       ` Michael Ellerman
2019-04-01  8:19   ` Geert Uytterhoeven
2019-04-03  2:47   ` Michael Ellerman
2019-04-03 11:11     ` Will Deacon
2019-04-03 13:49       ` Jens Axboe
2019-04-03 15:19         ` Will Deacon
2019-04-03 15:39           ` Jens Axboe
2019-04-03 15:49             ` Will Deacon
2019-04-03 15:51               ` Jens Axboe
2019-04-04  6:08         ` Michael Ellerman
2019-03-25 16:05 ` [PATCH 1/2] io_uring: fix big-endian compat signal mask handling Jens Axboe
2019-03-25 16:11   ` Arnd Bergmann
2019-03-25 16:15     ` Jens Axboe
2019-03-25 16:19 ` James Bottomley
2019-03-25 16:23   ` Jens Axboe [this message]
2019-03-25 16:24   ` Arnd Bergmann
2019-03-26  0:13     ` James Bottomley
2019-03-26  8:35       ` Arnd Bergmann

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=4c77d293-8eb9-01aa-27f8-7f320082e182@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=david@redhat.com \
    --cc=hare@suse.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.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).