From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39B86C7EE23 for ; Mon, 5 Jun 2023 16:43:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234330AbjFEQnV (ORCPT ); Mon, 5 Jun 2023 12:43:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbjFEQnS (ORCPT ); Mon, 5 Jun 2023 12:43:18 -0400 Received: from mail.zytor.com (unknown [IPv6:2607:7c80:54:3::138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A5E7D2; Mon, 5 Jun 2023 09:43:17 -0700 (PDT) Received: from [172.27.2.41] ([73.231.166.163]) (authenticated bits=0) by mail.zytor.com (8.17.1/8.17.1) with ESMTPSA id 355Ggqvm3940741 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Mon, 5 Jun 2023 09:42:55 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 355Ggqvm3940741 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2023051001; t=1685983377; bh=vxwO4zTIIQjIbXiESfkziLRdzKTF7nhAu+p7o+NRnsI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ExPxXyjIskC8ieS8pFtaW4kay+9WnSME+UjXGYltsRAZD1JvyH169FGM9Pz1hZ5zb cmnukhA7fy17jASbgXYnw16u0jUIsXE2o/Ig52J1f/0oHi3PwMz0zSqDpIrk0p5F+M OhXvMgMJw7m8NzLBS0fidwnlpe2NTVuZiCkwpMTmOzBhCpXPkiHlCAaWTuCdx9bVvb wgo/NUa4TfYwmc4db+EcYG1rxvYd1lJsdJErmcDeppYExo0GSba6dON3vQLjB1lW1P 0hfuc+u/r+ABzTTrOPekPn6K8ZwcsrQZOE8uGpglFuis4BR61cT6bJGnxKuVe8/fV/ sXFnrYFmLdqjg== Message-ID: Date: Mon, 5 Jun 2023 09:42:52 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v8 31/33] x86/fred: BUG() when ERETU with %rsp not equal to that when the ring 3 event was just delivered Content-Language: en-US To: Thomas Gleixner , Xin Li , linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org Cc: mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, peterz@infradead.org, andrew.cooper3@citrix.com, seanjc@google.com, pbonzini@redhat.com, ravi.v.shankar@intel.com, jiangshanlai@gmail.com, shan.kang@intel.com References: <20230410081438.1750-1-xin3.li@intel.com> <20230410081438.1750-32-xin3.li@intel.com> <87ttvm572h.ffs@tglx> From: "H. Peter Anvin" In-Reply-To: <87ttvm572h.ffs@tglx> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/5/23 07:15, Thomas Gleixner wrote: > On Mon, Apr 10 2023 at 01:14, Xin Li wrote: >> A FRED stack frame generated by a ring 3 event should never be messed up, and >> the first thing we must make sure is that at the time an ERETU instruction is >> executed, %rsp must have the same address as that when the user level event >> was just delivered. >> >> However we don't want to bother the normal code path of ERETU because it's on >> the hotest code path, a good choice is to do this check when ERETU >> faults. > > Which might be not catching bugs where the wrong frame makes ERETU not > fault. > > We have CONFIG_DEBUG_ENTRY for catching this at the proper place. > This is true, but this BUG() is a cheap test on a slow path, and thus can be included in production code. -hpa