[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241105192124.GXZypwNJ26qqahcpOZ@fat_crate.local>
Date: Tue, 5 Nov 2024 20:21:24 +0100
From: Borislav Petkov <bp@...en8.de>
To: Yazen Ghannam <yazen.ghannam@....com>
Cc: linux-edac@...r.kernel.org, linux-kernel@...r.kernel.org,
tony.luck@...el.com, x86@...nel.org, avadhut.naik@....com,
john.allen@....com, mario.limonciello@....com, bhelgaas@...gle.com,
Shyam-sundar.S-k@....com, richard.gong@....com, jdelvare@...e.com,
linux@...ck-us.net, clemens@...isch.de, hdegoede@...hat.com,
ilpo.jarvinen@...ux.intel.com, linux-pci@...r.kernel.org,
linux-hwmon@...r.kernel.org, platform-driver-x86@...r.kernel.org,
naveenkrishna.chatradhi@....com, carlos.bilbao.osdev@...il.com
Subject: Re: [PATCH 16/16] x86/amd_smn: Add support for debugfs access to SMN
registers
On Wed, Oct 23, 2024 at 05:21:50PM +0000, Yazen Ghannam wrote:
> +static ssize_t smn_value_write(struct file *file, const char __user *userbuf,
> + size_t count, loff_t *ppos)
> +{
> + u32 val;
> + int ret;
> +
> + ret = kstrtouint_from_user(userbuf, count, 0, &val);
> + if (ret)
> + return ret;
> +
> + add_taint(TAINT_USER, LOCKDEP_STILL_OK);
That looks like a TAINT_CPU_OUT_OF_SPEC to me.
> + ret = amd_smn_write(debug_node, debug_address, val);
> + if (ret)
> + return ret;
> +
> + return count;
> +}
> +
> +DEFINE_SHOW_STORE_ATTRIBUTE(smn_node);
> +DEFINE_SHOW_STORE_ATTRIBUTE(smn_address);
> +DEFINE_SHOW_STORE_ATTRIBUTE(smn_value);
> +
> static int amd_cache_roots(void)
> {
> u16 node, num_nodes = amd_num_nodes();
> @@ -180,6 +257,12 @@ static int __init amd_smn_init(void)
> if (err)
> return err;
>
> + debugfs_dir = debugfs_create_dir("amd_smn", arch_debugfs_dir);
> +
> + debugfs_create_file("node", 0600, debugfs_dir, NULL, &smn_node_fops);
> + debugfs_create_file("address", 0600, debugfs_dir, NULL, &smn_address_fops);
> + debugfs_create_file("value", 0600, debugfs_dir, NULL, &smn_value_fops);
Can we pls stick this behind a module param which is off by default? I don't
want that crap exposed even in debugfs, by default.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists