Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2388474rda; Wed, 25 Oct 2023 00:53:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHS0ypXgJ/LuWFaRj7zgcxeZtOieMDqQypr5NeONqw744ZrQoB+ygvbmKHdSS65OTD+LjyC X-Received: by 2002:ac8:7d8c:0:b0:412:395c:e794 with SMTP id c12-20020ac87d8c000000b00412395ce794mr17993135qtd.50.1698220392352; Wed, 25 Oct 2023 00:53:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698220392; cv=none; d=google.com; s=arc-20160816; b=gUGnfOz1wymD1/SQG5K7A2VlFfliIr6P5gzNyqLVtuY+S87bbl0Y2DihoH3g3OBLmx QtzAszafjiO+pqTH1Wxpox6r4GCFPN1S4rAc0BvwsiZiPYqPgF89uxHjP9CYnnQLcHgV OGWINBQZVquGCHqbta2Mew7m6NZOLIRmVVQAxsCxoSRx2gvvSK9QQGjjtaOYBzQnBCwM GGJPaiGFz3et62c7ueaTrn7VYkpa89vvTgeDqflXy30U3WjBdjPSix7mPzykgAwxm9z+ 842e21KwXARynJrwwIwWuDumD8OBGLiqQbusKMeYvBabWoqxQpmowrZsr80pnygOp9X0 26UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :references:cc:to:content-language:subject:from:user-agent :mime-version:date:message-id:dkim-signature; bh=EvDbK3AJ3DIdy4tdTmUriG4VrugsDy7JcPbRZPmtYB4=; fh=ZBC260ziZp3oUT6azBEMCS8GKEZ5O45LTxe47OHt+FE=; b=WKmOj91S5RYTjlQwxgKp3MmOHvjVkF9a+SdQk/K0oqtOfeiNGqjZT2CrYBbhICCbMv E7/izwMyR/5hb5ihdzDaoq74v5Bqfjrw01wA5ZM3THnB0SRViCbelTICCB1QV9gxBgRE GZU2r/zpbKNaV/VGEWLGE6CEVoNr9iySijPLDTgCN+rkpIE10k1iT36d1VEgCQX4D9bi cXJzOqnFjM9WpqFMYKnkc4RYIdfLnGRerVP9fez9nrPjRfCsbnlA+jDuTKKvC01cq5V2 TjzxHTggYT35raxlsuqDeM/T7+OeI0yxOXalLgI91r0ku+3DQMLUdaI04hGN0XjDRa1E svJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@citrix.com header.s=google header.b=oFGKwZ8a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=citrix.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id x128-20020a814a86000000b005a1cf5ae57csi9538727ywa.472.2023.10.25.00.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 00:53:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@citrix.com header.s=google header.b=oFGKwZ8a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=citrix.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id BC25680A13BD; Wed, 25 Oct 2023 00:53:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233963AbjJYHxB (ORCPT + 99 others); Wed, 25 Oct 2023 03:53:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233886AbjJYHw4 (ORCPT ); Wed, 25 Oct 2023 03:52:56 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AF0C116 for ; Wed, 25 Oct 2023 00:52:53 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-32ded3eb835so2909579f8f.0 for ; Wed, 25 Oct 2023 00:52:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1698220372; x=1698825172; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :content-language:subject:from:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=EvDbK3AJ3DIdy4tdTmUriG4VrugsDy7JcPbRZPmtYB4=; b=oFGKwZ8a4elkockZeAI0+Ny8+b1o+2iwfOrpH9GcTi0e/4wFY2OeAW6BC7qiwJRyeK xgsqADjqghiAPcGsjxYRWZpigLFT36XQZPMxlftWNtJCOThEYB2SaQU2SXp6c7EstvsJ DiObnfJ8Y+GMBQ6SqlUlIBRaBTHrOZi099mic= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698220372; x=1698825172; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :content-language:subject:from:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EvDbK3AJ3DIdy4tdTmUriG4VrugsDy7JcPbRZPmtYB4=; b=iae7MEinT0kdXDkC0mzdLS0M2uUr4be3O/FEObVynKImL8MGFiSoWHt1ioJXxeJQOt dPIKE8/7ZzYc369alyA6++cvxsxILqK44skL3pXaDgCXVKU/FJ/cwmUprIAqvisIQ2UM w7z8G9Tp2DesnMkx4wtMyh/RW5sfBeGhezJVB4rKm8fDOcBFI8c2nvRbAIn1eV84eZO6 m+nXM4ywCSsGaEAe97COPGHrFxJgdxKYRzCi34gLSz18kL7vM505/e6haUmnehCppKqX OF/7BNY8DKaR7RnRPLtEuw3rSZ8A8YjS5dIqQjQg53D4qmCFFDeBy33g7ySubKUPJQxJ OGog== X-Gm-Message-State: AOJu0YyWaWhYBDMOHE+pQ29qAmEKV+GhsYerf7Rrqi8UGvbmA0zjjQoy RFwEJLjtMMRDGVx8D5BO7d1h8A== X-Received: by 2002:a05:6000:10f:b0:32d:7efc:7e1f with SMTP id o15-20020a056000010f00b0032d7efc7e1fmr9028332wrx.71.1698220371961; Wed, 25 Oct 2023 00:52:51 -0700 (PDT) Received: from [192.168.1.10] (host-92-26-107-252.as13285.net. [92.26.107.252]) by smtp.gmail.com with ESMTPSA id o15-20020adfcf0f000000b00327de0173f6sm11432651wrj.115.2023.10.25.00.52.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Oct 2023 00:52:51 -0700 (PDT) Message-ID: <654468cf-1563-4c1c-8c7c-076bc6dfbabf@citrix.com> Date: Wed, 25 Oct 2023 08:52:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Andrew Cooper Subject: Re: [RESEND][PATCH 1/6] x86/bugs: Add asm helpers for executing VERW Content-Language: en-GB To: Peter Zijlstra , Pawan Gupta Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Josh Poimboeuf , Andy Lutomirski , Jonathan Corbet , Sean Christopherson , Paolo Bonzini , tony.luck@intel.com, ak@linux.intel.com, tim.c.chen@linux.intel.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, Alyssa Milburn , Daniel Sneddon , antonio.gomez.iglesias@linux.intel.com, Alyssa Milburn References: <20231020-delay-verw-v1-0-cff54096326d@linux.intel.com> <20231020-delay-verw-v1-1-cff54096326d@linux.intel.com> <20231025062818.7kaerqklaut7dg5r@desk> <20231025072255.GA37471@noisy.programming.kicks-ass.net> Autocrypt: addr=andrew.cooper3@citrix.com; keydata= xsFNBFLhNn8BEADVhE+Hb8i0GV6mihnnr/uiQQdPF8kUoFzCOPXkf7jQ5sLYeJa0cQi6Penp VtiFYznTairnVsN5J+ujSTIb+OlMSJUWV4opS7WVNnxHbFTPYZVQ3erv7NKc2iVizCRZ2Kxn srM1oPXWRic8BIAdYOKOloF2300SL/bIpeD+x7h3w9B/qez7nOin5NzkxgFoaUeIal12pXSR Q354FKFoy6Vh96gc4VRqte3jw8mPuJQpfws+Pb+swvSf/i1q1+1I4jsRQQh2m6OTADHIqg2E ofTYAEh7R5HfPx0EXoEDMdRjOeKn8+vvkAwhviWXTHlG3R1QkbE5M/oywnZ83udJmi+lxjJ5 YhQ5IzomvJ16H0Bq+TLyVLO/VRksp1VR9HxCzItLNCS8PdpYYz5TC204ViycobYU65WMpzWe LFAGn8jSS25XIpqv0Y9k87dLbctKKA14Ifw2kq5OIVu2FuX+3i446JOa2vpCI9GcjCzi3oHV e00bzYiHMIl0FICrNJU0Kjho8pdo0m2uxkn6SYEpogAy9pnatUlO+erL4LqFUO7GXSdBRbw5 gNt25XTLdSFuZtMxkY3tq8MFss5QnjhehCVPEpE6y9ZjI4XB8ad1G4oBHVGK5LMsvg22PfMJ ISWFSHoF/B5+lHkCKWkFxZ0gZn33ju5n6/FOdEx4B8cMJt+cWwARAQABzSlBbmRyZXcgQ29v cGVyIDxhbmRyZXcuY29vcGVyM0BjaXRyaXguY29tPsLBegQTAQgAJAIbAwULCQgHAwUVCgkI CwUWAgMBAAIeAQIXgAUCWKD95wIZAQAKCRBlw/kGpdefoHbdD/9AIoR3k6fKl+RFiFpyAhvO 59ttDFI7nIAnlYngev2XUR3acFElJATHSDO0ju+hqWqAb8kVijXLops0gOfqt3VPZq9cuHlh IMDquatGLzAadfFx2eQYIYT+FYuMoPZy/aTUazmJIDVxP7L383grjIkn+7tAv+qeDfE+txL4 SAm1UHNvmdfgL2/lcmL3xRh7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FjewJdT/LX1EklKDcQwpk06Af/N7VZtSfEJeRV04unbsKVXWZAk uAJyDDKN99ziC0Wz5kcPyVD1HNf8bgaqGDzrv3TfYjwqayRFcMf7xJaL9xXedMcAEQEAAcLB XwQYAQgACQUCUuE2fwIbDAAKCRBlw/kGpdefoG4XEACD1Qf/er8EA7g23HMxYWd3FXHThrVQ HgiGdk5Yh632vjOm9L4sd/GCEACVQKjsu98e8o3ysitFlznEns5EAAXEbITrgKWXDDUWGYxd pnjj2u+GkVdsOAGk0kxczX6s+VRBhpbBI2PWnOsRJgU2n10PZ3mZD4Xu9kU2IXYmuW+e5KCA vTArRUdCrAtIa1k01sPipPPw6dfxx2e5asy21YOytzxuWFfJTGnVxZZSCyLUO83sh6OZhJkk b9rxL9wPmpN/t2IPaEKoAc0FTQZS36wAMOXkBh24PQ9gaLJvfPKpNzGD8XWR5HHF0NLIJhgg 4ZlEXQ2fVp3XrtocHqhu4UZR4koCijgB8sB7Tb0GCpwK+C4UePdFLfhKyRdSXuvY3AHJd4CP 4JzW0Bzq/WXY3XMOzUTYApGQpnUpdOmuQSfpV9MQO+/jo7r6yPbxT7CwRS5dcQPzUiuHLK9i nvjREdh84qycnx0/6dDroYhp0DFv4udxuAvt1h4wGwTPRQZerSm4xaYegEFusyhbZrI0U9tJ B8WrhBLXDiYlyJT6zOV2yZFuW47VrLsjYnHwn27hmxTC/7tvG3euCklmkn9Sl9IAKFu29RSo d5bD8kMSCYsTqtTfT6W4A3qHGvIDta3ptLYpIAOD2sY3GYq2nf3Bbzx81wZK14JdDDHUX2Rs 6+ahAA== In-Reply-To: <20231025072255.GA37471@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Wed, 25 Oct 2023 00:53:09 -0700 (PDT) On 25/10/2023 8:22 am, Peter Zijlstra wrote: > On Tue, Oct 24, 2023 at 11:28:18PM -0700, Pawan Gupta wrote: > >> With .text.entry section I am getting getting below warnings and an >> error: >> >> ----------------------------------------------------------------- >> LD vmlinux.o >> vmlinux.o: warning: objtool: .text.entry+0x0: unreachable instruction >> vmlinux.o: warning: objtool: .text.entry+0x40: unreachable instruction >> vmlinux.o: warning: objtool: .text.entry+0x80: unreachable instruction >> vmlinux.o: warning: objtool: .text.entry+0xc0: unreachable instruction >> vmlinux.o: warning: objtool: .text.entry+0x100: unreachable instruction >> vmlinux.o: warning: objtool: .text.entry+0x140: unreachable instruction >> vmlinux.o: warning: objtool: .text.entry+0x180: unreachable instruction >> vmlinux.o: warning: objtool: .text.entry+0x1c0: unreachable instruction >> vmlinux.o: warning: objtool: .text.entry+0x200: unreachable instruction >> vmlinux.o: warning: objtool: .text.entry+0x240: unreachable instruction >> vmlinux.o: warning: objtool: .text.entry+0x280: unreachable instruction >> vmlinux.o: warning: objtool: .text.entry+0x2c0: unreachable instruction >> vmlinux.o: warning: objtool: .text.entry+0x300: unreachable instruction >> vmlinux.o: warning: objtool: .altinstr_replacement+0x2c: relocation to !ENDBR: .text.entry+0x0 >> vmlinux.o: warning: objtool: .altinstr_replacement+0x1c4: relocation to !ENDBR: .text.entry+0x0 >> vmlinux.o: warning: objtool: .altinstr_replacement+0x1d0: relocation to !ENDBR: .text.entry+0x0 >> vmlinux.o: warning: objtool: .altinstr_replacement+0x2d2: relocation to !ENDBR: .text.entry+0x80 >> vmlinux.o: warning: objtool: .altinstr_replacement+0x5d5: relocation to !ENDBR: .text.entry+0xc0 >> OBJCOPY modules.builtin.modinfo >> GEN modules.builtin >> MODPOST vmlinux.symvers >> UPD include/generated/utsversion.h >> CC init/version-timestamp.o >> LD .tmp_vmlinux.kallsyms1 >> ld: error: unplaced orphan section `.text.entry' from `vmlinux.o' >> make[2]: *** [scripts/Makefile.vmlinux:36: vmlinux] Error 1 >> ----------------------------------------------------------------- >> >> ... because my config has CONFIG_LD_ORPHAN_WARN_LEVEL="error" and >> objtool needs to be told about this entry. >> >> Do you think its worth fighting these warnings and error, or simply use >> .rodata section for verw memory operand? > I'm thinking you need to at the very least stay in a section that's > actually still mapped with PTI :-) Sorry.  Xen and Linux have this section named opposite ways around. > diff --git a/arch/x86/entry/entry.S b/arch/x86/entry/entry.S > index bfb7bcb362bc..9eb2b532c92a 100644 > --- a/arch/x86/entry/entry.S > +++ b/arch/x86/entry/entry.S > @@ -20,3 +22,16 @@ SYM_FUNC_END(entry_ibpb) > EXPORT_SYMBOL_GPL(entry_ibpb); > > .popsection > + > +.pushsection .entry.text, "ax" > + > +.align 64 > +SYM_CODE_START_NOALIGN(mds_verw_sel) > + UNWIND_HINT_UNDEFINED > + ANNOTATE_NOENDBR > +1: > + .word __KERNEL_DS > + .skip 64 - (. - 1b), 0xcc The 1 label aliases mds_verw_sel and this must remain like this for the construct to work. So instead of .skip, why not simply .align 64, 0xcc and get rid of the 1: label? Do we have a suitably named constant cacheline size, rather than opencoding 64? > +SYM_CODE_END(mds_verw_sel); Given that KVM needs it, this probably needs an EXPORT_SYMBOL_GPL() on it. ~Andrew