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]
Date:   Sat, 6 Aug 2022 10:53:16 +0200
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     Greg KH <gregkh@...uxfoundation.org>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Kernel Janitors <kernel-janitors@...r.kernel.org>
Subject: Question: dev_err_probe() vs Printk Index

Hi,

When a driver is using dev_err(), part of it is inlined and it:
    - takes advantage of dev_fmt()  [1]
    - implements Printk Index       [2]

Printk Index works with some __builtin_constant_p() magic in it.
In case of a use in a probe, 99.99% of the time the log level and the 
format will be constant and the logic for Printk Index will be put in place.


In case dev_err_probe(), the format will be an argument passed to the 
function and will not be constant, so nothing will be generated in the 
'printk'_index section.


In case dev_err_probe(), a potential dev_fmt() defined in the drivers' 
file can't be taken into consideration.
(trusting my grep, we never use in files that define dev_fmt() in the .c 
file. I've not checked if it is true via #include "<something.h>")


Even if I've read [3], I don't fully understand the real need of this 
Printk Index mechanism (at least for my own needs :))


My questions are:
    - is my analysis right?
    - is the lack of these 2 functionalities (dev_fmt and Printk Index) 
expected, when dev_err_probe() is used?
    - if not, is it a issue?
    - should it be at least documented?


(not sure who to put in copy of this mail)

CJ

[1]: 
https://elixir.bootlin.com/linux/v5.19/source/include/linux/dev_printk.h#L143
[2]: 
https://elixir.bootlin.com/linux/v5.19/source/include/linux/dev_printk.h#L107
[3]: Documentation/core-api/printk-index.rst

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ