From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE8BAC43469 for ; Fri, 18 Sep 2020 13:40:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1CF86206A2 for ; Fri, 18 Sep 2020 13:40:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CF86206A2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 26F1D6B007D; Fri, 18 Sep 2020 09:40:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F882900003; Fri, 18 Sep 2020 09:40:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04A436B007D; Fri, 18 Sep 2020 09:40:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0089.hostedemail.com [216.40.44.89]) by kanga.kvack.org (Postfix) with ESMTP id CA4916B007D for ; Fri, 18 Sep 2020 09:40:29 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 893F18249980 for ; Fri, 18 Sep 2020 13:40:29 +0000 (UTC) X-FDA: 77276291778.15.stew82_0b07f362712b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 59BEA1814B0C7; Fri, 18 Sep 2020 13:40:29 +0000 (UTC) X-HE-Tag: stew82_0b07f362712b X-Filterd-Recvd-Size: 2775 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [195.92.253.2]) by imf45.hostedemail.com (Postfix) with ESMTP; Fri, 18 Sep 2020 13:40:28 +0000 (UTC) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJGcW-0014PO-Gq; Fri, 18 Sep 2020 13:40:12 +0000 Date: Fri, 18 Sep 2020 14:40:12 +0100 From: Al Viro To: Christoph Hellwig Cc: Andrew Morton , Jens Axboe , Arnd Bergmann , David Howells , linux-arm-kernel@lists.infradead.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, io-uring@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag Message-ID: <20200918134012.GY3421308@ZenIV.linux.org.uk> References: <20200918124533.3487701-1-hch@lst.de> <20200918124533.3487701-2-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200918124533.3487701-2-hch@lst.de> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Sep 18, 2020 at 02:45:25PM +0200, Christoph Hellwig wrote: > Add a flag to force processing a syscall as a compat syscall. This is > required so that in_compat_syscall() works for I/O submitted by io_uring > helper threads on behalf of compat syscalls. > > Signed-off-by: Christoph Hellwig > --- > arch/sparc/include/asm/compat.h | 3 ++- > arch/x86/include/asm/compat.h | 2 +- > fs/io_uring.c | 9 +++++++++ > include/linux/compat.h | 5 ++++- > include/linux/sched.h | 1 + > 5 files changed, 17 insertions(+), 3 deletions(-) > > diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h > index 40a267b3bd5208..fee6c51d36e869 100644 > --- a/arch/sparc/include/asm/compat.h > +++ b/arch/sparc/include/asm/compat.h > @@ -211,7 +211,8 @@ static inline int is_compat_task(void) > static inline bool in_compat_syscall(void) > { > /* Vector 0x110 is LINUX_32BIT_SYSCALL_TRAP */ > - return pt_regs_trap_type(current_pt_regs()) == 0x110; > + return pt_regs_trap_type(current_pt_regs()) == 0x110 || > + (current->flags & PF_FORCE_COMPAT); Can't say I like that approach ;-/ Reasoning about the behaviour is much harder when it's controlled like that - witness set_fs() shite...