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]
Date:   Tue, 1 Dec 2020 16:47:12 +0000
From:   Quentin Perret <qperret@...gle.com>
To:     Masahiro Yamada <masahiroy@...nel.org>
Cc:     linux-kbuild@...r.kernel.org,
        Michal Marek <michal.lkml@...kovi.net>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/5] modpost: refactor error handling and clarify
 error/fatal difference

On Tuesday 01 Dec 2020 at 19:34:15 (+0900), Masahiro Yamada wrote:
> We have 3 log functions. fatal() is special because it lets modpost bail
> out immediately. The difference between warn() and error() is the only
> prefix parts ("WARNING:" vs "ERROR:").
> 
> The intended usage of error() is probably to propagate the return code
> from the function to the exit code of modpost, as check_exports() etc.
> already does. This is a good manner because we should display as many
> issues as possible in a single run of modpost.
> 
> What is annoying about fatal() is that it kills modpost at the first
> error. People would need to run Kbuild again and again until they fix
> all errors.
> 
> But, unfortunately, people tend to do:
> "This case should not be allowed. Let's replace warn() with fatal()."

Indeed :-)

> One of the reasons is probably it is tedious to manually carry the error
> code back to the main() function.

And yes, that was the reason.

> This commit refactors error() so any single call for it automatically
> makes modpost return the error code.
> 
> I also added comments in modpost.h for warn(), error(), and fatal().
> 
> Again, please use fatal() only when you have a strong reason to do so.
> For example:
> 
>   - Memory shortage (i.e. malloc() etc. has failed)
>   - The ELF file is broken, and there is no point to continue parsing
>   - Something really odd has happened
> 
> For general coding errors, please use error().
> 
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>

I gave it a go and the error is propagated correctly, so FWIW:

Tested-by: Quentin Perret <qperret@...gle.com>

Thanks,
Quentin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ