Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp25429lqn; Thu, 11 Apr 2024 12:34:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU1KTAFxQOnehZwInQ9BT77eRWFO4NeHkJiS30KC1jM4BJbi3EDrC8CYVlMWZQb+zczzw5qkwXUi5GHz/z/mWlhww8hwJ3EauDnFJbrKA== X-Google-Smtp-Source: AGHT+IFyv2QpLwkQV1Zius/0GNi7Fx5EhEMhtn8VWRk+rW0IhWD2IqWk21rkVZeIcTNNpAz3uUDv X-Received: by 2002:a05:6a00:21d4:b0:6ea:950f:7d29 with SMTP id t20-20020a056a0021d400b006ea950f7d29mr727878pfj.20.1712864059891; Thu, 11 Apr 2024 12:34:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712864059; cv=pass; d=google.com; s=arc-20160816; b=UUZDXFeFwUtZbc7WSAFpJWK8WyE6dQ+d6jcQhv48Tx4+dfUErTNsKN/fdlLczvVZXy QdhJoSUdVAgoHqsk12E482EmI4EVaMsPhKzspcebXNaeJE85A2MmyI6z6OgZOWlRBbQm zx1xJPCB5PGpH+iS9YnSgFg1tl7HDIVCv+tXr596b/Y01La6psgxbp7V+eOmaTbULVA+ hdBQJvnMDRRcJ2SnUMqfAg45DtIq6FZ2vOrCtMHqB6crABlM0gzODGy5vOREHs1+SlzI 8uFnwY7aG/SthN/DBBa9ho0U0cFp1cnK/iVl1/Uck9/pEYd+agleDNNsT9A4HLZZ5fGi kp4g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=TDS6c2ghnYUkSwWbtZftPqPTODtRchsS8qiLJfzkVWw=; fh=nYoSI1mVglb9zlw/FK7rgxuljxYpauf4NIGR9ZCa4j0=; b=xkaPz5M7VvTB3on2O9HZJew36f8YfmSlg/pq9uGD+h/Y4/21b+SF3t2hjda8k30MUJ VEgy9XT2UJ5sD5LL2SNjF98SEp1HFqVxnVTtHupHB+sh+YPYuEemIzr1ID6FCn+/Hu1T HCRRfeToFGFbP0Ts7zAmCg4GrExRfkj6D9nXWFPWLqevwXDT544lSPOG1rAFRyA2bHZr 3CPqZ+9KvArVUFu3JHpiIL/kyGGXVV1la7dopcvxpLsT9W9rRKt6Yqf3+P9oQ0q5p+qZ RoiapQopaPBb/gg6tTMZbRf3hfeSCD27F4jZDsG2fJopb3rIDc+twCeXwrSZd7aDTYJ9 LCsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=NujZLe3A; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-141462-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141462-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i13-20020a056a00004d00b006e7c1a5e188si1864347pfk.248.2024.04.11.12.34.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 12:34:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141462-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=NujZLe3A; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-141462-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141462-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 239BFB2D990 for ; Thu, 11 Apr 2024 18:39:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 35CF1179A8; Thu, 11 Apr 2024 18:16:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NujZLe3A" Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) (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 1D27F168DD for ; Thu, 11 Apr 2024 18:16:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712859373; cv=none; b=Z3ADbgurrLgjGjt+PzjBAE+jVW114TyTKbmKl2lMXhFr2tnlnimQrraj9FfZW4PvbpGCNI7oIP6kRhQu5vGbUk7UWHVyIeHa4s4ZEBHKxAZV6GqCvIL7xh4KkHRWLikrHSYUHdr78TiIQ676esx4UxMH3IDyaxn10Vp6/zKrtyA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712859373; c=relaxed/simple; bh=Ho5HKMrHsYHBj97jJ6q/xDBtZbPcTs+t1YmVTN+iWoU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=m8vMXwCxTjtCkJJcGfuAAXM2cn57TPfg+FgVsN1VyQ/1gsCQ7PZMC4lFOsmNCLTi1dzzquHn2S+4SlXyGWtJwRNZltKNyFdGYUt5K9v8sr38eRSk8sE8b75oM2C45VsNxR4dVPQQCE8rKtoL2spAWkrqkxnvtTc8jxSPQzYl6RA= 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=NujZLe3A; arc=none smtp.client-ip=209.85.160.47 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 Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-22a96054726so121694fac.0 for ; Thu, 11 Apr 2024 11:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712859371; x=1713464171; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=TDS6c2ghnYUkSwWbtZftPqPTODtRchsS8qiLJfzkVWw=; b=NujZLe3AkI0Jut6UPlGMvxMlB0yOalI9cFij1lYoQ2fsJWCOC6V2GA33m0l2IsOJnY gwrwHh1B/7qPP24wpeZItgKIGP7plj/nO9kB4w4XSxdVoCFy4/voQWLm3tcdd2DUK6Qs O7Eie3PE1pKilAdH/+8NU4C67yO4subQ2FUWYlq9cmdj97phaFmYZCosA374aL01oG0V XFb07kcylFvMeC3jOrqG6yQbEK93F/AFFUSY5fR5V+nUGXNug/FkEd1zsKwnb6Mc9yEb sT2df3QFTGIpJ2AHKIxL2kwJzsUX41SctfsYij6d1EBsnIIkO6znU/odbBEp1PGJ3CBS 2mzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712859371; x=1713464171; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TDS6c2ghnYUkSwWbtZftPqPTODtRchsS8qiLJfzkVWw=; b=BaeehsvwimUKzR9gW9NTBJywbrfHPgrqDnWywol5RJOYrrISzXSeYri26PqfPcHXq3 a61425dPPBV5XriVEs9LnNaqcrqhc7974QeEfBKWrR1y+z+rNbaMKu39oRhUsxBcKR3P 233LoEacIg0rDNRORv+d8SBVRY7XZrBhNTCNrnjccCGCF8yG6yWHJSNwK+tIdUGORZuc 3IGcYcuX3lzkDWsdj531EU8Ylb7Oc8AwNhuARhCWj0ZHu/ur69vsir5gn31YyXk3LDQF EH03A45a0UDmXnPq0sjgKUMzK/NFfSJy4w8QtKZebp5LODRqgEPlKn4LmtX6AscNhDqI xD0g== X-Forwarded-Encrypted: i=1; AJvYcCWvdYjVmokRecUERvJVk9uGoTVHXanVvXkqKJZgqvyX9n0t1BMJsOAtwfwI1BqaAMGNzSP59BpvebqoD1IlQ/p4ht48Pp0LtOq81wMi X-Gm-Message-State: AOJu0Yw+Fh0xdEEmpwdK6FfIQ9tYQoIF8xQohDbjuP9eBgzb23C6oBpS VN2piXaFKJc4VC0tBkMEXj9vRl7ynC23GpK8+qLA78cLQ8Y04pbyCbAoDdUBl4GSpXr+sAk0+aC G5bwYWOkDRSvHRkoseST+Yd5bfA== X-Received: by 2002:a05:6871:8795:b0:22a:dc7:7d64 with SMTP id td21-20020a056871879500b0022a0dc77d64mr267337oab.10.1712859371153; Thu, 11 Apr 2024 11:16:11 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240410194850.39994-1-jason.andryuk@amd.com> <20240410194850.39994-3-jason.andryuk@amd.com> <74465ac2-0060-4047-97d7-acadcdff4cd4@amd.com> In-Reply-To: <74465ac2-0060-4047-97d7-acadcdff4cd4@amd.com> From: Brian Gerst Date: Thu, 11 Apr 2024 14:15:58 -0400 Message-ID: Subject: Re: [PATCH 2/5] x86/pvh: Make PVH entrypoint PIC for x86-64 To: Jason Andryuk Cc: Juergen Gross , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Stefano Stabellini , Oleksandr Tyshchenko , Paolo Bonzini , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 11, 2024 at 11:26=E2=80=AFAM Jason Andryuk wrote: > > On 2024-04-10 17:00, Brian Gerst wrote: > > On Wed, Apr 10, 2024 at 3:50=E2=80=AFPM Jason Andryuk wrote: > > >> /* 64-bit entry point. */ > >> .code64 > >> 1: > >> + UNWIND_HINT_END_OF_STACK > >> + > >> /* Set base address in stack canary descriptor. */ > >> mov $MSR_GS_BASE,%ecx > >> - mov $_pa(canary), %eax > >> + leal rva(canary)(%ebp), %eax > > > > Since this is in 64-bit mode, RIP-relative addressing can be used. > > > >> xor %edx, %edx > >> wrmsr > >> > >> call xen_prepare_pvh > >> > >> /* startup_64 expects boot_params in %rsi. */ > >> - mov $_pa(pvh_bootparams), %rsi > >> - mov $_pa(startup_64), %rax > >> + lea rva(pvh_bootparams)(%ebp), %rsi > >> + lea rva(startup_64)(%ebp), %rax > > > > RIP-relative here too. > > Yes, thanks for catching that. With the RIP-relative conversion, there > is now: > vmlinux.o: warning: objtool: pvh_start_xen+0x10d: relocation to !ENDBR: > startup_64+0x0 > > I guess RIP-relative made it visible. That can be quieted by adding > ANNOTATE_NOENDBR to startup_64. Change it to a direct jump, since branches are always RIP-relative. Brian Gerst