Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3689750ybt; Tue, 23 Jun 2020 08:28:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/4vBHTXPGi6VzfVgjpbl42xHBtXcqZhz2Bqf2n5OZsCIpPTW9miP0Lhn0NvTmKfR6uko/ X-Received: by 2002:a17:906:facb:: with SMTP id lu11mr15464274ejb.510.1592926083998; Tue, 23 Jun 2020 08:28:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592926083; cv=none; d=google.com; s=arc-20160816; b=mSqDZy10jqcIycTa1h1NzM/XsDrk0zGew9LXzf7X6nOGDXUNZNyPoY1TwsjqS4o6xq DdxlMfJhJxpKDQ7o0F/L3KT35L4usllJoqNsQ40Zw2ry8jeN0sZBb9g/RPByC16vJ8nH hNd008QKrqYHSuOJdbenz7T2jdW/h4mGfP17Q2nVBqfj5UuXSkrqvQP7IBp4i1X0bEeZ ft+NYp2vyVYVRFvNsL7yZ87Ml9cc5/Gc7JqxiZw+0hfU1sEP1XL2gOPcj6hIDyydP6bJ c5f8tlkKufGhfyizTY/q1osgjQuOAVOQQR+uySzWBpL14r6nOk/NpNDr4yuqoqEgCDc9 M3gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=67GmQHoj5zNuUwz09OSjiIC4O8VKYFdYpYZwr4wExTc=; b=fmYLwqizqqbOcLtTL4p5ojYj7j1IuQNj53ERYe3vnyvVYmf+ZKbluImlCldOHsvjer KT2FLe5iOjFwfXisS5zH/3e1Gaj2gPvmrB5LP7vFCBEsEr1SUjBGvudFWL+bpcu0F6VZ WqBgp20I+TlSwsnKpG6Fi8TsySSCL50FDGCWoqmq8unSak2Ha79G9KijScF9tLjJWRDk ODVx9J8YluDZl6JUwLJlinZDw10N/3u6HOrj8iyBK85/F5bVtLFdSpMPhJlpkf8jrKto ivy63F3zNBsZT1iQOLSrjDrNhrPwvh8E7FEIhUKJ7OqCcwkJ3DHSAPdDzf9xiM3EY1oc SY6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=HKSxQszn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h21si5042253ejb.246.2020.06.23.08.27.41; Tue, 23 Jun 2020 08:28:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=HKSxQszn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732974AbgFWPXy (ORCPT + 99 others); Tue, 23 Jun 2020 11:23:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732781AbgFWPXy (ORCPT ); Tue, 23 Jun 2020 11:23:54 -0400 Received: from merlin.infradead.org (unknown [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA48AC061573; Tue, 23 Jun 2020 08:23:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=67GmQHoj5zNuUwz09OSjiIC4O8VKYFdYpYZwr4wExTc=; b=HKSxQszno971bP/TsveUX1OfYN w+iddIX3Sb92BzDuh9mM+TMd424oct3epZCyddn8xYMXBq2wYT92dhpKJLqXjKVgS3b3qyGyC7HE1 jdNWFF+LsxwRamTTgoCMYmptuxP9dIkgdc/piRBGfC0z2EXgQMlfYqjVz6SF9uCFAa+PNY0Q7pUpD y8qIHKn8jwZGsl/4ZFkT95KFdxCd8HuPbP+IODLDl0y6amInT0EYw1+XAoCGUScP3zwAF8GJHOsTG H4vzhX9bOmnERkNENcGq2LrO6Sv/s7921BB80kd93Wfg931RZpLLOKf5q/hf20joXKq/9UM9Q4ebC 2UsjCpJg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnklk-00037n-BU; Tue, 23 Jun 2020 15:23:28 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id AC38A303DA0; Tue, 23 Jun 2020 17:23:26 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9AB3C234EBA53; Tue, 23 Jun 2020 17:23:26 +0200 (CEST) Date: Tue, 23 Jun 2020 17:23:26 +0200 From: Peter Zijlstra To: Joerg Roedel Cc: Andy Lutomirski , Joerg Roedel , Dave Hansen , Tom Lendacky , Mike Stunes , Dan Williams , Dave Hansen , "H. Peter Anvin" , Juergen Gross , Jiri Slaby , Kees Cook , kvm list , LKML , Thomas Hellstrom , Linux Virtualization , X86 ML , Sean Christopherson , Andrew Cooper Subject: Re: Should SEV-ES #VC use IST? (Re: [PATCH] Allow RDTSC and RDTSCP from userspace) Message-ID: <20200623152326.GL4817@hirez.programming.kicks-ass.net> References: <20200428075512.GP30814@suse.de> <20200623110706.GB4817@hirez.programming.kicks-ass.net> <20200623113007.GH31822@suse.de> <20200623114818.GD4817@hirez.programming.kicks-ass.net> <20200623120433.GB14101@suse.de> <20200623125201.GG4817@hirez.programming.kicks-ass.net> <20200623134003.GD14101@suse.de> <20200623135916.GI4817@hirez.programming.kicks-ass.net> <20200623145344.GA117543@hirez.programming.kicks-ass.net> <20200623145914.GF14101@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200623145914.GF14101@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 23, 2020 at 04:59:14PM +0200, Joerg Roedel wrote: > On Tue, Jun 23, 2020 at 04:53:44PM +0200, Peter Zijlstra wrote: > > +noinstr void idtentry_validate_ist(struct pt_regs *regs) > > +{ > > + if ((regs->sp & ~(EXCEPTION_STKSZ-1)) == > > + (_RET_IP_ & ~(EXCEPTION_STKSZ-1))) > > + die("IST stack recursion", regs, 0); > > +} > > Yes, this is a start, it doesn't cover the case where the NMI stack is > in-between, so I think you need to walk down regs->sp too. That shouldn't be possible with the current code, I think. > The dumpstack code already has some logic for this. Reliability of that depends on the unwinder, I wouldn't want the guess uwinder to OOPS me by accident.