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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e0b41739-f72d-be5c-cfaa-39ced0e2ab6f@gmx.de>
Date:   Thu, 17 Dec 2020 18:42:44 +0100
From:   Helge Deller <deller@....de>
To:     Joe Perches <joe@...ches.com>, Andy Whitcroft <apw@...onical.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] checkpatch: add new warning when lookup_symbol_name() is
 used

On 12/17/20 6:27 PM, Joe Perches wrote:
> On Thu, 2020-12-17 at 18:11 +0100, Helge Deller wrote:
>> In most cases people use lookup_symbol_name() to resolve a kernel symbol
>> and then print it via printk().
>>
>> In such cases using the %ps, %pS, %pSR or %pB printk formats are easier
>> to use and thus should be preferred.
> []
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
>> @@ -4317,6 +4317,12 @@ sub process {
>>  			     "LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged\n" . $herecurr);
>>  		}
>>
>> +# avoid lookup_symbol_name()
>> +		if ($line =~ /\blookup_symbol_name\b/) {
>> +			WARN("PREFER_PRINTK_FORMAT",
>> +			     "If possible prefer %ps or %pS printk format string to print symbol name instead of using lookup_symbol_name()\n" . $herecurr);
>> +		}
>> +
>>  # check for uses of printk_ratelimit
>>  		if ($line =~ /\bprintk_ratelimit\s*\(/) {
>>  			WARN("PRINTK_RATELIMITED",
>
> Huh?  nak.
>
> lookup_symbol_name is used in the kernel a grand total of 3 times.

Yes, there were much more in the past which got fixed by patches I submitted.

> 2 uses are kprobe, the other is fs/proc

Right. For fs/proc see:
https://lore.kernel.org/lkml/20201217165413.GA1959@ls3530.fritz.box/

> None of the existing uses is equivalent to %ps

Yes, those are the remaining legimate users.

> Why should this be applied?

... to prevent people to add new code with possibly unjustified use?

Helge

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ