Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5489560imu; Tue, 13 Nov 2018 07:21:32 -0800 (PST) X-Google-Smtp-Source: AJdET5dgK0iKOYw7zWBPRZxNqCJJC6bB68y1K0lzXkusaazc4TlW7czKRp1Vw1me2tjU9s8FGiXS X-Received: by 2002:a17:902:108a:: with SMTP id c10-v6mr2774476pla.171.1542122492461; Tue, 13 Nov 2018 07:21:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542122492; cv=none; d=google.com; s=arc-20160816; b=Q0Vto4gE1V6s7iim3zMf8VEvcvbtqYuIS4pq7aN1F0f1VOThr4Ak9m6LdFxZoil6WM 6nW40gxSDDFEjLzXiJLzcRHux10ypwJH3/ZactjRQ4n1Y6/v0lywBzWBp0vT5J8zJ5fm TwbHo1J3RU5amAM4KG35wI8FCuZdf+u0lemS6M+/Rdk/qJ9Ttgatmr0yu6vDkNOJO1Wa qVyrheWBLm6AYLb0QDlQsX3UCx+oBgwY692uuQpYRvGHm4BHUj6X73R3Zxxx3ec1/b5N dk9or9r9j1D24DxVUMARCektFhliR3ka5oProQLqk3t+xuibA9Pf035utRfidMuJfTSO p0Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=mdUuw75ZKExAhDl45o1VFXv/8InptxNic/avhUlc054=; b=pIscpbaI5Sn1Ztdy+q63gDpDJMXmCknh3pD5H5T1z/Elsd5uY3lVEY867g+OullkKW AkxpuGDBqLppqmNIphMpcqlv6OLP20WWoVq5szC4EUyKBtKU7fMoCpjRQ8RZB1GOS5ZS wGV3SV4GK01W2ph5EGTfx2TZQgY/O+DGbh9FefB1RJoxHdtDviVVDiMO3LGn9Nbad9J+ 4Ck2zj4JH37KMzxG0iO/jMsUkLwMe7Htmkco4jOB9j5Uc0bMRSAxc6HmrbwuQl1PmcfB ukN3o212QQG3FcLAqgJbtnqtLMds1MTECiTC8ISCAAZKhYo86Y3fPKjgUGNSQCG3pWzy yuYw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f184-v6si11483386pfb.252.2018.11.13.07.21.11; Tue, 13 Nov 2018 07:21:32 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387748AbeKNBT0 (ORCPT + 99 others); Tue, 13 Nov 2018 20:19:26 -0500 Received: from mx2.suse.de ([195.135.220.15]:53006 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732000AbeKNBT0 (ORCPT ); Tue, 13 Nov 2018 20:19:26 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9DDE1B141; Tue, 13 Nov 2018 15:20:49 +0000 (UTC) From: Alexander Graf To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Catalin Marinas , Will Deacon , Richard Brown , Matthias Brugger Subject: [PATCH] arm64: Make kpti command line options x86 compatible Date: Tue, 13 Nov 2018 16:20:46 +0100 Message-Id: <20181113152046.22389-1-agraf@suse.de> X-Mailer: git-send-email 2.12.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I've already stumbled over 2 cases where people got confused about how to disable kpti on AArch64. In both cases, they used existing x86_64 options and just applied that to an AArch64 system, expecting it to work. I think it makes a lot of sense to have compatible kernel command line parameters whenever we can have them be compatible. So this patch adds the pti= and no_pti kernel command line options, mapping them into the existing kpti= command line framework. It preserves the old syntax to maintain compatibility with older command lines. While at it, the patch also marks the respective options as dual-arch. Reported-by: Richard Brown Signed-off-by: Alexander Graf --- Documentation/admin-guide/kernel-parameters.txt | 6 +++--- arch/arm64/kernel/cpufeature.c | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 81d1d5a74728..4a1c6bcfcdb5 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3522,8 +3522,8 @@ pt. [PARIDE] See Documentation/blockdev/paride.txt. - pti= [X86_64] Control Page Table Isolation of user and - kernel address spaces. Disabling this feature + pti= [X86_64,ARM64] Control Page Table Isolation of user + and kernel address spaces. Disabling this feature removes hardening, but improves performance of system calls and interrupts. @@ -3534,7 +3534,7 @@ Not specifying this option is equivalent to pti=auto. - nopti [X86_64] + nopti [X86_64,ARM64] Equivalent to pti=off pty.legacy_count= diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index af50064dea51..12bb3b0470dd 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -978,13 +978,26 @@ static int __init parse_kpti(char *str) bool enabled; int ret = strtobool(str, &enabled); - if (ret) + if (ret) { + if (!strncmp(str, "auto", 4)) { + __kpti_forced = 0; + return 0; + } return ret; + } __kpti_forced = enabled ? 1 : -1; return 0; } early_param("kpti", parse_kpti); +early_param("pti", parse_kpti); + +static int __init handle_no_pti(char *p) +{ + __kpti_forced = -1; + return 0; +} +early_param("nopti", parse_no_pti); #endif /* CONFIG_UNMAP_KERNEL_AT_EL0 */ #ifdef CONFIG_ARM64_HW_AFDBM -- 2.12.3