Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1564841pxb; Fri, 27 Aug 2021 11:48:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvPY3RXJ4Jrn3iH3a9wOGPVYkGAaJyhIZxeMh63Ae0hDUOYuAs4Us//sXIlsiktQReuTBN X-Received: by 2002:aa7:cd9a:: with SMTP id x26mr10847946edv.384.1630090118808; Fri, 27 Aug 2021 11:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630090118; cv=none; d=google.com; s=arc-20160816; b=Dw5R707GSp4kq5I/FCOMjv4Y81HWJa1TfYqKsXL+qvtvYGEggLtzak6WYJflqbLkzp Qdus7eYkoXtu1teXlVLhu5lxNIQigAL901fpLG2sHaX/4Xy+8GJYAkdpHFyyqdHh1fCg aov4KVEeNFgSJHMIawc8/gHZ+JNAV3/koLDoUsc+gRKs2ryxietF4i1F/evuBZm52X79 DsCfodDv9ABPxzOrxrRvJdn7ypofkGcI0zoUcfFuU2CAdScaIpjClTwNKlg++F2CqTGi 1hzD6wgCBi55n5v8h0OutNGQDBSEycrTuumM+jt057rSnK+ofX4I6Ygz8ov7dQ1knxdH D5bQ== 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=y0FEGpbT1o/usEWCQaIVd7WpX4gpA+I5TcpFa2iPS/c=; b=Ny097s/NFRbMrMIYdKcPN7AZdMJlvAAErmbng15Fi9//Rl5I+kPzu5twszB2sIDiIu UR54OujAdsU2wU73lUx7X/sXaqOeKnJQZ/rZpVjuYB9R8CSPoQkOt9nh3+uO0ZzENPEh 2TlUKqzWFjp/Cs+0hYfENCcX1/Wku9ElNLWwCohG3SpUY2zxT1B+MGEejUVEjR3f3iJo b2FbREnRF+y8lunGy6QWD5jDGquthMLlAUHpUMffFc3kIleUDPnuZh1ArE+CDO9SBR46 tAv/I5V7P657hdWIduOVsEQ9zErqyilOTUxQkIS4IuriXGmvYMQSPtShEtCmdzB9H76j Jw4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=SHMA6G9A; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jy4si6631528ejc.149.2021.08.27.11.48.05; Fri, 27 Aug 2021 11:48:38 -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=pass header.i=@alien8.de header.s=dkim header.b=SHMA6G9A; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230231AbhH0Sqs (ORCPT + 99 others); Fri, 27 Aug 2021 14:46:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229882AbhH0Sqs (ORCPT ); Fri, 27 Aug 2021 14:46:48 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA57DC061757; Fri, 27 Aug 2021 11:45:58 -0700 (PDT) Received: from zn.tnic (p200300ec2f111700cf40790d4c46ba75.dip0.t-ipconnect.de [IPv6:2003:ec:2f11:1700:cf40:790d:4c46:ba75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 645881EC0464; Fri, 27 Aug 2021 20:45:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1630089953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=y0FEGpbT1o/usEWCQaIVd7WpX4gpA+I5TcpFa2iPS/c=; b=SHMA6G9AjxgkvlDD605FGB3xhf0BjvRxxmOo92lMF2ekx955Tjyy8uY4UbXlI7oyLe209g +JYuyJ2G360w9la3Fo0zaixmBftxHU0YDrMyaPumDFptRiuMFfbh/CP3tYATF87eJSLSql PtdHSUjwg7HnCzJzHi1aVTBWqnFKAak= Date: Fri, 27 Aug 2021 20:46:35 +0200 From: Borislav Petkov To: "Yu, Yu-cheng" Cc: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Dave Martin , Weijiang Yang , Pengfei Xu , Haitao Huang , Rick P Edgecombe Subject: Re: [PATCH v29 23/32] x86/cet/shstk: Add user-mode shadow stack support Message-ID: References: <20210820181201.31490-1-yu-cheng.yu@intel.com> <20210820181201.31490-24-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 27, 2021 at 11:37:34AM -0700, Yu, Yu-cheng wrote: > Right now, the kernel does lazy restore, and it waits until right before a > task goes back to ring-3 to restore xstates. If a task needs to write to > any xstate registers before that (e.g. for signals), it restores the whole > xstates first and clears TIF_NEED_FPU_LOAD, which will prevent xstates being > restored again later. shstk_setup() allocates a shadow stack for the task and puts its pointer in MSR_IA32_PL3_SSP. What does that have to do with a task having to write any xstate registers? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette