Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Armin Wolf <W_Armin@gmx.de>, Gui-Dong Han <hanguidong02@gmail.com>
Cc: vt8231@hiddenengine.co.uk, steve.glendinning@shawell.net,
	jdelvare@suse.com, linux-hwmon@vger.kernel.org,
	linux-kernel@vger.kernel.org, baijiaju1990@gmail.com
Subject: Re: [BUG] hwmon: Widespread TOCTOU vulnerabilities in the hwmon subsystem
Date: Fri, 6 Jun 2025 16:20:09 -0700	[thread overview]
Message-ID: <72661c37-c4f4-4265-9fa4-e4b31b43f6df@roeck-us.net> (raw)
In-Reply-To: <0a3a06df-5da9-4b39-bf38-0894b8084132@gmx.de>

On 6/6/25 14:30, Armin Wolf wrote:
> Am 06.06.25 um 09:03 schrieb Gui-Dong Han:
> 
>>> On Thu, Jun 05, 2025 at 07:33:24AM -0700, Guenter Roeck wrote:
>>>>> I would like to discuss these issues further and collaborate on the
>>>>> best way to address them comprehensively.
>>>>>
>>>> I'd suggest to start submitting patches, with the goal of minimizing
>>>> the scope of changes. Sometimes that may mean expanding the scope of
>>>> locks, sometimes it may mean converting macros to functions. When
>>>> converting to functions, it doesn't have to be inline functions: I'd
>>>> leave that up to the compiler to decide. None of that code is performance
>>>> critical.
>>>>
>>> Actualy, that makes me wonder if it would make sense to introduce
>>> subsystem-level locking. We could introduce a lock in struct
>>> hwmon_device_attribute and lock it whenever a show or store function
>>> executes in drivers/hwmon/hwmon.c. That would only help for drivers
>>> using the _with_info API, but it would simplify driver code a lot.
>>> Any thoughts on that ?
> 
> Hi,
> 
> i am against adding a subsystem lock just to work around buggy drivers. Many drivers
> should use fine-grained locking to avoid high latencies when reading a single attribute.
> 

The point would be driver code simplification and increasing robustness, not
working around buggy drivers.

Anyway, what high latency are you talking about ? Serialization of attribute
accesses would only increase latency if multiple processes read attributes from
the same driver at the same time, which is hardly a typical use case.

Guenter


  reply	other threads:[~2025-06-06 23:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05 11:49 [BUG] hwmon: Widespread TOCTOU vulnerabilities in the hwmon subsystem Gui-Dong Han
2025-06-05 14:33 ` Guenter Roeck
2025-06-05 14:37   ` Guenter Roeck
2025-06-06  7:03     ` Gui-Dong Han
2025-06-06 21:30       ` Armin Wolf
2025-06-06 23:20         ` Guenter Roeck [this message]
2025-06-09 15:03           ` Armin Wolf
2025-06-09 15:27             ` Guenter Roeck
2025-06-06 23:22       ` Guenter Roeck
2025-06-09 15:06         ` Armin Wolf
2025-11-29 14:42   ` Andy Shevchenko

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=72661c37-c4f4-4265-9fa4-e4b31b43f6df@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=W_Armin@gmx.de \
    --cc=baijiaju1990@gmail.com \
    --cc=hanguidong02@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steve.glendinning@shawell.net \
    --cc=vt8231@hiddenengine.co.uk \
    /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