Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3395176img; Mon, 25 Mar 2019 09:24:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0Cbv9ed5wiX8Ujvj3nERdCXmCZEwnb9Whvf71iFSUBBO5XxxHa75yY7XJBq7Jk0q8eQqE X-Received: by 2002:a65:6210:: with SMTP id d16mr24445445pgv.189.1553531071897; Mon, 25 Mar 2019 09:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553531071; cv=none; d=google.com; s=arc-20160816; b=dX9Vr+ly8EPXcAHlZJgMs77en1guCJKxEVI+AyLH91ZU2XkWL1I9ie47wcytQ55M8G pZkrg6ZZpMDoF3wpFmqJauy5W+go2rxYfz4aXGVSJ/UtarQ74C8DOzeDNyKLZ6+u34pA tIpnYi5USoONVqsh+3+PNu3r0kkNRvxRBZkzwhtmgOHlH6rtTDhJV+qwWRnusjNToYQd wQUQNag1DmfA5RYWeGpRWqkfsCPeDnpJDHdGEGc0nkg6hxT50SWjkGT5D9Jo6DARAG2K 29l0LJkiqL84SYGLZU6SL+zESSL3AXDA2kkVAF3fuhd4DH0zdKqCGp3NWYLrqm0hBqn+ 6ChA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=5RYC5QkNPmWnV7M+cp152sH2vhCRnoMiK4CZtvvJh04=; b=cq7GodM4Bs640SsDtGCpiTAo5PTn8tHXSmcJkYtV16+I5KI0aV3XpTeI3DBks6BT10 s44QLZlxsqw50niZAmkWhY3czleq2rfSpDCYnKBh/QI+3FOJUbavMe3evULU+JpxUObW iS/uZyGHVakpdnf69M61DpRK1en50aH17kWWlWfDwrr/94XkZ4o7jWWCrmFD11eyJ30q 5z6y1ZxCN31zZUE2KWRuVdYVSO5uKgTNYd0JF73yhOkIQ2nLzfB+RatQ8JTlAZtzKLfP dxQqHQUGDY21ePkulxB9Xp3PpHr1D1PyN+TockstEtWG3HSDMII1ZU0OkxG6NsXE1c+A 7zqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=a4p6XGps; 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 b142si13910407pfb.61.2019.03.25.09.24.16; Mon, 25 Mar 2019 09:24:31 -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=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=a4p6XGps; 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 S1729618AbfCYQXi (ORCPT + 99 others); Mon, 25 Mar 2019 12:23:38 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:54605 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727145AbfCYQXh (ORCPT ); Mon, 25 Mar 2019 12:23:37 -0400 Received: by mail-it1-f193.google.com with SMTP id w18so14863095itj.4 for ; Mon, 25 Mar 2019 09:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=5RYC5QkNPmWnV7M+cp152sH2vhCRnoMiK4CZtvvJh04=; b=a4p6XGpsh4XKbVLZAa544N9Eyip02ETThXf36Kzdq2N67nSugtAGMj8ZW02ZXjqcBo dGqv7gA4t4WGd4x9Zbe1UF99alCbkWJM56ao7ntWpb5lvOLioWPPDXd4q8TAN10gAsi7 AakLjcW6gu94dkOkHpnZ4QUGGZPcF7ihTOTOtMQo1nP7Mw6r9DScn8NuMglhLQZtsV/v Ck5jE1PkfUR8r0LOZyyd3I6PzzP+TuAEpr6tCQ3BzlK6CvBCTWJVQcImhu6Rz0S64t9O XxRvJs+xo95Fz0UI0U6bgSmCt0ckkICGnrEtwE16vSxtoMypxGAKYQyA6nH5l5+sw2x8 E/JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5RYC5QkNPmWnV7M+cp152sH2vhCRnoMiK4CZtvvJh04=; b=CUsmYybn0/WNHoXnWsUivnKjTIoFUR2lkGTeOu9rChuQdeb/qtwsBQuN05nwIHSJBg lgylkxnSXB9ildxZtFMa3V0hUf6SI7Zyd1P2aACzsFGQo+oEI7WT9dwzFMCqCWFGy8M3 oF54gz6n9jXWcXKEpewW+xO5neXpD5oMFZuTQZUxO6Tqo8XTf3eSBNxmJMy1LRT/z5pC zJtc2d8eTJRugO3tuTFi7n+YCp8iUj+uaQk0Rp/97TIQE0+o+vhWlYjFqclYvCIm07ZZ aj8+sM1qiJrL0S0ezaI1RDaGUIuBmcVK/zTloAnowNq25TmBsgfoBecxNy2ea56/+3t7 kHfw== X-Gm-Message-State: APjAAAWBII8tXUeL2tsnwyRkdbolCVJ1jr3vb56CvAsimai+g+1R8LD/ gXirEA6O6S5sJaJeWhGSGSDX7wiUIZlFbQ== X-Received: by 2002:a24:6794:: with SMTP id u142mr9064550itc.84.1553531015661; Mon, 25 Mar 2019 09:23:35 -0700 (PDT) Received: from [192.168.1.158] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id o11sm5992146itb.33.2019.03.25.09.23.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 09:23:34 -0700 (PDT) Subject: Re: [PATCH 1/2] io_uring: fix big-endian compat signal mask handling To: James Bottomley , Arnd Bergmann , Andrew Morton 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 References: <20190325143521.34928-1-arnd@arndb.de> <1553530766.2955.51.camel@HansenPartnership.com> From: Jens Axboe Message-ID: <4c77d293-8eb9-01aa-27f8-7f320082e182@kernel.dk> Date: Mon, 25 Mar 2019 10:23:33 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <1553530766.2955.51.camel@HansenPartnership.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> --- >> 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