Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2366465rda; Tue, 24 Oct 2023 23:57:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEPP6hx4EhI4tkqsBbUIAVDlyHUsvQZ4RffbCrUC7HA0KgSRWdUvctVEF3dbD8EJPBU5Evt X-Received: by 2002:a05:6122:1829:b0:495:bf5b:7e49 with SMTP id ay41-20020a056122182900b00495bf5b7e49mr10438593vkb.13.1698217025177; Tue, 24 Oct 2023 23:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698217025; cv=none; d=google.com; s=arc-20160816; b=axj5l9OV3vKMHLPPdKXzIybsGhLSjES24b7EAqrcJaxMqShcu/suxhLQQ/elZojPTL 5FLTMl3E3xcVfktt/t5eayNzgTlNrge1KgaI+CYdlBUHOmUHLfd3x6MVrT3v7+EcqHjD jocwPZIJr88v+fXf49iQShOrFer/78vLEluKPoV85Z+J96DLQ7mQb3szCi62ESnHNy8P VCfTeDYpC9x7UBD8dJxnPnxRMzrazFtve54Cnh+ypyK0ZyLu3BFUW9B9uqCSBK44yl6i Rzm3xrbxJ0GzuHvM5Ucf4u8LqG1+osIq2wRr2wFcYqwf73paj/RZca8V0EdP0YvPuQoM nWnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XACVKlQsgeevIRCx4krJ3Cs67Y3XIWvenl6gIVkrFAA=; fh=FtUvlj3N+mHXQqmPX59TJy8Xsw0SZcoZZJJFTd27Pr0=; b=wg89G04qSMnxfz3EZa5sjvWCOtHJnOES5xFKI6bY5o29lzcRS4VYkppksG1DBLL0Fk DPhVrkH72uBhrPMzxAt5sB5DctZq9NKZi7e3nsmaG6dRRNdPlmpRoEFpv4Zx09/S3S/G iGRCW1FDBAMy0uMnlw8g4KsW0e13Y6e+R0C4+ahJ3KEjE0h3cXUurUaPUyppqLN1fbTL EZkPn4CtTk3ffwjiXCpEHMClwkT9QX0azzgo9vbq84XPgXCiGGHqM+vRMvJ4gn3i324c Vwv8aRBlS42L+wzSSiIw4aV6QvAB6fJU4YEMxml2U/SCfbbwlw6jvLtpEbOv+n7jNC5w bZsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Dl0ig3Z3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id r18-20020a81c312000000b005a210c45124si9824588ywk.530.2023.10.24.23.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 23:57:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Dl0ig3Z3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 3CFA2801B81A; Tue, 24 Oct 2023 23:57:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232180AbjJYG4v (ORCPT + 99 others); Wed, 25 Oct 2023 02:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjJYG4t (ORCPT ); Wed, 25 Oct 2023 02:56:49 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59598A6; Tue, 24 Oct 2023 23:56:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XACVKlQsgeevIRCx4krJ3Cs67Y3XIWvenl6gIVkrFAA=; b=Dl0ig3Z3i4kQ3aDi44pJMQ9FKl PCrkZd6wuLQSa17a34c/FzdT9XHqUgCSzaRtk1bGKuEh133gYfFWBeDy6miBnVRoYyrFxWa1Lb3MI rFl+zBLgTpfKfxxxs9I2N+GR0ZQ/aw7viJvLa5iE3nCLwJjGHr3GGs7gxIOJZgFxAft++PHPIMv+k OlUtvvyu97Ok3V8htIMXtHLoCc65AR/jcJqhRlov7BDaMLZZuRxKsfxpjIqCdCXE9eyiq5IBst6Lj pyhehYOt7PZxYk2sA6RLJ51O/ooeChtfDvo1XSERaiSbaqwJehBYCxczRr/O1ru2tzJYUbyI3ip87 omGYtmwQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qvXoJ-007H0F-3E; Wed, 25 Oct 2023 06:56:11 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 601FA30047C; Wed, 25 Oct 2023 08:56:10 +0200 (CEST) Date: Wed, 25 Oct 2023 08:56:10 +0200 From: Peter Zijlstra To: 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 Subject: Re: [PATCH v2 1/6] x86/bugs: Add asm helpers for executing VERW Message-ID: <20231025065610.GA31201@noisy.programming.kicks-ass.net> References: <20231024-delay-verw-v2-0-f1881340c807@linux.intel.com> <20231024-delay-verw-v2-1-f1881340c807@linux.intel.com> <20231024103601.GH31411@noisy.programming.kicks-ass.net> <20231025040029.uglv4dwmlnfhcjde@desk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231025040029.uglv4dwmlnfhcjde@desk> X-Spam-Status: No, score=-0.8 required=5.0 tests=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 fry.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 (fry.vger.email [0.0.0.0]); Tue, 24 Oct 2023 23:57:02 -0700 (PDT) On Tue, Oct 24, 2023 at 09:00:29PM -0700, Pawan Gupta wrote: > config1: mitigations=on, 32-bit mode, post-boot > > entry_SYSENTER_32: > ... > 0xc1a3748e <+222>: pop %eax > 0xc1a3748f <+223>: verw 0xc1a38240 > 0xc1a37496 <+230>: sti > 0xc1a37497 <+231>: sysexit > > --------------------------------------------- > > config2: mitigations=off, 32-bit mode, post-boot > > entry_SYSENTER_32: > ... > 0xc1a3748e <+222>: pop %eax > 0xc1a3748f <+223>: lea 0x0(%esi,%eiz,1),%esi <---- Doesn't look right > 0xc1a37496 <+230>: sti > 0xc1a37497 <+231>: sysexit > > --------------------------------------------- > > config3: 32-bit mode, pre-boot objdump > > entry_SYSENTER_32: > ... > c8e: 58 pop %eax > c8f: 90 nop > c90: 90 nop > c91: 90 nop > c92: 90 nop > c93: 90 nop > c94: 90 nop > c95: 90 nop > c96: fb sti > c97: 0f 35 sysexit > If you look at arch/x86/include/asm/nops.h, you'll find (for 32bit): * 7: leal 0x0(%esi,%eiz,1),%esi Which reads as: load-effective-address of %esi[0] into %esi which is, of course, just %esi. You can also get this from GAS using: .nops 7 which results in: 0: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi It is basically abusing bizarro x86 instruction encoding rules to create a 7 byte nop without using NOPL. If you really want to know, volume 2 of the SDM has a ton of stuff on instruction encoding, also the interweb :-)