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:   Tue, 09 May 2017 19:15:43 -0500
From:   ebiederm@...ssion.com (Eric W. Biederman)
To:     Kees Cook <keescook@...omium.org>
Cc:     Daniel Micay <danielmicay@...il.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Kexec Mailing List <kexec@...ts.infradead.org>
Subject: Re: [PATCH] kexec_file: Adjust type of kexec_purgatory

Kees Cook <keescook@...omium.org> writes:

> On Tue, May 9, 2017 at 4:13 PM, Daniel Micay <danielmicay@...il.com> wrote:
>> On Tue, 2017-05-09 at 16:06 -0700, Kees Cook wrote:
>>> Defining kexec_purgatory as a zero-length char array upsets compile
>>> time size checking. Since this is entirely runtime sized, switch
>>> this to void *. This silences the warning generated by the future
>>> CONFIG_FORTIFY_SOURCE, which did not like the memcmp() of a "0 byte"
>>> array.
>>>
>>> Cc: Daniel Micay <danielmicay@...il.com>
>>> Signed-off-by: Kees Cook <keescook@...omium.org>
>>> ---
>>>  kernel/kexec_file.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
>>> index b118735fea9d..bc86f85f1329 100644
>>> --- a/kernel/kexec_file.c
>>> +++ b/kernel/kexec_file.c
>>> @@ -30,7 +30,7 @@
>>>   * Declare these symbols weak so that if architecture provides a
>>> purgatory,
>>>   * these will be overridden.
>>>   */
>>> -char __weak kexec_purgatory[0];
>>> +void * __weak kexec_purgatory;
>>>  size_t __weak kexec_purgatory_size = 0;
>>>
>>>  static int kexec_calculate_store_digests(struct kimage *image);
>>> --
>>> 2.7.4
>>
>> It seems more correct to use char `char __weak kexec_purgatory[]`,
>> otherwise isn't __builtin_object_size ending up as 8, which is still
>> wrong?
>
> I tried [], that was my instinct, too, but since this is a __weak and
> not an extern, that doesn't work:
>
> kernel/kexec_file.c:33:13: warning: array ‘kexec_purgatory’ assumed to
> have one element
>  char __weak kexec_purgatory[];
>              ^~~~~~~~~~~~~~~

Nor does "void *kexec_purgatory" as that says at the address known as
kexec_purgatory is a void pointer not a blob a bytes that can be used
for something interesting.

Better to get rid of the __weak and deal with that fallout.

Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ