mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.com>
To: "erwanaliasr1@gmail.com" <erwanaliasr1@gmail.com>
Cc: "e.velu@criteo.com" <e.velu@criteo.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] firmware/dmi: Print product serial number if any
Date: Wed, 12 Oct 2022 11:59:40 +0000	[thread overview]
Message-ID: <0d7537b3e1ef68440b72f56cc2739aa3efbe52f9.camel@suse.com> (raw)
In-Reply-To: <20221003142400.1177057-1-e.velu@criteo.com>

Hi Erwan,

On Mon, 2022-10-03 at 16:24 +0200, Erwan Velu wrote:
> During the boot sequence, the kernel prints a string to identify the
> running host. This is pretty handy to estimate the underlying hardware
> in case of early crash.
> 
> This patch add the product serial number in this reporting if any got found,
> or keep the current string. In a large fleet of servers, this
> information could be useful to identify the host that generated a given trace.
> 
> Test ran with the following command : qemu-system-x86_64 -kernel arch/x86/boot/bzImage --enable-kvm -m 512  -serial stdio  -append 'console=ttyS0' -smbios type=1,serial=R90YT7WC
> 
> Prior the patch:
> [    0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-1.fc36 04/01/2014
> 
> With the patch:
> [    0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-1.fc36 04/01/2014, SN: R90YT7WC
> 
> Signed-off-by: Erwan Velu <e.velu@criteo.com>
> ---
>  drivers/firmware/dmi_scan.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>  (...)

I see the value of this change. However it raises a privacy concern. So
far, /sys/devices/virtual/dmi/id/product_serial is only readable by
root. Writing the same string to the kernel log where everybody can
read it is thus questionable.

I can think of 2 ways to solve that problem:
1* I'm not really sure why the serial numbers stored in the DMI table
were originally considered a secret. So we could change these sysfs
attributes to mode 644, and then printing them in the kernel log would
of course be OK.
2* We could make your code dependent on
CONFIG_SECURITY_DMESG_RESTRICT=y. If dmesg is restricted to root then
including the serial number there is OK, regardless of the permissions
of /sys/devices/virtual/dmi/id/product_serial .

For simplicity I'd go with option 1, but if people strongly disagree
with making serial numbers world-readable, we can go with option 2.

Now from an implementation perspective, you chose to go with
DMI_PRODUCT_SERIAL. That will work fine for vendor systems, however for
self-assembled systems, DMI_PRODUCT_SERIAL is typically unset and
DMI_BOARD_SERIAL would be more relevant. So it may make sense to
fallback to "BSN: <DMI_BOARD_SERIAL>" if DMI_PRODUCT_SERIAL is unset.
Unless you think such systems are out of scope for the intended purpose
anyway, in which case your code is OK.

Thanks,
-- 
Jean Delvare
SUSE L3 Support

  reply	other threads:[~2022-10-12 11:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-03 14:24 Erwan Velu
2022-10-12 11:59 ` Jean Delvare [this message]
2022-10-12 12:11   ` Erwan Velu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0d7537b3e1ef68440b72f56cc2739aa3efbe52f9.camel@suse.com \
    --to=jdelvare@suse.com \
    --cc=e.velu@criteo.com \
    --cc=erwanaliasr1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®