From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 151311ADC91 for ; Thu, 23 Jan 2025 19:08:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737659283; cv=none; b=S8phUjJ97K6sqzhjX009hP2Xp8ujFDRFniD742M2ATd9UBPk3muKbo8Fizq3xv7g05J1f2QBbvpsrrcgFx5p9cPhsw0OkfVTBIOC/iwoKAefE//PnrRl4i1/L4YmRTQexq/VYR40MI8WxsIkupVy3v92MgfIXuyowdemBqyJfyM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737659283; c=relaxed/simple; bh=cQBv+DubnK8rhYrmruSNwyJCE/YWkw6+R6eeO/00Jkk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=elyXovijWfedp5Yhg1o6csYoDOah4cD3xcoAAwfbUXlzP/7bHLP1sYLnUIjLoMnUBpxIFrfsQ30MQItB3qegtgMCc8hLBOMc/aRF6KZbRFO3AHN5Ndt5IWV1qX7SJP4ZJqFar6i92FwiCxrJJQBJTvo7RhqTCD8IkTI0maH4SYI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=P4p7IUhi; arc=none smtp.client-ip=209.85.160.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P4p7IUhi" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-4679eacf2c5so12647871cf.0 for ; Thu, 23 Jan 2025 11:08:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737659280; x=1738264080; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=J9MELk7wsy87Jt301R7Mtd0voYB2f1eT7xf1zpAQLyw=; b=P4p7IUhixgkDTFaC3l8v9KWc1aHFajRhxEdDxcUhllP+sfea1VEQQ9wa4BLqpo4w+3 UEcwj443nJz1MSZYZDNjz9R1yEiuk47TnkPOse/6prwm3ymXQge8KHBJIcyXSYYamIGj OkST5iuCCA04rYBtjzpstxgs5K+Zh5HZ57cbyIwTYjXqTVqkE+KKh7da9hJwH8+6m5Ep ZSoxRJwzEe4UDT9SoFcshsh6/LLJ4SdnYReUz2eHvzKllxjs9EXnachbhy0ZratPdyZi B1zIY4qpUh3UHVMlTH1nvRLFEDEgHL9df6yDyKWe5/7RFrIfVeITmcao1p1PT/pdcy1t R57A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737659280; x=1738264080; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J9MELk7wsy87Jt301R7Mtd0voYB2f1eT7xf1zpAQLyw=; b=CodiT+ciY6rhOPfbpevoebrRlTFVYOmjQJGtWvepwjhEu0w4/gF9jbES9m1ivinyfu EVCiCLAKuiJZRY+N0cuLNrIgXaBuymHmaDnrGkWRE/aKJYkzsQMrIswo4qNRh6OiJw0y 0KLBrBfC1vV8Oh7M2ZMJQkLCS65uoTvVd/2jVtwKNWvoEeSBspqq3mg1gXyezNZV+2u1 KxreiEXPnfjypaMBYmmxo3hmZ08hbfqHvUPXwR6aeFFyR6q93ARo2QUcZsu4Y1Q+OlQU cbQhfJObyevjgjUmxh7h3zclrCJJGvlrE9PyzGSnUcVGu2/QTzeH9mSt7+48D0Tsq3ip eOtg== X-Gm-Message-State: AOJu0YxdIbVXl3SLDHc5ysoQdF6SzWS78o1/gFcaSDdfSkQQW9Ndv4Kw Qixt0192r5Y0u/aEVCGCHHN2eqr/lY/Wxovo/hiTeHOo8UvMgpQvgERU X-Gm-Gg: ASbGncsHpYWk1pwFBHiv8UzpJtFf4sYB2EYqN/vg0iBaK9rQZ+3ckYsBLwyaTCNC2xE WrPIkqiVoQhp7evq4K2qYqMiafiJcCt/WsDn3+4XI/Q4kG940wSoTKqaPR6f23SI01wwolyPfCw 9s6tEHkA8Pc6zLKK/RbXOlh8vA8eUmk9w7f2OrntHFoFp2ysC/0IalTIGTzBePjAqu15RTaHESZ rhEfp1a01s5Hj7VTyTUZ4fNXu25jl69QPBcfI3oHreKnaxhioRGUnZEMeMLGw== X-Google-Smtp-Source: AGHT+IHM05YvXVJZ/7AAVqFjmgwahP4I+0fHat8eEkBUgDvsqsWJfobQ6M9QWTFhRlSz6NeSFNlavg== X-Received: by 2002:a05:622a:2d5:b0:467:87df:851a with SMTP id d75a77b69052e-46e12a56380mr398220331cf.12.1737659280532; Thu, 23 Jan 2025 11:08:00 -0800 (PST) Received: from citadel.lan ([2600:6c4a:4d3f:6d5c::1019]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46e66b880b6sm1768021cf.69.2025.01.23.11.07.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2025 11:07:59 -0800 (PST) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Ingo Molnar , "H . Peter Anvin" , Thomas Gleixner , Borislav Petkov , Ard Biesheuvel , Uros Bizjak , Brian Gerst Subject: [PATCH v6 04/15] x86/pvh: Use fixed_percpu_data for early boot GSBASE Date: Thu, 23 Jan 2025 14:07:36 -0500 Message-ID: <20250123190747.745588-5-brgerst@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250123190747.745588-1-brgerst@gmail.com> References: <20250123190747.745588-1-brgerst@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Instead of having a private area for the stack canary, use fixed_percpu_data for GSBASE like the native kernel. Signed-off-by: Brian Gerst Reviewed-by: Ard Biesheuvel --- arch/x86/platform/pvh/head.S | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/x86/platform/pvh/head.S b/arch/x86/platform/pvh/head.S index 4733a5f467b8..fa0072e0ca43 100644 --- a/arch/x86/platform/pvh/head.S +++ b/arch/x86/platform/pvh/head.S @@ -173,10 +173,15 @@ SYM_CODE_START(pvh_start_xen) 1: UNWIND_HINT_END_OF_STACK - /* Set base address in stack canary descriptor. */ - mov $MSR_GS_BASE,%ecx - leal canary(%rip), %eax - xor %edx, %edx + /* + * Set up GSBASE. + * Note that, on SMP, the boot cpu uses init data section until + * the per cpu areas are set up. + */ + movl $MSR_GS_BASE,%ecx + leaq INIT_PER_CPU_VAR(fixed_percpu_data)(%rip), %rdx + movq %edx, %eax + shrq $32, %rdx wrmsr /* Call xen_prepare_pvh() via the kernel virtual mapping */ @@ -238,8 +243,6 @@ SYM_DATA_START_LOCAL(gdt_start) SYM_DATA_END_LABEL(gdt_start, SYM_L_LOCAL, gdt_end) .balign 16 -SYM_DATA_LOCAL(canary, .fill 48, 1, 0) - SYM_DATA_START_LOCAL(early_stack) .fill BOOT_STACK_SIZE, 1, 0 SYM_DATA_END_LABEL(early_stack, SYM_L_LOCAL, early_stack_end) -- 2.47.1