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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73B66C433FE for ; Tue, 4 Oct 2022 04:18:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 073916B0072; Tue, 4 Oct 2022 00:18:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F3E206B0073; Tue, 4 Oct 2022 00:18:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D91986B0074; Tue, 4 Oct 2022 00:18:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id BEF946B0072 for ; Tue, 4 Oct 2022 00:18:16 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8DAF240806 for ; Tue, 4 Oct 2022 04:18:16 +0000 (UTC) X-FDA: 79981959792.03.D935306 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by imf13.hostedemail.com (Postfix) with ESMTP id EA30C2000F for ; Tue, 4 Oct 2022 04:18:15 +0000 (UTC) Received: by mail-pj1-f52.google.com with SMTP id fw14so4805156pjb.3 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=yOamsjxHVh0S5QcLlT4vZF5pTI76G+JDDYnfs8bhgllPY3hXl3leq7xvVLA3iFlyjR HYABw0fTxdCrJtd5yMUl+T9rFyAmk8QM3I7L4G+tVV6C/Cfebl2N2uifxcoLzDTrOlaB WwW3TyjP8FRDWggwwxZNIZQq4AGhEwK1KUWZHYA6TEJzwtPk6d/ehOC22jZML9lkZ58R OFsAquA6MbRDl4vfrF8RddBUtER00R5gP5aiofKobeEt7kVQ/4SWi8BTblgy2pTBPztp U/Vu11ndAwzCP5Yoyx0AKU3w8BlzlIliF5pLVIqJdXkChlIdIfQ5T4A7NhBqg8wAz5PV wx7Q== X-Gm-Message-State: ACrzQf1IgJc38lngc+hM5I+U5IdnA7J+uZ/Ik1P+AMFP/FZszkXbDN8X Ql4FeakDE/eivIu0lT8jPxnFtw== X-Google-Smtp-Source: AMsMyM7oeIR2rhDCPrGi01xA+8CnRjWdmDt8Spgr9GF3IXW2Tx0ZpMSaYGHobZXaskfhNz4J2LeYcA== 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: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664857096; h=from:from:sender: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:dkim-signature; bh=ySm4+MtMrElwdIGDssthem6q+35qWgtrM6IZsGhsUBM=; b=jgnj0GqZmQAhmqEtQYD6MoBzH09IVRxikLKRFfxLtULxM4LnvJ/7vr+b0gSIqCTuKg12nL TXm+bRC6C2hrqeoJV7Wzov3IRQ1aPvVnESHgyVzq8ytGvsdxOEwsWe+eTv4JjMJwh4lXrX r5GQmWUY6x9Gn9mZPJyvr9SdRRKem3w= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=b8d7DfhJ; spf=pass (imf13.hostedemail.com: domain of keescook@chromium.org designates 209.85.216.52 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664857096; a=rsa-sha256; cv=none; b=WLM/Dwd1ujzgvhA9emNK43wV7baqx4tvchD+OTuQko5BMpxypbkbfL3Z0h4Przwm6MPn/7 YHkz8G8c0QCCslYxIhIbVzTjT1wFGux5g0DyEWSDLwqUhVO3XkEpRe+TLgh5i/+GQWPsS3 UD1Y5266ymd5fweb8K2ueA0pKEUWs1Q= X-Stat-Signature: jzka5qftfrbrtjxr9mn4aqgfqmynxbf1 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: EA30C2000F Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=b8d7DfhJ; spf=pass (imf13.hostedemail.com: domain of keescook@chromium.org designates 209.85.216.52 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspam-User: X-HE-Tag: 1664857095-699634 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 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