Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1220225pxy; Thu, 29 Apr 2021 02:16:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZHB1xc46ZUbac+QGUlUpCP+UDsopuo/hd1O4iNqESE+C9ZJt6S9B7Do/xIy0rEMkZxO1X X-Received: by 2002:a17:906:110a:: with SMTP id h10mr16021025eja.410.1619687804800; Thu, 29 Apr 2021 02:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619687804; cv=none; d=google.com; s=arc-20160816; b=qOtAIZ5jHWXfZzGWlESKn9tu/Yk7aBF0qBI5npcNm3lDgxo13u+kE1gKunw2kJyRLU iEWI3x14lmLbzWH6kpeNEVjlXa8ejxMnYyEKxXWImF7ncAdQgrAZkB1KY9mSNmVjgwK8 MRqKzGbzElNrirDn+3Y6CW4yI0FC3/rgry3TuYmNyxR/D+6ES57GfJaHZlFdzbikKEjb Ioa5+ZzwxM8g9sfkZ3rn1TWU+cPCp4805WVJ1gmvy3VcabkPHgvO8yliLmXPTno6gkWb yUMYDMEjx7pND9ojd27kfRW8wWPKUbyYT0BMkMRCi4uEUfkyVsnQTySM6++4OYDOyeoi LmLw== 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=7zGmhNtr9fSMXiAv9CTHWxetCafBFfr5+g4Pp2O1zPA=; b=KqZtOYg2r2/dni97DMMmnSe9jsvj8HJJ4FJZhS/HX0D6h+MWm9gkc3G6z0400cK+ei TaqaLe6fGtB8MTz19kQEicCuXnME72phsmQOPv8uJJ2qMCwahB6A9D8S5guvwdRKkH0E IyYuFVLjGSQHwMvn/wT44D3UUFGJ0ax26MWTL97H8xpjWmBngvw8V//YuWka2p9v+KVh XPTnRnof8QniqqMxRaR/PB2nzg87MWdX7JD/Dhh8KlMueoXpoZVpUQmkDU5mFldoJYQi g2woc8N6wEJo3FQP+KAgghedqG/jtKKZo5AhV11CFxJuMxsUZ1LNPHszQLnom1gBmtw9 9FIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=VJ8KU5gD; 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 l12si2603378ejn.151.2021.04.29.02.16.19; Thu, 29 Apr 2021 02:16:44 -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=VJ8KU5gD; 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 S237258AbhD2JNG (ORCPT + 99 others); Thu, 29 Apr 2021 05:13:06 -0400 Received: from mail.skyhub.de ([5.9.137.197]:42134 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232775AbhD2JNE (ORCPT ); Thu, 29 Apr 2021 05:13:04 -0400 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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