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=unavailable 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 ECDA8C43464 for ; Fri, 18 Sep 2020 13:40:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B39D120878 for ; Fri, 18 Sep 2020 13:40:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726273AbgIRNk3 (ORCPT ); Fri, 18 Sep 2020 09:40:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725955AbgIRNk1 (ORCPT ); Fri, 18 Sep 2020 09:40:27 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F46CC0613CE; Fri, 18 Sep 2020 06:40:27 -0700 (PDT) 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> Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org 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...