Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp1085590lqp; Thu, 23 May 2024 08:34:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwysJ0yH6TyDhZHDkSbRsnjJzk+Bd2O6nYHVRUi/5bh9yRfrxN0w6Q5+P0p4QShpAraAzcwZnIReouqKGScG0izxvWP2+NXFPclqBLgQ== X-Google-Smtp-Source: AGHT+IEWoGLfQJLbohm+fkJHpScF81BM0Wf5Ud4PBI1+31U6JBi8DHDEFqDjX9fybehpu3R7m1tO X-Received: by 2002:a17:90a:5886:b0:2bd:92d9:65f3 with SMTP id 98e67ed59e1d1-2bd9f5a1723mr6772611a91.33.1716478465859; Thu, 23 May 2024 08:34:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716478465; cv=pass; d=google.com; s=arc-20160816; b=Cj+dRm9cGYMrJrfN3t5JaXuuVWHh+Wy9uapgTLfyZgU/3P0guzxtZ9mmns08nJ+hi7 7JBpWWSMMQHkxRKOV2G0jEklcZ1RFGnQ8dWhOp/803GspVIq2HaD3JKpBa/cKiidT3Pw L7tdFdRLu3cflp4rU983nH/15UWQdMVQXQtqPItAk95Roq6c92fbMcHFGQYUsvVCrynC b7mj4PMPXvhMFEngtLMSXJw6ivrkQ9cy1R+MtXm6ziRC/Cfz+QUlHttkpCyP8QKoBMQY 35nKEq1WTdLZowJLctPVposCMfKcqeZ4xBtcoSUX53jiUMG9e+HI5Rs8MeKYIEXE/hXW MLdQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=OMal/ed/lGH3bPNe6acjKpomMrRdM5MAjqoN2jZ1j04=; fh=BjkGM9B74MY0tS4qx7DaaSDdJRVpqtyvYeN3Qi30i8U=; b=igTbAH5zhvbex4LgZsswkGzR4hMuYvjVgmMlmqgRRLFCxjxhqtIG9jPd/2VgwI5jm3 OUuujIHoKndOLJBgNYYt3e8DSYQwiz92JJ0tvWQh85YRWKEKrcvC9Xf3v5x6hgrdcngj 7h7PZL9rnhel2bNC0k8/+EvIF57RDo/xvNKrCu1VnhUbp3F/nzOb0tqGH3PNfqdqRWaF rXQ00iExXenWeYnYURrvsDohuwYh/hqox84P8mnhVh+LwTK0MllOcgaU+SRmJcfumshe SvP3YcGI0KKwumjoIL2leUvgevi3picVE7N+6y63umVZyvxBzLRcg7JOwEEO3rKB9tUa 19PQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@citrix.com header.s=google header.b="oC/stCBm"; arc=pass (i=1 spf=pass spfdomain=cloud.com dkim=pass dkdomain=citrix.com dmarc=pass fromdomain=citrix.com); spf=pass (google.com: domain of linux-kernel+bounces-187719-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187719-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=citrix.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bdda14e4c2si1773642a91.149.2024.05.23.08.34.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 08:34:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187719-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@citrix.com header.s=google header.b="oC/stCBm"; arc=pass (i=1 spf=pass spfdomain=cloud.com dkim=pass dkdomain=citrix.com dmarc=pass fromdomain=citrix.com); spf=pass (google.com: domain of linux-kernel+bounces-187719-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187719-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=citrix.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7B917281D5B for ; Thu, 23 May 2024 15:34:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C229E12B72; Thu, 23 May 2024 15:34:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="oC/stCBm" Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.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 3AC3511711 for ; Thu, 23 May 2024 15:34:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716478454; cv=none; b=k6Kw3C8eR3nQrhqKLnZAK7B/UhR6p96kagL1U3dLPiIhKTJ30+WBR98xUB0yLe1HuaOHQeTyQlfz6R7SR8Ni+8idyQe6G1+pTgH5OJoaeDFVQoGHb7/oL5bKRM8p+k6atFbJR1uCVEV8t5f4iBA0qHtipoRnxkJCy6LpjDW2Kzg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716478454; c=relaxed/simple; bh=OMal/ed/lGH3bPNe6acjKpomMrRdM5MAjqoN2jZ1j04=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hpakc7HdXheRLmFIeaL7BihMPgZBXF4klUaMitfbLk4fzIkIJ7U0WNfTboGiB/hO0ciK6H0ZKLdks2jaWuiJVjAef6LRU7BVKqu6ufeShmEieWH/kqsqg6GZYLSveGr+pr6Xuzdk5Ey/tGIFIZlgPik7qc2kh7l7CZ8zAGiIfMI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=citrix.com; spf=pass smtp.mailfrom=cloud.com; dkim=pass (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b=oC/stCBm; arc=none smtp.client-ip=209.85.218.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=citrix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cloud.com Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a59b49162aeso1116073266b.3 for ; Thu, 23 May 2024 08:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1716478451; x=1717083251; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=OMal/ed/lGH3bPNe6acjKpomMrRdM5MAjqoN2jZ1j04=; b=oC/stCBmvA7lx8xr8E+VOt6Mgw2D4aTRqpoQk3I+Ki2j+RTQczlfsNz4ttTXBZyQbB j1ybV6bJknPlFJiJjOtL6aGdwKZk8QuZT6I6lvsaMnQl3Wimtjojgq5g6KoIKyP/4COT r+UVL9EiW6k/k8bZR4+qg4FQ20/G/mrWHbVl0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716478451; x=1717083251; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=OMal/ed/lGH3bPNe6acjKpomMrRdM5MAjqoN2jZ1j04=; b=LQ9dLqoy9h7JdlboFl/lGIfgV8zfekaIkI6Gxfvq9+7tJWASR5ZMdarso7BSHMdG3x lpMi2g+o6iQqheD0kD3EF5g/yZwMp5zq/Jd3q5guhi4fYEOXCpEk8zoGwSGbtfKUGul8 1baqCxNpZXetnGT0MCxLcAr4AZ2289ej7aVm2ndN2nqyD0j5hyMtGIln7Tr/nE0oobPa 1TDNJR8F14CRNvgHGkly6aydU7I3Bam8R9HPSoCSoAjGcHMxZYho//PxcnzzK75jVt3Q 3m4NfQrqYE1Od2eWre7V6fYiZelCj9RMIXAr66k92J4omXnX5e+ldr0wPDSWXTWUP8XC EK7A== X-Gm-Message-State: AOJu0YxbbfRaY+0aV3c6rI8AeL2cNEryKdm4z/tmaIobwv2v/Lb3IpCu CfzxQX4q/odQz+gxe+D0dA7haUpfuo2llhRzUsRvKSQWO34W/pH8FAOVQdkz844= X-Received: by 2002:a17:906:231a:b0:a62:2cef:95e6 with SMTP id a640c23a62f3a-a622cef97b9mr332133266b.14.1716478451515; Thu, 23 May 2024 08:34:11 -0700 (PDT) Received: from [10.125.231.30] ([217.156.233.157]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5df00490cfsm794685866b.159.2024.05.23.08.34.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 May 2024 08:34:11 -0700 (PDT) Message-ID: Date: Thu, 23 May 2024 16:34:10 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] x86/bhi: BHI mitigation can trigger warning in #DB handler To: Alexandre Chartre , Dave Hansen , x86@kernel.org, kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, daniel.sneddon@linux.intel.com, pawan.kumar.gupta@linux.intel.com, tglx@linutronix.de, konrad.wilk@oracle.com, peterz@infradead.org, gregkh@linuxfoundation.org, seanjc@google.com, dave.hansen@linux.intel.com, nik.borisov@suse.com, kpsingh@kernel.org, longman@redhat.com, bp@alien8.de, pbonzini@redhat.com References: <20240523123322.3326690-1-alexandre.chartre@oracle.com> <1c69f62e-0dee-4caa-9cbe-f43d8efd597b@oracle.com> Content-Language: en-GB From: Andrew Cooper 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+hqWqAb8kVijX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gvefAIFfHBg7fTY/i kBEimoUsTEQz+N4hbKwo1hULfVxDJStE4sbPhjbsPCrlXf6W9CxSyQ0qmZ2bXsLQYRj2xqd1 bpA+1o1j2N4/au1R/uSiUFjewJdT/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: <1c69f62e-0dee-4caa-9cbe-f43d8efd597b@oracle.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 23/05/2024 3:52 pm, Alexandre Chartre wrote: > > On 5/23/24 16:28, Dave Hansen wrote: >> On 5/23/24 05:33, Alexandre Chartre wrote: >>> The problem can be reproduced with the following sequence: >>> >>>   $ cat sysenter_step.c >>>   int main() >>>   { asm("pushf; pop %ax; bts $8,%ax; push %ax; popf; sysenter"); } >>> >>>   $ gcc -o sysenter_step sysenter_step.c >>> >>>   $ ./sysenter_step >>>   Segmentation fault (core dumped) >>> >>> The program is expected to crash, and the #DB handler will issue a >>> warning. >> >> Should we wrap up this gem and put it with the other entry selftests? > > It looks like tools/testing/selftests/x86/single_step_syscall.c tests > sysenter with TF set but it doesn't check if the kernel issues any > warning. But shouldn't the SIGSEGV still cause the selftest to notice? Also, there should be a selftest for NT.  (mis)handling of that will take the entire kernel down. AC for good measure too, as that's the other flag handled specially. ~Andrew