lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250805092922.135500-1-panchuang@vivo.com>
Date: Tue,  5 Aug 2025 17:29:21 +0800
From: Pan Chuang <panchuang@...o.com>
To: tglx@...utronix.de
Cc: linux-kernel@...r.kernel.org,
	miquel.raynal@...tlin.com,
	Jonathan.Cameron@...wei.com,
	u.kleine-koenig@...gutronix.de,
	angeg.delregno@...labora.com,
	krzk@...nel.org,
	a.fatoum@...gutronix.de,
	frank.li@...o.com,
	christophe.jaillet@...adoo.fr,
	Pan Chuang <panchuang@...o.com>
Subject: [PATCH v10 0/1] genirq/devres: Add error handling in devm_request_threaded_irq() and devm_request_any_context_irq()

There are over 700 calls to devm_request_threaded_irq() and more than 1000
calls to devm_request_irq() in the kernel. Currently, most drivers implement
repetitive and inconsistent error handling for these functions:

1. Over 2000 lines of code are dedicated to error messages
2. Analysis shows 519 unique error messages with 323 variants after normalization
3. 186 messages provide no useful debugging information
4. Only a small fraction deliver meaningful error context

As tglx pointed out:
  "It's not a general allocator like kmalloc(). It's specialized and in the
   vast majority of cases failing to request the interrupt causes the device
   probe to fail. So having proper and consistent information why the device
   cannot be used is useful."

This patch implements a standardized error reporting approach[1]:

1. Renames existing functions to __devm_request_threaded_irq() and
   __devm_request_any_context_irq()

2. Adds devm_request_result() helper to unify error reporting:  
   a) Provides consistent diagnostic logging via dev_err_probe() on failure  
   b) Returns early with success code if no error occurred
 
3. Creates new devm_request_threaded_irq() and devm_request_any_context_irq()
   that:
   a) Invoke the underscore-prefixed variants
   b) Invokes devm_request_result() for centralized logging

The new error format provides complete debugging context:
  "<device>: error -<errcode>: request_irq(<irq>) <handler> <thread_fn> <devname>"

Example from our QEMU testing:
  test_irq_device: error -EINVAL: request_irq(1001) test_handler [test_irq] test_thread_fn [test_irq] irq-1001-failure

Based on the v9, add devm_request_result() helper.
https://lore.kernel.org/all/20250730062554.269151-2-panchuang@vivo.com/

[1]https://lore.kernel.org/all/87qzy9tvso.ffs@tglx/

Pan Chuang (1):
  genirq/devres: Add err handling in devm_request_threaded_irq() and
    devm_request_any_context_irq()

 kernel/irq/devres.c | 123 ++++++++++++++++++++++++++++++--------------
 1 file changed, 83 insertions(+), 40 deletions(-)

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ