Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1206946pxk; Fri, 18 Sep 2020 06:41:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTgzLug33WqqKW66RhEfueo36HMNRpYlneWlxjFf9M7+LpDoB1mM2T5s/EmgazYe8XwcrB X-Received: by 2002:a17:906:b74a:: with SMTP id fx10mr35152984ejb.232.1600436513772; Fri, 18 Sep 2020 06:41:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600436513; cv=none; d=google.com; s=arc-20160816; b=uhZIPqG22u88PrKn83phTKZpkJNABt/J84r3JreY4qeVQ01+J+8QHyD2h3VPAUgNZZ lIhvhvegyCGHY5aIEIvn3rvngaIcm2BMA+Zb3DhNV3zD/EeHvQ32/eBeodFpbdKu9iKe WVbQMWfLTEiLJmaXmIhVFlqC6NpLFXqR7hfWneL6btkS6Ngi89inxcdY/C+2rx14vpmV taWtT4QCJ3gDWS+0OrB93EYZxbNw9H0e8EadgeKoK4mialKF19kIUkL8ExWge9qT00Gq N9nDMFsMiBTcR9mjBkMWDtetaakUDSd4FCJo1nSp7MDVTC+hmvI95vlM1zJF0SUnsZw2 cIbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=3XIxJ3jV/cqT61F5Hq82RhaOEcwrgRsVyljCfN+B+4o=; b=E05qK1pnz4e/lPDo2jDxvFUH0DJbilpJbKXnCVzsjMBKdVJQeyr+nCcwDnV8L5sxk7 P3EcxaxOffV9METUxO5wwBfbRPvftMELN4sT4pA3bYCUfTGng7wWFYHxj/ms4m6i3BJq vfgS5oxBPq7o/WUIffyzyLyPA3f6MrR+WBiMHO1dyJTHageCS4ghM4orJaI9dX6AppSy xWh+u4UsfWgX5vipvm4yRip+mgtqyUx2MGh2Sr65G4WCgIFO+/Kkeu5cfRyk7/t0Wmkh 3pXUDZpd+M4dLCSSdECfS6+OwtR0Fils2UDxmfGiKhgiGD3UVSbu9D7mBc8hvHEDdEpy FAcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jp27si2239227ejb.668.2020.09.18.06.41.29; Fri, 18 Sep 2020 06:41:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726613AbgIRNk3 (ORCPT + 99 others); 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: linux-kernel@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...