Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3282193imu; Fri, 18 Jan 2019 07:49:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN4bI4jCZ0egc/Vg3gAznhqpzhD/x/vzzzH0s3AOmN9jPaPHYD3x16S0dREhk2BCUsozpGB8 X-Received: by 2002:a17:902:6948:: with SMTP id k8mr19475798plt.2.1547826552759; Fri, 18 Jan 2019 07:49:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547826552; cv=none; d=google.com; s=arc-20160816; b=iIarC+mrDRYf/a6j06k4DSQ1E5aB2HZhC3FN90EsVZY6D7KOBScwRqFE7O/6dEdDNz I+u871Ng7FGx4jQ/vwNAq3lppPwsVcsIZ9SLToqE2yqoejeIFG0aTU0cpvTx0+cwCjgm F3eR6qNG4HfTZyEet8bdwwd+4azf5NyKczR80ABMzTcoCLTd5X6qXQNQ7BLM+zcTExen /LZpvAJW5zvCG1fo3KsHcSunE0jRcICqIludWl80dhs1ofNt/VazrWs1sDiWxJkOebbC gp4NHB2FltZoBlRiITAq3/PqW55L4OaDMdE1E4W23H2l0RrjRivp7E5uME8boApws+Pt /PNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=UC+GP9n+tV7gQQdh6KTCcK6w959zGh0p/3wAjtDBqKU=; b=YMfsDsdEBpznfmla2OqUWSwTs+udt6AwCeFLStEPhIDdwPXIgFIEcCJ4wmqj98iUi2 2Gn6pjrK+HblanySEaVwM3as5UUv5jGI2WRDr0RNTdX7cD4aNtxjC7blcoUKHArXIcK4 NF1Dmt6r2Gc/qL8sGPzzbjM6viB0ZCC08U51Hwtnmmwz9u5zpms1rjOGIVFmNWLvlIZv YAWaiZNjaECCZslwdRJ7oJxGw8t1kTD+VieqwiRnOB/zMZAni906s4/aZJQJtOEfsTLT 0zXFBBo8ocqOZyiGIimWo5N6X2eKfRoSdMpUId8+hPsbc/EW8dsNM3n00f/35cesHNAC crrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rlWtbnSa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e22si4909240pge.479.2019.01.18.07.48.56; Fri, 18 Jan 2019 07:49:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rlWtbnSa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727555AbfARPql (ORCPT + 99 others); Fri, 18 Jan 2019 10:46:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:39816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726902AbfARPqk (ORCPT ); Fri, 18 Jan 2019 10:46:40 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 19D142087E; Fri, 18 Jan 2019 15:46:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547826399; bh=L25ti83ENXOpGfDeiE9QKBf/2CVNECajnyH5mmldHQc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rlWtbnSa/qZNZMmnIEHI1LeTVfM1YVw1J9ErRVA27MORh+sGQS9vTT5AoDvuw0Tdk hcX0p/T2cBsk+FnlDsw8YWXHtGKizlxyizVyOCLo0JnIAZDi1SzF5ib+8k5eNrZf5f YRSMpLa7kwF9N3+ZIFkL1BsjUotAD7TgXFUSITyE= Date: Fri, 18 Jan 2019 16:46:37 +0100 From: Greg KH To: Suzuki K Poulose Cc: jeremy.linton@arm.com, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will.deacon@arm.com, marc.zyngier@arm.com, dave.martin@arm.com, shankerd@codeaurora.org, linux-kernel@vger.kernel.org, ykaukab@suse.de, julien.thierry@arm.com, mlangsdo@redhat.com, Steven.Price@arm.com, stefan.wahren@i2se.com, rafael@kernel.org, tglx@linutronix.de, jpoimboe@redhat.com, konrad.wilk@oracle.com, mingo@kernel.org, longman@redhat.com, ak@linux.intel.com, jkosina@suse.cz Subject: Re: [PATCH v3 1/7] sysfs/cpu: Allow individual architectures to select vulnerabilities Message-ID: <20190118154637.GA8564@kroah.com> References: <20190109235544.2992426-1-jeremy.linton@arm.com> <20190109235544.2992426-2-jeremy.linton@arm.com> <901f2f29-aa06-13ad-1995-f9f22184e39d@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <901f2f29-aa06-13ad-1995-f9f22184e39d@arm.com> User-Agent: Mutt/1.11.2 (2019-01-07) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 14, 2019 at 10:02:21AM +0000, Suzuki K Poulose wrote: > > > On 09/01/2019 23:55, Jeremy Linton wrote: > > As suggested on the list, https://lkml.org/lkml/2019/1/4/282, there are > > a number of cases where its useful for a system to avoid exporting a > > sysfs entry for a given vulnerability. This set adds an architecture > > specific callback which returns the bitmap of vulnerabilities the > > architecture would like to advertise. > > > > Signed-off-by: Jeremy Linton > > Cc: Greg Kroah-Hartman > > Cc: Rafael J. Wysocki > > Cc: Thomas Gleixner > > Cc: Josh Poimboeuf > > Cc: Konrad Rzeszutek Wilk > > Cc: Ingo Molnar > > Cc: Waiman Long > > Cc: Andi Kleen > > Cc: Jiri Kosina > > --- > > drivers/base/cpu.c | 19 +++++++++++++++++++ > > include/linux/cpu.h | 7 +++++++ > > 2 files changed, 26 insertions(+) > > > > diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c > > index eb9443d5bae1..35f6dfb24cd6 100644 > > --- a/drivers/base/cpu.c > > +++ b/drivers/base/cpu.c > > @@ -561,6 +561,11 @@ static struct attribute *cpu_root_vulnerabilities_attrs[] = { > > NULL > > }; > > +uint __weak arch_supported_vuln_attr_fields(void) > > +{ > > + return VULN_MELTDOWN|VULN_SPECTREV1|VULN_SPECTREV2|VULN_SSB|VULN_L1TF; > > +} > > + > > static const struct attribute_group cpu_root_vulnerabilities_group = { > > .name = "vulnerabilities", > > .attrs = cpu_root_vulnerabilities_attrs, > > @@ -568,6 +573,20 @@ static const struct attribute_group cpu_root_vulnerabilities_group = { > > static void __init cpu_register_vulnerabilities(void) > > { > > + int fld; > > + int max_fields = ARRAY_SIZE(cpu_root_vulnerabilities_attrs) - 1; > > + struct attribute **hd = cpu_root_vulnerabilities_attrs; > > + uint enabled_fields = arch_supported_vuln_attr_fields(); > > + > > + /* only enable entries requested by the arch code */ > > + for (fld = 0; fld < max_fields; fld++) { > > + if (enabled_fields & 1 << fld) { > > + *hd = cpu_root_vulnerabilities_attrs[fld]; > > + hd++; > > + } > > + } > > + *hd = NULL; > > + > > nit: Could we use "is_visible" callback in the attribute group to check this > dynamically ? You should, that is what it is there for. thanks, greg k-h