From patchwork Thu Sep 14 11:27:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 140337 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp942170vqi; Fri, 15 Sep 2023 03:30:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUDgI4jgWeuBNmkiPYQmyVMydqmF4jbsCs0LJtZLqi+Pd7a19rbMulxlDHXt50IqyAEkA1 X-Received: by 2002:a05:6a20:978d:b0:153:7978:4faa with SMTP id hx13-20020a056a20978d00b0015379784faamr1129711pzc.37.1694773828060; Fri, 15 Sep 2023 03:30:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694773828; cv=none; d=google.com; s=arc-20160816; b=s2N3Ij/ayQD5F4EawlzgXM028OYMneWI51M/K8qmeqZwlU36e+7h7bkyggNX6hXCf1 UQLVwQJbkoqmRR1KYHizcU1b7YO0ZqTusBsJHJTjN2DGF6Pzo4KaCwrsCfJ6/FKpHkP2 ddqte6FyPiFNdU1Soq48s4Ya4mthnDVUO7Il5CY4Ufvmtk1uRSNa3Zdd3Rb9MP+VRc5+ NJuFXxPn7n28SjDhzyaTBECqa8fQzqrwYpXQrHN8orzoSAGLIjJ5x5SSD689lnFr02g1 XwUNd1Xuq6NKnpjYbUtFctgNM3wv9ZdFS8ifv754GbE5npyAL76yTTankK79ttTAoPxK 6yqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=U+9lxCGIAXIBCuloyKhhileQmPydRd0vGCXF79l3kpc=; fh=n7fF7QC0RNRn6F3FQu0v+CrFD4hMTQOXYoV2ln8SMUQ=; b=YtO3tq2Gy1MQEyeoz+nsHUeka5uYTVyJlXruWzaq3WC5DfaRXMaeh7QpoqRdpP/dqY VKV+T949l1npLvbyuVGefm0H8w1ywchVhfNUxzp23Ma/En3jiyEVBcT4nmJdMhkJOXQJ FX6SVdhIx7ElO79aDBeVovv+C+++uTHvQCvPizfptqNGLUD2JNeysNa69j5WPevc8WpL 4VLyNYf7f+fbmkqTa4Hn/zjFFikoWsnYefRAmhf596RsfJvV/oHXrD5/GP2XQGvAo573 wU/yaBcOic6vF5j2S8L4h4Uo+Dw5AnS05ziIDZuciDF+R+kKa+bz7822I6V/PGOROIzJ sI1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="mg/48v65"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id e24-20020a656798000000b0056963f38643si3033938pgr.280.2023.09.15.03.30.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 03:30:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="mg/48v65"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id BE32C80ECF9D; Thu, 14 Sep 2023 04:27:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237722AbjINL1T (ORCPT + 35 others); Thu, 14 Sep 2023 07:27:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235307AbjINL1K (ORCPT ); Thu, 14 Sep 2023 07:27:10 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 305341A5; Thu, 14 Sep 2023 04:27:06 -0700 (PDT) Date: Thu, 14 Sep 2023 11:27:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694690824; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U+9lxCGIAXIBCuloyKhhileQmPydRd0vGCXF79l3kpc=; b=mg/48v65EyGLB5PQpDwmbJGvV4rhym5wswrU+tNtOxHYcn7tkh/+YQByBXlWc0BtzQ+eoK pF665Wge09i7s/wW3vsDh10kfkBJaUJ8HEFF0tgZJnfwxF7CgVyeZAtyPchZz8ktc5t8Xb i12ug582MyApSMnP4MxMXv5u8ghk3aTJpc1UlucXJSwVS1XgI2TiIquVAetiX1LqSS6OYL 0muHLZPlW6iGUhSq+SWLGjSpQ5SDUyqcoJ/sFFo+lcqRQpmdh6avxoXgVQDqvJC9qos+r0 eKeSrxR5Q76g1X8PAzEnfyLz+SXwgix3UDgh6de2asIn93G9NEtO2z4JkjwakQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694690824; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U+9lxCGIAXIBCuloyKhhileQmPydRd0vGCXF79l3kpc=; b=ITm/l6S5+pV3Os5lhA3rDVLwyLR1aZMnOK8BncwwxkjW+MnB7FQptYi4wILiXjwI4PBV0W 5cyHvhVm4QRXESAg== From: "tip-bot2 for Nikolay Borisov" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/entry] x86/entry: Rename ignore_sysret() Cc: Nikolay Borisov , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230623111409.3047467-3-nik.borisov@suse.com> References: <20230623111409.3047467-3-nik.borisov@suse.com> MIME-Version: 1.0 Message-ID: <169469082431.27769.8435967971182289551.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Sep 2023 04:27:33 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1769491901422204551 X-GMAIL-MSGID: 1777099161406968879 The following commit has been merged into the x86/entry branch of tip: Commit-ID: f71e1d2ff8e6a183bd4004bc97c453ba527b7dc6 Gitweb: https://git.kernel.org/tip/f71e1d2ff8e6a183bd4004bc97c453ba527b7dc6 Author: Nikolay Borisov AuthorDate: Fri, 23 Jun 2023 14:14:05 +03:00 Committer: Thomas Gleixner CommitterDate: Thu, 14 Sep 2023 13:19:53 +02:00 x86/entry: Rename ignore_sysret() The SYSCALL instruction cannot really be disabled in compatibility mode. The best that can be done is to configure the CSTAR msr to point to a minimal handler. Currently this handler has a rather misleading name - ignore_sysret() as it's not really doing anything with sysret. Give it a more descriptive name. Signed-off-by: Nikolay Borisov Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20230623111409.3047467-3-nik.borisov@suse.com --- arch/x86/entry/entry_64.S | 4 ++-- arch/x86/include/asm/processor.h | 2 +- arch/x86/kernel/cpu/common.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 43606de..3be71ac 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -1516,12 +1516,12 @@ SYM_CODE_END(asm_exc_nmi) * This handles SYSCALL from 32-bit code. There is no way to program * MSRs to fully disable 32-bit SYSCALL. */ -SYM_CODE_START(ignore_sysret) +SYM_CODE_START(entry_SYSCALL32_ignore) UNWIND_HINT_END_OF_STACK ENDBR mov $-ENOSYS, %eax sysretl -SYM_CODE_END(ignore_sysret) +SYM_CODE_END(entry_SYSCALL32_ignore) #endif .pushsection .text, "ax" diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 0086920..93cd28d 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -399,7 +399,7 @@ static inline unsigned long cpu_kernelmode_gs_base(int cpu) return (unsigned long)per_cpu(fixed_percpu_data.gs_base, cpu); } -extern asmlinkage void ignore_sysret(void); +extern asmlinkage void entry_SYSCALL32_ignore(void); /* Save actual FS/GS selectors and bases to current->thread */ void current_save_fsgs(void); diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 382d4e6..b3f8cba 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -2087,7 +2087,7 @@ void syscall_init(void) (unsigned long)(cpu_entry_stack(smp_processor_id()) + 1)); wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)entry_SYSENTER_compat); #else - wrmsrl_cstar((unsigned long)ignore_sysret); + wrmsrl_cstar((unsigned long)entry_SYSCALL32_ignore); wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)GDT_ENTRY_INVALID_SEG); wrmsrl_safe(MSR_IA32_SYSENTER_ESP, 0ULL); wrmsrl_safe(MSR_IA32_SYSENTER_EIP, 0ULL);