Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3669071ybt; Tue, 23 Jun 2020 08:01:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9emTgaeTlKJEEXUaAJscVDya86/qpObKnWGnSuXpkiY/b8TU4LThezyLvxIkd4qKi2z9l X-Received: by 2002:a05:6402:170d:: with SMTP id y13mr21588777edu.319.1592924518367; Tue, 23 Jun 2020 08:01:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592924518; cv=none; d=google.com; s=arc-20160816; b=tEB8u0DqDfAr8gkJigNy6rV71o7ccoQ4nUPPpr5GpOPHX2G1js7pQr9zQSSf53zFJL hdmAVH4v3x/KhdUIOuki7jUQoiRa5my7OcjthECfNs+l4JIHEMUqXa8eeXhRSnVElRkL dXdya3coBSkI+smh9nSoYUsBH/0R8MsbpuKIOJGYVCpzF4soTdqcvcV0ZlPoEoDYDo4/ gez0z9dPEYx9l7d2QyFzAGqK7VU1LKswzJX1MHsjjI5xF6wtLAWZx6M212mNP9cuI48K ofdbh979UfqEII0lIvaIHabBYP+iZltCMyKJYq+bEOcacOKHmHfNCTpgKhPyfyRuuJ38 bSDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=C7ZyZa3SkJH461JzsyBSaqglthJfI7dirTF0yu1NA2U=; b=vn1MLSYMZRWePFOF3iwSis4Xuz6XnvfKxEN6f4fdm1wdAINcbVeiblNi4SMEIM/uYN Hv0U5gWxuuEZaIEb/6l73Kg/MA9lMr4Oh1s8waXc/jZn7gHowfJyaj6Uavu17fbvVn2p LfB3bU3nNpDkkH3pCSLNXHr/SNrQ/P7SiRRI0acr4byeu2mdD+U24KEJowce06+VvWSe WzyLZfS0ptFotIedItfwpoIsH+IGpBIr6XN8dVHn6jcg8G3SxWRqv9DoCahz65+Ih8u5 H8ya0b3G9cqOS2LK5gcbLizqFPh4f24ncjWrgc2gghOf8SmFYe7uTRVKacaUmZewO3eV kqnQ== ARC-Authentication-Results: i=1; mx.google.com; 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 k4si10636929ejg.386.2020.06.23.08.01.33; Tue, 23 Jun 2020 08:01:58 -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; 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 S1732953AbgFWO7T (ORCPT + 99 others); Tue, 23 Jun 2020 10:59:19 -0400 Received: from mx2.suse.de ([195.135.220.15]:44396 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732738AbgFWO7S (ORCPT ); Tue, 23 Jun 2020 10:59:18 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 5C1D4ADC9; Tue, 23 Jun 2020 14:59:16 +0000 (UTC) Date: Tue, 23 Jun 2020 16:59:14 +0200 From: Joerg Roedel To: Peter Zijlstra 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: <20200623145914.GF14101@suse.de> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200623145344.GA117543@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) 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: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. The dumpstack code already has some logic for this. Joerg