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] [day] [month] [year] [list]
Date:   Tue, 13 Oct 2020 17:23:47 +0100
From:   Colin Ian King <colin.king@...onical.com>
To:     Mimi Zohar <zohar@...ux.ibm.com>, Joe Perches <joe@...ches.com>,
        Dmitry Kasatkin <dmitry.kasatkin@...il.com>,
        James Morris <jmorris@...ei.org>,
        "Serge E . Hallyn" <serge@...lyn.com>,
        Roberto Sassu <roberto.sassu@...ito.it>,
        linux-integrity@...r.kernel.org,
        linux-security-module@...r.kernel.org
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ima: Fix sizeof mismatches

On 13/10/2020 17:17, Mimi Zohar wrote:
> On Mon, 2020-10-12 at 19:10 +0100, Colin Ian King wrote:
>> On 12/10/2020 19:06, Joe Perches wrote:
>>> On Mon, 2020-10-12 at 13:51 -0400, Mimi Zohar wrote:
>>>> On Wed, 2020-10-07 at 11:27 -0700, Joe Perches wrote:
>>>>> On Wed, 2020-10-07 at 12:02 +0100, Colin King wrote:
>>>>>> An incorrect sizeof is being used, sizeof(*fields) is not correct,
>>>>>> it should be sizeof(**fields). This is not causing a problem since
>>>>>> the size of these is the same. Fix this in the kmalloc_array and
>>>>>> memcpy calls.
>>>>> []
>>>>>> diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c
>>>>> []
>>>>>> @@ -216,11 +216,11 @@ int template_desc_init_fields(const char *template_fmt,
>>>>>>  	}
>>>>>>  
>>>>>>  	if (fields && num_fields) {
>>>>>> -		*fields = kmalloc_array(i, sizeof(*fields), GFP_KERNEL);
>>>>>> +		*fields = kmalloc_array(i, sizeof(**fields), GFP_KERNEL);
>>>>>>  		if (*fields == NULL)
>>>>>>  			return -ENOMEM;
>>>>>>  
>>>>>> -		memcpy(*fields, found_fields, i * sizeof(*fields));
>>>>>> +		memcpy(*fields, found_fields, i * sizeof(**fields));
>>>>>
>>>>> Maybe use kmemdup instead.
>>>>>
>>>>> 	if (fields && num_fields) {
>>>>> 		*fields = kmemdup(found_fields, i * sizeof(**fields), GFP_KERNEL);
>>>>> 		etc...
>>>>>
>>>>
>>>> Thanks, Joe.  Since this patch will be backported, perhaps it would be
>>>> better to leave this as a bug fix and upstream other changes
>>>> independently.
>>>
>>> IMO:
>>>
>>> This patch doesn't need need backporting as it doesn't
>>> actually fix anything other than a style defect.
>>>
>>> void * and void ** are the same size.
>>
>> indeed, same size, it's a semantic difference *and* a style fix :-)
> 
> Colin, based on Joe's suggestion of using kmemdup and his opinion of
> not backporting this change, can I assume you'll address his comments
> and re-post v3?

Oops, I missed that email. Yep, I'll address that later today

Colin
> 
> thanks,
> 
> Mimi
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ