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 X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFD72C433B4 for ; Thu, 29 Apr 2021 09:12:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7C178613C1 for ; Thu, 29 Apr 2021 09:12:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C178613C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D33186B006C; Thu, 29 Apr 2021 05:12:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CCFAB6B006E; Thu, 29 Apr 2021 05:12:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B4AB96B0070; Thu, 29 Apr 2021 05:12:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0211.hostedemail.com [216.40.44.211]) by kanga.kvack.org (Postfix) with ESMTP id 9B3116B006C for ; Thu, 29 Apr 2021 05:12:26 -0400 (EDT) Received: from smtpin32.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 57EBE181AF5E1 for ; Thu, 29 Apr 2021 09:12:26 +0000 (UTC) X-FDA: 78084838692.32.347A014 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf22.hostedemail.com (Postfix) with ESMTP id 4045FC0001FA for ; Thu, 29 Apr 2021 09:12:11 +0000 (UTC) Received: from zn.tnic (p200300ec2f0a4f00fa8ecda271c3a3d7.dip0.t-ipconnect.de [IPv6:2003:ec:2f0a:4f00:fa8e:cda2:71c3:a3d7]) (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 1DC2B1EC0288; Thu, 29 Apr 2021 11:12:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1619687536; 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=7zGmhNtr9fSMXiAv9CTHWxetCafBFfr5+g4Pp2O1zPA=; b=VJ8KU5gDLEDcc86e/EfzBa0Fu1gTt/agw1fFBUNcKkgElWJVHz5ezJ1+abvUNWA/+YPW+c hhXKF5mKvOhNpbhEILpk4RsYp4zZM9GJdcTDDXSIzZSnW5O74QppV0bnYsVdEpAKdndzIb /RedeShYZzUdYUN0WSeW2H8EvvtriFM= Date: Thu, 29 Apr 2021 11:12:19 +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" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang , Pengfei Xu , Haitao Huang Subject: Re: [PATCH v26 22/30] x86/cet/shstk: Add user-mode shadow stack support Message-ID: References: <20210427204315.24153-1-yu-cheng.yu@intel.com> <20210427204315.24153-23-yu-cheng.yu@intel.com> <3a0ed2e3-b13d-0db6-87af-fecd394ddd2e@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <3a0ed2e3-b13d-0db6-87af-fecd394ddd2e@intel.com> X-Rspamd-Queue-Id: 4045FC0001FA X-Stat-Signature: thuwjw5oztmd6wmzcbi7ps1x93ycfm67 X-Rspamd-Server: rspam02 Received-SPF: none (alien8.de>: No applicable sender policy available) receiver=imf22; identity=mailfrom; envelope-from=""; helo=mail.skyhub.de; client-ip=5.9.137.197 X-HE-DKIM-Result: invalid/invalid (public key: DNS error: SERVFAIL) X-HE-Tag: 1619687531-235935 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Apr 28, 2021 at 11:39:00AM -0700, Yu, Yu-cheng wrote: > Sorry about that. After that email thread, we went ahead to separate shadow > stack and ibt into different files. I thought about the struct, the file > names cet.h, etc. The struct still needs to include ibt status, and if it > is shstk_desc, the name is not entirely true. One possible approach is, we > don't make it a struct here, and put every item directly in thread_struct. > However, the benefit of putting all in a struct is understandable (you might > argue the opposite :-)). Please make the call, and I will do the change. /me looks forward into the patchset... So this looks like the final version of it: @@ -15,6 +15,7 @@ struct cet_status { unsigned long shstk_base; unsigned long shstk_size; unsigned int locked:1; + unsigned int ibt_enabled:1; }; If so, that thing should be simply: struct cet { unsigned long shstk_base; unsigned long shstk_size; unsigned int shstk_lock : 1, ibt : 1; } Is that ibt flag per thread or why is it here? I guess I'll find out. /me greps... ah yes, it is. > Yes, the comments are in patch #23: Handle thread shadow stack. I wanted to > add that in the patch that takes the path. That comes next, I'll look there. > > vm_munmap() can return other negative error values, where are you > > handling those? > > > > For other error values, the loop stops. And then what happens? > > > + cet->shstk_base = 0; > > > + cet->shstk_size = 0; You clear those here without even checking whether unmap failed somehow. And then stuff leaks but we don't care, right? Someone else's problem, I'm sure. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette