Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3396480img; Mon, 25 Mar 2019 09:26:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaWau8Q4SckN4ZCBsJzE+RA8QiSKCom04CPVH/TRcp7PM0QXAzsGQ8A2srOYRu8fG6QU2M X-Received: by 2002:aa7:9090:: with SMTP id i16mr24075788pfa.85.1553531171688; Mon, 25 Mar 2019 09:26:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553531171; cv=none; d=google.com; s=arc-20160816; b=MJTwXHa8tbAqcCcuLbMmOsDcfZxuywPwIrzq5ym9ssFdgygjWNX9AP263gFd+pPxw6 LX878AQ/SEFp7xFt1pPrIF/d6WLKe5RBT6J/RwsiTRGnEVN2Z46vtkIB9gNi9CzSQ6to 3X9QxZGs4NnhYRcrjYY3DUCNVL9/vh627tbSBJ9HA/usneG155HfWmujsqIApSvC2WFr Oembe7iQNBAugl+Vn9RILIsAwqv0tzO17FsiFIv9RJLaIY0sf5w9fTBBAP7Xpr5e1yvS +JEtrBlm69/Y2/W5nYaOazQBk4kLygmU9H6EilSRgLDlm7rGJXZr5nGSlOOD7jGfcRbr UcKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=/3qcFiab5roarwBrwE0AfKKMTRw6Enlx5L9BcfDXngY=; b=kO7blURHO7HVu8xcpMsAEoM+Av9ja/Nn+1j/AX96veWpGTlkA1oMFjRNK7RozeQ9eg clWz/SxRyndAPqKDzfNhcbXSqQwnaLvUbCpDjbi8C9nmm5CiXbBmtwqn/Epqi1twg2Vd ls2r6JyjRzRFMfD6OL8Hm9O7o8D3R/e9S1jvZCxiE1hORiKbQo8bb1EQJnU1XHYAY7wD oV5pGQNLJxF9Wh9X8jdpByPk+UtmPHxtIlcnhQO6aG7aD+cSPjRzuYQSYtlLvDJ/0ghK aOsbn+hGpl7zDw0Y1eTX8N76g9KlVQDjK4iZ+6BgDtsHjCoDKvYLu88QX0orRW57KzWQ GaPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3si13975012plk.108.2019.03.25.09.25.55; Mon, 25 Mar 2019 09:26:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729414AbfCYQZR (ORCPT + 99 others); Mon, 25 Mar 2019 12:25:17 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:35039 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbfCYQZR (ORCPT ); Mon, 25 Mar 2019 12:25:17 -0400 Received: by mail-qt1-f193.google.com with SMTP id h39so11019773qte.2; Mon, 25 Mar 2019 09:25:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/3qcFiab5roarwBrwE0AfKKMTRw6Enlx5L9BcfDXngY=; b=MlpeDtg6ag/3OIs9s00epuGusc5tzfKYxXDlFczJiCyu/A0korFcWQqxAj2uq9s7Vj DdU243z7aql4457kaZi9cd2c6+HFF9ZTE5Pipx7+MQgD2C2FTc8evPk6WxiT3MXyL0tw PwOiLeQo9xf41UZC7fCVmqyTlaCiaCvIE/uTpcOYI0RKG3YLyVNk5ukw0lyu8C9itOsY Y+7U006xi5kPkTbkVgziOseIflmY3y5YL8ao9PN8t3Z4YBpj8dKUbqMMyVHelKqCnRJA gLTd9hPCTzqh8e/164R7ktSU5VaSdifcNL2NAMKU+2sN/TKYcQL5OVzGxbvqyxjNtcsP Mifw== X-Gm-Message-State: APjAAAVjFIf9iQ9/KlBfUyFw6XK6K7m7Zr8nMNwu2co1YtDFto1O6RZ4 1OQBlPWNb6aN68tCEnZAs+38a6RqVvj80CPM0oo= X-Received: by 2002:aed:3b09:: with SMTP id p9mr21351337qte.152.1553531116015; Mon, 25 Mar 2019 09:25:16 -0700 (PDT) MIME-Version: 1.0 References: <20190325143521.34928-1-arnd@arndb.de> <1553530766.2955.51.camel@HansenPartnership.com> In-Reply-To: <1553530766.2955.51.camel@HansenPartnership.com> From: Arnd Bergmann Date: Mon, 25 Mar 2019 17:24:58 +0100 Message-ID: Subject: Re: [PATCH 1/2] io_uring: fix big-endian compat signal mask handling To: James Bottomley Cc: Andrew Morton , Jens Axboe , Alexander Viro , Hannes Reinecke , Matthew Wilcox , David Hildenbrand , Nikolay Borisov , linux-block , Linux FS-devel Mailing List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 25, 2019 at 5:19 PM James Bottomley wrote: > > --- 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. The check can be outside of the #ifdef, but set_compat_user_sigmask is not declared then. I think for the future we can consider just moving the compat logic into set_user_sigmask(), which would simplify most of the callers, but that seemed to invasive as a bugfix for 5.1. Arnd