Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3299864img; Mon, 25 Mar 2019 07:38:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2MjMSChGKKYDI/aL0ptrKft6iwcViigV3J3fHs8tyoNTXkzHFZITEkJveUGkpwN0IPVla X-Received: by 2002:a17:902:ab95:: with SMTP id f21mr25712254plr.188.1553524698012; Mon, 25 Mar 2019 07:38:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553524698; cv=none; d=google.com; s=arc-20160816; b=Dx17Znf8WxF3sfB8dFROLOhUxy2R4gRmJVXCc7V5alxaVqmpZCht4HHTY+pglKN6zu r41NZVWoflyBl1FxTTOxLJ0wFJhwgR7oFc/kP3YJ3cynbf1tW11agM8FCYJ2js4DqAJW +wLvjPY7HGVA9DmlzuuPWh6Joli2uo3jTKmX3m6zcNGD33GqltEEGvOUiZjoRYV9wrFE 92M7o4MKebAoT1PW+JjI9h8C+GYW2uq24sR4fYRmr4w/RIoE1dCdMXxHq7Ctp4/o+ZfB E7lTddInb7MLGgf6f0Kj3YcNbPwti9JMNsswif5XC+rBswDQRA+x7i2AVzZBARlWuVww f9Ow== 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 :message-id:date:subject:cc:to:from; bh=OQNDefcUHPBcC/a3Yy60wiRuOLrLcvdHqDIy14438Q0=; b=rfGGnKY1hdJqMvY/lUPUKi5G23vmLdEc8Ja0UrXO+DjhbH33Cg4W/h6YWO3CSoTZmB jug+Vp4ED8UFYgcL3cgrguZtYOO11izBVVtXHCATSgGdTN0NYel+jD8x6SrOaDLAzamT eopCK89gFGGmrW2626PcrKcoHuYRIDOaM+gmd4lAqfpepDyFNn0YUi429ae6F9wvUjlT XCs1aMyn+QJ2gfOePXbyoOyCMRno8Thwd7lhxQG9RCaIVRGSn+Zp9HQF/j/r/vvjctSs 5GzUPZTU8/o90VGvUD8n45yb/GAxHnPXfOnUme2rQ+tdUjOPpgBSBjr0KmLev6MvV5M5 zaXw== 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 bg4si13877435plb.238.2019.03.25.07.38.00; Mon, 25 Mar 2019 07:38:18 -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 S1727145AbfCYOhQ (ORCPT + 99 others); Mon, 25 Mar 2019 10:37:16 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:39475 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725355AbfCYOhQ (ORCPT ); Mon, 25 Mar 2019 10:37:16 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MmQUL-1gi8Mn4AZV-00iUks; Mon, 25 Mar 2019 15:36:21 +0100 From: Arnd Bergmann To: Andrew Morton , Jens Axboe Cc: Arnd Bergmann , 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 Subject: [PATCH 1/2] io_uring: fix big-endian compat signal mask handling Date: Mon, 25 Mar 2019 15:34:53 +0100 Message-Id: <20190325143521.34928-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit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linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 + ret = set_user_sigmask(sig, &ksigmask, + &sigsaved, sigsz); + if (ret) return ret; } -- 2.20.0