From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Date: Fri, 18 Sep 2020 13:40:12 +0000 Subject: Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag Message-Id: <20200918134012.GY3421308@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit List-Id: References: <20200918124533.3487701-1-hch@lst.de> <20200918124533.3487701-2-hch@lst.de> In-Reply-To: <20200918124533.3487701-2-hch@lst.de> 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 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...