Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2102756ybh; Fri, 13 Mar 2020 12:54:10 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtOW9UUGNl7yOQyME9sB16Sntn8nQe+pOyx51pezQGu8hHemUfKB09A7D8eg65l5HbPtncs X-Received: by 2002:aca:4e47:: with SMTP id c68mr8684217oib.16.1584129250676; Fri, 13 Mar 2020 12:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584129250; cv=none; d=google.com; s=arc-20160816; b=ukHC946B4lsl3BhYIbUH9x4GB2WDySvq13VRWl0eMJRqfg3wB+tvcR3+qZ9OgIn2CU baJyKSef5IDcPFqmI+CKzVPrUPZwtla7ug6PHA3uJ2k0zfF9lEpokJnRDhzb30irwIAg TLgIm1KqL+mjv2A65mgUmzVLtcpVu0Puw7iaocCmG1EVJRd7Ovge4PP2/zsmbcVndvVQ +XTDNHiAeGlARxRu4LrB13JpMDit3eX1r34RcylRUdjttyhLiCXFj8Q9ljr+CHfqM6eF 3M5e3n3NqhsObzYNj9wgbMciErazjNkxXLPSo4Zeinq1w0gjbO8J2pm7oMrdkCZ3zso1 fdWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JdLgZrHw1sAMv8bl4fbMC3y09BZ5sVeBir4EgIezMcA=; b=asxn/u1T40eE+uWfL+nWoPaSEIAG2GGv+CvpBiKZblNGad+0g9UKgtTsTFTOAc9sBM mLBDn9yFxn+eZcxkSfjxg6diS/u7abc6FrQyAyU/uBLgMTxduCgbHA+JujS11xK+xKfX pXVfLkGzRcAETOPpdq4FKbu7sE31nFya051oYR5zREKYwgHlDWFB9YO7uz86zUge/mzc XK8QzrHSWDWvUye3FdGHaacE0KsCB7fGWeuJz3XzvK9xJ9YvFCcV0fpAtJrWWio4iNkN bybPK5XP5iH+Tq4wxPukeTozrPg9ecoiGXIvYykXR1Ur0tsHyNDu0m9rqqtX2GOnyjOZ DLrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Kn84ucjh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si4004427otr.249.2020.03.13.12.53.58; Fri, 13 Mar 2020 12:54:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Kn84ucjh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727627AbgCMTxO (ORCPT + 99 others); Fri, 13 Mar 2020 15:53:14 -0400 Received: from mail-qv1-f68.google.com ([209.85.219.68]:45476 "EHLO mail-qv1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727376AbgCMTwQ (ORCPT ); Fri, 13 Mar 2020 15:52:16 -0400 Received: by mail-qv1-f68.google.com with SMTP id h20so1366778qvr.12 for ; Fri, 13 Mar 2020 12:52:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JdLgZrHw1sAMv8bl4fbMC3y09BZ5sVeBir4EgIezMcA=; b=Kn84ucjhCAHCMYTbkYpqCwnDB1ttUkrlKerbPULbEhfV9LaeKRI2Pges7AlVxupHHA N+FY+moGLEsmuUw1HSFk0WlPiea4uq6pqqn8P3rJnzB9gtVOq0zDxBdPAwq7ZZ/0kL3c MUuGUU244+gAwJaDEHi7VYl1Bt5dU2bz66s1p1wI+RpOcC4lDy7CHzqqw7TIl5wcn9QD 4SA2T75t7e5LPAEBgNjlYM7iF28gyihhNs4ZROIGv6hS8XJgbYaeNyfIEYZeEN1nigdF +rhguaQOe0Rae5yj4D4CYuMYHgPv4bJshi50WIA9FK6/jV+vWERnvknWTynPJCNHPemF oPQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JdLgZrHw1sAMv8bl4fbMC3y09BZ5sVeBir4EgIezMcA=; b=asK6aFCRRHebFZYjyHkKOrAiYXD9lyMtXn369bSpzVvIBMbuHOZq0R4wme0AWwys5z y3pm2N+7U1XN9z5MV5VqWS/bAEvl7PURbfvuH3yscTK3q9BYPEzIVwqn/fLHx6wKX0XK cebfAlMT7tIdFueIw/gmtcZhzHwutWetaSBMo9401xRH7mD1Nh/0VkGeItM/rwI9m3hJ LKmVsNRbeUo30aQ7pS5jU42PDAKrqG8QWiECZjzuaa7r6VZLrr9KdBXWpnzmoFRCOUSP 32Kz66KLx8cetSNeAuCScHutB97f2Knk4abwE8mHp+f0bjQl5jnZ78y+OOskN2150hrT 4nLg== X-Gm-Message-State: ANhLgQ19Vuz0IqTktzbOcZX8DzhwE5naUxCocxV1YrvRkXCChGzdCIqx 3IDpflguUq2O4JKm21fMuRQagkA= X-Received: by 2002:a0c:e7c3:: with SMTP id c3mr14094176qvo.62.1584129134679; Fri, 13 Mar 2020 12:52:14 -0700 (PDT) Received: from localhost.localdomain (174-084-153-250.res.spectrum.com. [174.84.153.250]) by smtp.gmail.com with ESMTPSA id i28sm31475599qtc.57.2020.03.13.12.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2020 12:52:14 -0700 (PDT) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Andy Lutomirski , Dominik Brodowski , Brian Gerst Subject: [PATCH v4 04/18] x86, syscalls: Refactor SYS_NI macros Date: Fri, 13 Mar 2020 15:51:30 -0400 Message-Id: <20200313195144.164260-5-brgerst@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200313195144.164260-1-brgerst@gmail.com> References: <20200313195144.164260-1-brgerst@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pull the common code out from the SYS_NI macros into a new __SYS_NI macro. Also conditionalize the X64 version in preparation for enabling syscall wrappers on 32-bit native kernels. Signed-off-by: Brian Gerst Reviewed-by: Dominik Brodowski Reviewed-by: Andy Lutomirski --- arch/x86/include/asm/syscall_wrapper.h | 32 ++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/arch/x86/include/asm/syscall_wrapper.h b/arch/x86/include/asm/syscall_wrapper.h index 0117b25e6753..1d96ccebc0d2 100644 --- a/arch/x86/include/asm/syscall_wrapper.h +++ b/arch/x86/include/asm/syscall_wrapper.h @@ -42,6 +42,9 @@ struct pt_regs; return sys_ni_syscall(); \ } +#define __SYS_NI(abi, name) \ + SYSCALL_ALIAS(__##abi##_##name, sys_ni_posix_timers) + #ifdef CONFIG_X86_64 #define __X64_SYS_STUB0(name) \ __SYS_STUB0(x64, sys_##name) @@ -52,10 +55,14 @@ struct pt_regs; #define __X64_COND_SYSCALL(name) \ __COND_SYSCALL(x64, sys_##name) + +#define __X64_SYS_NI(name) \ + __SYS_NI(x64, sys_##name) #else /* CONFIG_X86_64 */ #define __X64_SYS_STUB0(name) #define __X64_SYS_STUBx(x, name, ...) #define __X64_COND_SYSCALL(name) +#define __X64_SYS_NI(name) #endif /* CONFIG_X86_64 */ #ifdef CONFIG_IA32_EMULATION @@ -77,6 +84,9 @@ struct pt_regs; #define __IA32_COMPAT_COND_SYSCALL(name) \ __COND_SYSCALL(ia32, compat_sys_##name) +#define __IA32_COMPAT_SYS_NI(name) \ + __SYS_NI(ia32, compat_sys_##name) + #define __IA32_SYS_STUB0(name) \ __SYS_STUB0(ia32, sys_##name) @@ -87,17 +97,17 @@ struct pt_regs; #define __IA32_COND_SYSCALL(name) \ __COND_SYSCALL(ia32, sys_##name) -#define SYS_NI(name) \ - SYSCALL_ALIAS(__x64_sys_##name, sys_ni_posix_timers); \ - SYSCALL_ALIAS(__ia32_sys_##name, sys_ni_posix_timers) - +#define __IA32_SYS_NI(name) \ + __SYS_NI(ia32, sys_##name) #else /* CONFIG_IA32_EMULATION */ #define __IA32_COMPAT_SYS_STUB0(name) #define __IA32_COMPAT_SYS_STUBx(x, name, ...) #define __IA32_COMPAT_COND_SYSCALL(name) +#define __IA32_COMPAT_SYS_NI(name) #define __IA32_SYS_STUB0(name) #define __IA32_SYS_STUBx(x, name, ...) #define __IA32_COND_SYSCALL(name) +#define __IA32_SYS_NI(name) #endif /* CONFIG_IA32_EMULATION */ @@ -116,10 +126,14 @@ struct pt_regs; #define __X32_COMPAT_COND_SYSCALL(name) \ __COND_SYSCALL(x32, compat_sys_##name) + +#define __X32_COMPAT_SYS_NI(name) \ + __SYS_NI(x32, compat_sys_##name) #else /* CONFIG_X86_X32 */ #define __X32_COMPAT_SYS_STUB0(name) #define __X32_COMPAT_SYS_STUBx(x, name, ...) #define __X32_COMPAT_COND_SYSCALL(name) +#define __X32_COMPAT_SYS_NI(name) #endif /* CONFIG_X86_X32 */ @@ -158,8 +172,8 @@ struct pt_regs; __X32_COMPAT_COND_SYSCALL(name) #define COMPAT_SYS_NI(name) \ - SYSCALL_ALIAS(__ia32_compat_sys_##name, sys_ni_posix_timers); \ - SYSCALL_ALIAS(__x32_compat_sys_##name, sys_ni_posix_timers) + __IA32_COMPAT_SYS_NI(name) \ + __X32_COMPAT_SYS_NI(name) #endif /* CONFIG_COMPAT */ @@ -231,9 +245,9 @@ struct pt_regs; __X64_COND_SYSCALL(name) \ __IA32_COND_SYSCALL(name) -#ifndef SYS_NI -#define SYS_NI(name) SYSCALL_ALIAS(__x64_sys_##name, sys_ni_posix_timers); -#endif +#define SYS_NI(name) \ + __X64_SYS_NI(name) \ + __IA32_SYS_NI(name) /* -- 2.24.1