Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2594902ybt; Tue, 16 Jun 2020 09:51:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyo1BBwpGSFaLT+ah1dojoaN70NP25auhyTkI6AnhvXWXq5SlkPwnwVFajwOGmTfJX8SApw X-Received: by 2002:a17:906:a1cb:: with SMTP id bx11mr3517951ejb.526.1592326317836; Tue, 16 Jun 2020 09:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592326317; cv=none; d=google.com; s=arc-20160816; b=KKIx9XDYNW1c6D2ZXrS15Slhp01PboEhyEfHFzvMv3GUYgAT6rtjZ2dDfDCk+C/1Y9 QyHu2jUmIRv9bAn7yLuQWL0Dxm+Fmr/2v01S2nSp7TDpo/8VQ1Tc4FOUcZvfFYScPt5o h33+jCvC7NlSn1c7eA3ExzhhQlwDCR0ob5GgU787cqBcUiw+Nph4cr51AESQRJ30dPOo 2Jim5aF3qeTT4OULiiYKem7sUQQGuEIUB9YRPQamJY3u1XYntPVa689jf5CRV/0Q0Js3 WU0ggq/WNVIT2l+7cWHfgJA4rz4cqjagAX4kQLTNeIBc3uEpjl5Lta3yJhTdMz35bSvO VQsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=QsGVUs8JzrInRXa7hbWDOvLObJV/GbCnwW9EWyQxZd0=; b=WAsmfZ1TBygwES3NLyEoAllS/W3pJUjW8CDiucEOBD/E9QcjHJCVyZ5NmFn62pWh6o Jf87QyWX30zkhnQnOIJLcO+IEOysaZOPJAowu7IdNexj+Um9ZEG5h8gdkOvphe4BqbYs LXIgs3SmZ9YIg8p/XbsVMSfQ3Pk4dYbBuDkEDvxSSKOo/Hln9w6Kk4qZdsu01ORdjxy7 vXyA0JMfjIt6LEXkLL4Yok6l6meWOv6C2QSYdhdg97DsMDoVy1pHRripwsFM6L0TcJha iY5d+KaXpRZtAKVoAPPdNcNQgajpoVmW0TM8YZ0FlXeYymGTuwd1Hpn4qz/TtqtALUMl O52Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TIEcIC6S; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h25si11218243ejq.384.2020.06.16.09.51.35; Tue, 16 Jun 2020 09:51:57 -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; dkim=pass header.i=@kernel.org header.s=default header.b=TIEcIC6S; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730349AbgFPQtO (ORCPT + 99 others); Tue, 16 Jun 2020 12:49:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:46496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729103AbgFPQtN (ORCPT ); Tue, 16 Jun 2020 12:49:13 -0400 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DA170208D5 for ; Tue, 16 Jun 2020 16:49:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592326153; bh=whW+Qp7psTNhFHe4d6nxYaOM9+Zl8IRIDVXsPpfaoOY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=TIEcIC6S9EGonIcQYyZObnTpBsagbEo+fKRAfxY0mAxs9n6qi+pGHeev+Lz9tX9up cx/IoEKuJ88SAlyYBg9x/W52IQQMXy/9X32/mfUJ/FK8aeF4pwKr87w5i26EigbcBp qc/qTh2wgMDrHf5g8odoMcP/xNcvO8XhUB1CpsDI= Received: by mail-wm1-f51.google.com with SMTP id r9so3529109wmh.2 for ; Tue, 16 Jun 2020 09:49:12 -0700 (PDT) X-Gm-Message-State: AOAM532q1GlIjFVvE5uR4WpqgHJdN0XMTDDOWMursAov1qu0E708ev2W uOuXZwBQofGJ+N9Epkcbfo5+KfDkyb1upyuIDjGdfQ== X-Received: by 2002:a05:600c:22da:: with SMTP id 26mr4143349wmg.176.1592326151499; Tue, 16 Jun 2020 09:49:11 -0700 (PDT) MIME-Version: 1.0 References: <20200616142315.375918-1-brgerst@gmail.com> <20200616142315.375918-2-brgerst@gmail.com> In-Reply-To: <20200616142315.375918-2-brgerst@gmail.com> From: Andy Lutomirski Date: Tue, 16 Jun 2020 09:49:00 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] x86/x32: Use __x64 prefix for X32 compat syscalls To: Brian Gerst Cc: LKML , X86 ML , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Andy Lutomirski , Christoph Hellwig , Arnd Bergmann Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 16, 2020 at 7:23 AM Brian Gerst wrote: > > The ABI prefix for syscalls specifies the argument register mapping, so > there is no specific reason to continue using the __x32 prefix for the > compat syscalls. This change will allow using native syscalls in the X32 > specific portion of the syscall table. Okay, I realize that the x86 syscall machinery is held together by duct tape and a lot of luck, but: > > Signed-off-by: Brian Gerst > --- > arch/x86/entry/syscall_x32.c | 8 +++----- > arch/x86/include/asm/syscall_wrapper.h | 10 +++++----- > 2 files changed, 8 insertions(+), 10 deletions(-) > > diff --git a/arch/x86/entry/syscall_x32.c b/arch/x86/entry/syscall_x32.c > index 3d8d70d3896c..f993e6254043 100644 > --- a/arch/x86/entry/syscall_x32.c > +++ b/arch/x86/entry/syscall_x32.c > @@ -9,15 +9,13 @@ > #include > > #define __SYSCALL_64(nr, sym) > +#define __SYSCALL_COMMON(nr, sym) __SYSCALL_X32(nr, sym) > > -#define __SYSCALL_X32(nr, sym) extern long __x32_##sym(const struct pt_regs *); > -#define __SYSCALL_COMMON(nr, sym) extern long __x64_##sym(const struct pt_regs *); > +#define __SYSCALL_X32(nr, sym) extern long __x64_##sym(const struct pt_regs *); > #include > #undef __SYSCALL_X32 > -#undef __SYSCALL_COMMON > > -#define __SYSCALL_X32(nr, sym) [nr] = __x32_##sym, > -#define __SYSCALL_COMMON(nr, sym) [nr] = __x64_##sym, > +#define __SYSCALL_X32(nr, sym) [nr] = __x64_##sym, > > asmlinkage const sys_call_ptr_t x32_sys_call_table[__NR_x32_syscall_max+1] = { > /* > diff --git a/arch/x86/include/asm/syscall_wrapper.h b/arch/x86/include/asm/syscall_wrapper.h > index a84333adeef2..267fae9904ff 100644 > --- a/arch/x86/include/asm/syscall_wrapper.h > +++ b/arch/x86/include/asm/syscall_wrapper.h > @@ -17,7 +17,7 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs); > * __x64_sys_*() - 64-bit native syscall > * __ia32_sys_*() - 32-bit native syscall or common compat syscall > * __ia32_compat_sys_*() - 32-bit compat syscall On a 64-bit kernel, an "ia32" compat syscall is __ia32_compat_sys_*, but... > - * __x32_compat_sys_*() - 64-bit X32 compat syscall > + * __x64_compat_sys_*() - 64-bit X32 compat syscall Now an x32 compat syscall is __x64_compat? This seems nonsensical. I'm also a bit confused as to how this is even necessary for your other patch.