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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 25 Jun 2017 13:10:49 -0700
From:   Joe Perches <joe@...ches.com>
To:     "Enrico Weigelt, metux IT consult" <enrico.weigelt@...3.net>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib: vsprintf: add printf format conversion %M for
 errno strings

On Sun, 2017-06-25 at 21:53 +0200, Enrico Weigelt, metux IT consult
wrote:
> On 25.06.2017 19:27, Joe Perches wrote:
> 
> > Every use of %M is going to cause gcc when using __printf to emit
> > a warning like:
> > 
> > unknown conversion type character ‘M’ in format [-Wformat=]
> 
> Yeah, that's still an open problem. Actually, I still haven't found out,
> how it's done w/ all the other kernel-internal conversions.

Everything else uses "%p<foo>", <object reference>

> I was under
> the impression, there was some magic to tell the compiler which letters
> correspond to which types - unfortunately, didn't find anything like
> that. Is that really hardcoded in gcc ?
> 
> > Beyond that, why is this useful?
> 
> Use that instead of %d where errno values are printed/logged.
> > There can't possibly be any fast-path use.
> 
> I'm using it eg. for driver development - always having to look up the
> numbers is quite ugly and time consuming.
> 
> > Why not just create a function that does errno/string conversions?
> 
> Already was about to do so. Shall I call it strerror() ?

I presume kstrerror

So use something like
	"%d: (%s)", errno, kstrerror(errno)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ