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:   Mon, 27 Nov 2017 15:30:27 -0800
From:   Kees Cook <>
To:     David Howells <>
Cc:     Linus Torvalds <>,
        Fengguang Wu <>,
        Josh Boyer <>,
        Johannes Berg <>,
        Xiaolong Ye <>,
        LKML <>, LKP <>
Subject: Re: d7be102f29 ("cfg80211: initialize regulatory keys/database
 later"): kernel BUG at crypto/asymmetric_keys/public_key.c:80!

On Mon, Nov 27, 2017 at 3:25 PM, David Howells <> wrote:
> Linus Torvalds <> wrote:
>> I'm not seeing why it would ever be ok to do BUG_ON() instead of just
>> returning an error, though.
> This function has a list of requisite parameters for the caller:
>         BUG_ON(!pkey);          <-- You need the public key to use,
>         BUG_ON(!sig);
>         BUG_ON(!sig->digest);   <-- the message digest to check
>         BUG_ON(!sig->s);        <-- and you need the signature.
> If you fail to obtain any one of these parameters, you can't use this function
> and you should have errored out before calling this function.  It seems
> reasonable for the function to assume that you've provided them - they're kind
> of essential to the operation.  If you want, I can just remove the checks
> entirely.  Many of the kernel's functions don't perform argument checking, but
> just assume you've done it right and will oops if you haven't.
> I could just return -EINVAL, yes, but I'm not sure that's really the right
> thing to do, at least not without printing an error message, since it's a
> kernel programming error not a userspace error or data error.

The preference even in these cases has been to keep things recoverable
unless there is a very good reason to immediately stop the kernel's
thread of execution. If all callers already check for return values,
replacing BUG_ON() with WARN() and returning -EINVAL would be best.


Kees Cook
Pixel Security

Powered by blists - more mailing lists