Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1698918ybt; Mon, 15 Jun 2020 07:14:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUzu60gQT2DpOW4oJnjHFuFUzBCJsQ94C8dkPSU7Wdgil48W2VQB0c2yfi9d9M+tkwV2BL X-Received: by 2002:aa7:d0c5:: with SMTP id u5mr23684588edo.51.1592230494151; Mon, 15 Jun 2020 07:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592230494; cv=none; d=google.com; s=arc-20160816; b=EdaWzm+YaVqt48UIE1A0jQ7h4vgdtyBm7YU9YQFc6MpBIYkuZvxz4ma1Olzh0Z2zKQ NFAPGUnatFDoY1pIahbzj/dho7DqsuF2Uf49XWSX1WSEyT+cW8cxY0I+xzMo90Al4Vp1 rqZc/rpIZskavIOVD7cM9cyzkxzjFCpV8eiPaBVEjYPt7QWxI6soIjtcTYAwsxlBKxU+ b9AV2uTfI8f3XMeSR87+jRIUJQ1iLW/NekdxBh3xXRdBEh2avkv2EQrGW2qHjyGX5cUU iAl/+Z+ieog9ECeOpIQfm/VZlYyJLuzZ/0lPRjnWDrn5qPjLICkg4F8rRDhxDsb9zsoO b0eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=pMLD0Rpv2el7V+Ij+oRdctVLqY7yuB+glzb6ixs/0RU=; b=UsxgByEsYTuWQVsDD9BCInDrj69hkKPfXpqHMiBpNDMpPMYby4L5vwaq+MeGGkWstf mmoylum99f+RcyEasW1AE/VUjGHE3Yxc+eQIdqGv5SY+vEyOLP1iM6Bv4ulx3IaTBSCj WyF8/P4SOyZDPO3GehEQAV28NSN/Cl1VyJJmunFlYMy5zxQGDS9eZTqcR70ObO8pKn4O 7ObgeymVaKKjn5z9BzLgNsK4nH6Rat8loocww8a7WaZcWafJw9PKLB6PfCDnPMztoixv 1XKawrgjllDcf0Q/aCQVtNLit2xdLbdE6Z4PYjKb1yVFgH0A4Qt+BzLQJSfMpGru+0/E trrg== 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 se19si8967152ejb.71.2020.06.15.07.14.30; Mon, 15 Jun 2020 07:14:54 -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 S1730342AbgFOOMo (ORCPT + 99 others); Mon, 15 Jun 2020 10:12:44 -0400 Received: from verein.lst.de ([213.95.11.211]:33670 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730111AbgFOOMo (ORCPT ); Mon, 15 Jun 2020 10:12:44 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 1873468AFE; Mon, 15 Jun 2020 16:12:40 +0200 (CEST) Date: Mon, 15 Jun 2020 16:12:39 +0200 From: Christoph Hellwig To: Arnd Bergmann Cc: Christoph Hellwig , Al Viro , Luis Chamberlain , Linux ARM , the arch/x86 maintainers , "open list:BROADCOM NVRAM DRIVER" , Parisc List , linuxppc-dev , linux-s390 , sparclinux , Linux FS-devel Mailing List , linux-arch , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 2/6] exec: simplify the compat syscall handling Message-ID: <20200615141239.GA12951@lst.de> References: <20200615130032.931285-1-hch@lst.de> <20200615130032.931285-3-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 15, 2020 at 03:31:35PM +0200, Arnd Bergmann wrote: > > #ifdef CONFIG_COMPAT > > - if (unlikely(argv.is_compat)) { > > + if (in_compat_syscall()) { > > + const compat_uptr_t __user *compat_argv = > > + compat_ptr((unsigned long)argv); > > compat_uptr_t compat; > > > > - if (get_user(compat, argv.ptr.compat + nr)) > > + if (get_user(compat, compat_argv + nr)) > > return ERR_PTR(-EFAULT); > > > > return compat_ptr(compat); > > } > > #endif > > I would expect that the "#ifdef CONFIG_COMPAT" can be removed > now, since compat_ptr() and in_compat_syscall() are now defined > unconditionally. I have not tried that though. True, I'll give it a spin. > > +/* > > + * x32 syscalls are listed in the same table as x86_64 ones, so we need to > > + * define compat syscalls that are exactly the same as the native version for > > + * the syscall table machinery to work. Sigh.. > > + */ > > +#ifdef CONFIG_X86_X32 > > COMPAT_SYSCALL_DEFINE3(execve, const char __user *, filename, > > - const compat_uptr_t __user *, argv, > > - const compat_uptr_t __user *, envp) > > + const char __user *const __user *, argv, > > + const char __user *const __user *, envp) > > { > > - return do_compat_execve(AT_FDCWD, getname(filename), argv, envp, 0); > > + return do_execveat(AT_FDCWD, getname(filename), argv, envp, 0, NULL); > > } > > Maybe move it to arch/x86/kernel/process_64.c or arch/x86/entry/syscall_x32.c > to keep it out of the common code if this is needed. I'd rather keep it in common code as that allows all the low-level exec stuff to be marked static, and avoid us growing new pointless compat variants through copy and paste. smart compiler to d > I don't really understand > the comment, why can't this just use this? That errors out with: ld: arch/x86/entry/syscall_x32.o:(.rodata+0x1040): undefined reference to `__x32_sys_execve' ld: arch/x86/entry/syscall_x32.o:(.rodata+0x1108): undefined reference to `__x32_sys_execveat' make: *** [Makefile:1139: vmlinux] Error 1