Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3392896img; Mon, 25 Mar 2019 09:21:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOz5XjBuTlHQlvwsq0KaKjSN1fcjGK8wpVzhU5ZSdQJKkrYWH9aRtgHfyEsdvZJnLseduB X-Received: by 2002:a63:3f8b:: with SMTP id m133mr23751280pga.91.1553530902902; Mon, 25 Mar 2019 09:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553530902; cv=none; d=google.com; s=arc-20160816; b=T4ZbRzLEOrfN3KtjUr5B0rHctTW79LUt1FjkFWlUBgcW70UezYd++ZRLKZ2jGeywl0 dkoAhNUaA8T5hL0YCz+wUlPCBahjss/Q4Pzk4z3geSLxH5cK5WlHR3MgSXkaWaLaAtee WtWe6CgypcbZiMNJ3VGIUY3YRWYioCScRV70+OSE9zjzaTvtawuXueXQ9zWG5HOtZFTT wWQu7rLZweYvmk5hXJWHocpzamEkm77tUe9pz4piFGRZc059ZhamjYAkdzhALBJd+ci5 Z21lBwgKykUThP7gcRMYG/v0MegIIBY7QwqNN4yQ7Sh+XsFeUSlERTgCs8yjjX/ZiQrS eBHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=trOpCQXgo2qKzypSFCaOfgT2ZyuOiOY1z3BIfbOK048=; b=cM1nWdox/T1PNAJaA9yli/t7mBy9zlc/CsT3G25h+b9FtaKlC3CAMtKBXWu/biS6Ye 04cEkyk+oC3SCQacEePmvvo0Tn7D3yySzC1V0KYKgcVEYukO7XhJmE0+VAp0mv7rtkkp TruMfECWXEAcGhLHKqKoLhMmMtV+US9UQRCFFP7REmJyaGz3G+2YaAcNK0DrHUqnByG1 dX2oTa7nU+9XJ1//LSPpTWnuZy94XpJEwJJZxM4Ogj0HHctSaj9VwW8e7WEuZjVizhy2 TZxSPHLmm4DT5dRL/xYgWfshBHrzWJhYNddW+nBYZY5Oj9+VcisetZnZHF3RaIg7aL4v oScw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b="nDm/dgy8"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s78si13786934pfa.161.2019.03.25.09.21.27; Mon, 25 Mar 2019 09:21:42 -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; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b="nDm/dgy8"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729538AbfCYQT3 (ORCPT + 99 others); Mon, 25 Mar 2019 12:19:29 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:36248 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729182AbfCYQT3 (ORCPT ); Mon, 25 Mar 2019 12:19:29 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 2B2338EE0E0; Mon, 25 Mar 2019 09:19:28 -0700 (PDT) Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YaSfB_YKKZQI; Mon, 25 Mar 2019 09:19:27 -0700 (PDT) Received: from [153.66.254.194] (unknown [50.35.68.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 496488EE0DF; Mon, 25 Mar 2019 09:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1553530767; bh=+3uWbRb3VNNt1gddenhaoH9K4l+ztpTwtY1m4yMYWjA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=nDm/dgy8L5tykk8qxInC6Zx9Z56uXaCSkypB44YG8n9FRgXEi/91oKe9zo0VByP1L Jm6fLzWFykZqsAxsIty2vpk9tPDi2GbFD3AEnQRwMMjV98WIhJARtmeuN+vGgHa9XX Etz+mJ/1dt1OpIWCFEGBwS0QAnLYNxDuW9MMye/I= Message-ID: <1553530766.2955.51.camel@HansenPartnership.com> Subject: Re: [PATCH 1/2] io_uring: fix big-endian compat signal mask handling From: James Bottomley To: Arnd Bergmann , Andrew Morton , Jens Axboe Cc: Alexander Viro , Hannes Reinecke , Matthew Wilcox , David Hildenbrand , Nikolay Borisov , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 25 Mar 2019 09:19:26 -0700 In-Reply-To: <20190325143521.34928-1-arnd@arndb.de> References: <20190325143521.34928-1-arnd@arndb.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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. James