[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y3EiKUzpShqwzEf6@zn.tnic>
Date: Sun, 13 Nov 2022 17:58:17 +0100
From: Borislav Petkov <bp@...en8.de>
To: "Joseph, Jithu" <jithu.joseph@...el.com>
Cc: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
Thiago Macieira <thiago.macieira@...el.com>,
"Luck, Tony" <tony.luck@...el.com>,
"hdegoede@...hat.com" <hdegoede@...hat.com>,
"markgross@...nel.org" <markgross@...nel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"x86@...nel.org" <x86@...nel.org>, "hpa@...or.com" <hpa@...or.com>,
"Raj, Ashok" <ashok.raj@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"platform-driver-x86@...r.kernel.org"
<platform-driver-x86@...r.kernel.org>,
"patches@...ts.linux.dev" <patches@...ts.linux.dev>,
"Shankar, Ravi V" <ravi.v.shankar@...el.com>,
"Jimenez Gonzalez, Athenas" <athenas.jimenez.gonzalez@...el.com>,
"Mehta, Sohil" <sohil.mehta@...el.com>
Subject: Re: [PATCH v2 12/14] platform/x86/intel/ifs: Add current_batch sysfs
entry
On Sun, Nov 13, 2022 at 08:41:47AM -0800, Joseph, Jithu wrote:
> Do you think it is better to restrict filename input to confirm
> to ff-mm-ss-xy.<test> format rather than accepting any string and
> treating it as a file-name and trying to load it, if it is present ?
Yap, that way you pre-filter filenames. Yeah, the header checks *must*
absolutely happen too but it would be a simple first test.
Also, you can check for:
ff-mm-ss-X.<test>
where X is a [0-9]+ of arbitrary length and this way won't have the
artificial 256 limit you have now.
> (Given that, before loading, We do intel_find_matching_signature(),
> which validates if the signature/pf entries in header confirms to the
> machine we are on before loading)
>
> We did accepting file-name as input before [1] (except for validating
> if the filename confirms to ff-mm-ss format)
Yeah, except now you want to do multiple sets of scan files.
But yeah, you can extend the interface even more:
echo <fname> /sysfs/file
* if f/m/s matches, you execute
if still within the timeout, you return -EAGAIN from
current_batch_store() to tell userspace, take a nap and try again.
* if the f/m/s doesn't match you return -EINVAL to say, wrong filename,
try the next one.
And this way, the user script can simply look at the retvals and act
accordingly - it won't even need to parse dmesg or wnatnot.
For example.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists