Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3747957rwb; Mon, 3 Oct 2022 21:39:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Zq+uXWzum46zvuHDTcMiSCP4TQe4Q9KtaW0qQbIBnMIOU7/UO5XwYDmcXLzWjN9Eg6OSP X-Received: by 2002:a17:907:86ab:b0:781:f150:84e4 with SMTP id qa43-20020a17090786ab00b00781f15084e4mr17271012ejc.435.1664858363980; Mon, 03 Oct 2022 21:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664858363; cv=none; d=google.com; s=arc-20160816; b=cMoBi3qrAhVsDcFoiT4DSszM0qI5voVT09JcyEXHWcX8yyxr55OYvn3EAIimwjwxbo G+ey/d0K31f2jbZJCsyNf6Pqiupob7cLFBIkIEb+QTPXEIsE2JDjvW7I+tYWxcWyjCxv vDkOMgu+5HHnkzAhXOgpjvbs0X1mTTNBe+9XEgtRPAkthMua8vFQEkZ8SbtuKf2Rhj9J V9dnJfbJslT3GZyjOeijLGoZ/vfa9KMldME4wi6FZv3HGwBWj260AGPZCl2zXxGLA2Hi r7PlvEiI+mRTY8wYhT5v+JSReY50HJloGn0GK+NGAVki7xU/DGc1MonYVxBerUFe1z8s Q8zQ== 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=ySm4+MtMrElwdIGDssthem6q+35qWgtrM6IZsGhsUBM=; b=XWk0WPq+9V+bXNqxsfyhZn3FnhDb64HXaX1yV6wz18LheHla63InRzKK6mvRmucWcA UDnMLqfDBgTY2WJ2hjmSDdBvAZ4BYZGVauKfLXyMBGaz7YwIlVdrPY5VA9ECYjcWRzgA vI0JXuE1nLNn1hzcXSklZ1t6BIlPhoWd7nhAoU1dYM6SbYpSsSpN5PQW4ozccA/3fKE0 2clPlSxHnOV98Jh62QzQ0DWVHbHnUO6IHrpUx1hVbEqC5XnNuJhd4Rdv/EWq5cmdX5gu 4TDqmwZcvI0eVb8yuA1m2Gj0otAcuaZCwisAWjBf75cPFNYbVLxgE22KtWqg8PXTcUwh Sm+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=b8d7DfhJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb12-20020a1709077e8c00b007707c67f523si11000328ejc.335.2022.10.03.21.38.58; Mon, 03 Oct 2022 21:39:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=b8d7DfhJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229515AbiJDESX (ORCPT + 99 others); Tue, 4 Oct 2022 00:18:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbiJDEST (ORCPT ); Tue, 4 Oct 2022 00:18:19 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 504752A735 for ; Mon, 3 Oct 2022 21:18:15 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id gf8so9297275pjb.5 for ; Mon, 03 Oct 2022 21:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=ySm4+MtMrElwdIGDssthem6q+35qWgtrM6IZsGhsUBM=; b=b8d7DfhJyod6G/akuEzQS5pK6i7A5VM3gtwDRfd1NbVowaiMxRdZNvCHHaHlQCDxW9 wdzq6euBV4W6zTkAVlVx1B2eZ78/RUdfpDyVzy3RQiUH5vYjLsIIP8KNqSE1J36z8z7D VJB5nvKL26GtEePgnvtpEYw0BfKQ2po1FueIQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=ySm4+MtMrElwdIGDssthem6q+35qWgtrM6IZsGhsUBM=; b=HAI5vV53h73Ol/sME53JQEThblvqfphJBuHWNw44y7ekOVmbL8lzYV5wvO0znJb9t2 9e+AwLl15Q2r1vxaWPviqnhqJUmTYucZabC2iyFQeCCCpiS99c2YRbwNQEf3LC7jyuNI 5z+Cl570qXTE17TZsoaGX+urb7/oxzSZFmsY9RfgRup+2jV5Z0sgjSnCR88hrAwnYwQv vEoZSoDar0RjiEAvfukNCdz2RgUm620I2tuQg+B9rBZRUJrPBOyV0giJSQ5ji7tT7t5g V0SZR+yqP0a9pFBAjxCWVzciMSIybMcFTYOvvVRZVxTA0Eea5h18J0w0YKYyux2Z6dr3 BNfA== X-Gm-Message-State: ACrzQf2cQu052Cvc639xSZqSaRErK2Aylz0Wl0DwQK/1Q2MZysk2vJRz 6QkJM3/l7TBKMxh5hFByGNIJfdp+QobECw== X-Received: by 2002:a17:90a:1648:b0:209:6bb1:63d2 with SMTP id x8-20020a17090a164800b002096bb163d2mr15962201pje.154.1664857094786; Mon, 03 Oct 2022 21:18:14 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id o15-20020aa7978f000000b005617b1e183asm2602084pfp.194.2022.10.03.21.18.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 21:18:13 -0700 (PDT) Date: Mon, 3 Oct 2022 21:18:12 -0700 From: Kees Cook To: Andy Lutomirski Cc: Rick P Edgecombe , the arch/x86 maintainers , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , Linux Kernel Mailing List , linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, Linux API , Arnd Bergmann , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , "Peter Zijlstra (Intel)" , Randy Dunlap , "Shankar, Ravi V" , Weijiang Yang , "Kirill A. Shutemov" , "Moreira, Joao" , "john.allen@amd.com" , "kcc@google.com" , "Eranian, Stephane" , Mike Rapoport , jamorris@linux.microsoft.com, dethoma@microsoft.com Subject: Re: [PATCH v2 30/39] x86: Expose thread features status in /proc/$PID/arch_status Message-ID: <202210032114.BECA56BFF@keescook> References: <20220929222936.14584-1-rick.p.edgecombe@intel.com> <20220929222936.14584-31-rick.p.edgecombe@intel.com> <202210031530.9CFB62B39F@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 03, 2022 at 03:45:50PM -0700, Andy Lutomirski wrote: > > > On Mon, Oct 3, 2022, at 3:37 PM, Kees Cook wrote: > > On Thu, Sep 29, 2022 at 03:29:27PM -0700, Rick Edgecombe wrote: > >> From: "Kirill A. Shutemov" > >> > >> Applications and loaders can have logic to decide whether to enable CET. > >> They usually don't report whether CET has been enabled or not, so there > >> is no way to verify whether an application actually is protected by CET > >> features. > >> > >> Add two lines in /proc/$PID/arch_status to report enabled and locked > >> features. > >> > >> Signed-off-by: Kirill A. Shutemov > >> [Switched to CET, added to commit log] > >> Signed-off-by: Rick Edgecombe > >> > >> --- > >> > >> v2: > >> - New patch > >> > >> arch/x86/kernel/Makefile | 2 ++ > >> arch/x86/kernel/fpu/xstate.c | 47 --------------------------- > >> arch/x86/kernel/proc.c | 63 ++++++++++++++++++++++++++++++++++++ > >> 3 files changed, 65 insertions(+), 47 deletions(-) > >> create mode 100644 arch/x86/kernel/proc.c > > > > This is two patches: one to create proc.c, the other to add CET support. > > > > I found where the "arch_status" conversation was: > > https://lore.kernel.org/all/CALCETrUjF9PBmkzH1J86vw4ZW785DP7FtcT+gcSrx29=BUnjoQ@mail.gmail.com/ > > > > Andy, what did you mean "make sure that everything in it is namespaced"? > > Everything already has a field name. And arch_status doesn't exactly > > solve having compat fields -- it still needs to be handled manually? > > Anyway... we have arch_status, so I guess it's fine. > > I think I meant that, since it's "arch_status" not "x86_status", the fields should have names like "x86.Thread_features". Otherwise if another architecture adds a Thread_features field, then anything running under something like qemu userspace emulation could be confused. > > Assuming that's what I meant, I think my comment still stands :) Ah, but that would be needed for compat things too in "arch_status", and could just as well live in "status". How about moving both of these into "status", with appropriate names? x86_64.Thread_features: ... i386.LDT_or_something: ... ? Does anything consume arch_status yet? Looks like probably not: https://codesearch.debian.net/search?q=%5Cbarch_status%5Cb&literal=0&perpkg=1 -- Kees Cook