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:   Fri, 28 Aug 2020 10:46:12 -0700
From:   Lakshmi Ramasubramanian <nramas@...ux.microsoft.com>
To:     Thiago Jung Bauermann <bauerman@...ux.ibm.com>
Cc:     zohar@...ux.ibm.com, robh@...nel.org, gregkh@...uxfoundation.org,
        james.morse@....com, catalin.marinas@....com, sashal@...nel.org,
        will@...nel.org, mpe@...erman.id.au, benh@...nel.crashing.org,
        paulus@...ba.org, robh+dt@...nel.org, frowand.list@...il.com,
        vincenzo.frascino@....com, mark.rutland@....com,
        dmitry.kasatkin@...il.com, jmorris@...ei.org, serge@...lyn.com,
        pasha.tatashin@...een.com, allison@...utok.net,
        kstewart@...uxfoundation.org, takahiro.akashi@...aro.org,
        tglx@...utronix.de, masahiroy@...nel.org, bhsharma@...hat.com,
        mbrugger@...e.com, hsinyi@...omium.org, tao.li@...o.com,
        christophe.leroy@....fr, linux-integrity@...r.kernel.org,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
        prsriva@...ux.microsoft.com, balajib@...ux.microsoft.com
Subject: Re: [PATCH v4 2/5] powerpc: Use libfdt functions to fetch IMA buffer
 properties

On 8/27/20 4:50 PM, Thiago Jung Bauermann wrote:
> 
> Lakshmi Ramasubramanian <nramas@...ux.microsoft.com> writes:
> 
>> @@ -63,7 +29,22 @@ void remove_ima_buffer(void *fdt, int chosen_node)
>>   	if (!prop)
>>   		return;
>>   
>> -	ret = do_get_kexec_buffer(prop, len, &addr, &size);
>> +	ret = fdt_address_cells(fdt, chosen_node);
> 
> This change was already present in the previous version of the patch but
> it was just today that I noticed a problem: there's no #address-cells
> property in /chosen. This code will still work though because if there's
> no property this function returns 2 which is the correct value for
> ppc64. But it's conceptually wrong. You need to pass the node offset for
> / so that it gets the #address-cells property from there.

Thanks for the info.
Will fix this.

> 
>> +	if (ret < 0)
>> +		return;
>> +	addr_cells = ret;
>> +
>> +	ret = fdt_size_cells(fdt, chosen_node);
> 
> Here we're not so lucky. The default value returned when no #size-cells
> property is present is 1, which is wrong for ppc64 so this change
> introduces a bug. You also need to pass the node offset for / here.

Will fix this.

> 
>> +	if (ret < 0)
>> +		return;
>> +	size_cells = ret;
>> +
>> +	if (len < 4 * (addr_cells + size_cells))
>> +		return;
>> +
>> +	addr = of_read_number(prop, addr_cells);
>> +	size = of_read_number(prop + 4 * addr_cells, size_cells);
>> +
>>   	fdt_delprop(fdt, chosen_node, FDT_PROP_IMA_KEXEC_BUFFER);
>>   	if (ret)
>>   		return;
>> @@ -129,9 +110,15 @@ int setup_ima_buffer(const struct kimage *image, void *fdt, int chosen_node)
>>   	if (!image->arch.ima_buffer_size)
>>   		return 0;
>>   
>> -	ret = get_addr_size_cells(&addr_cells, &size_cells);
>> -	if (ret)
>> +	ret = fdt_address_cells(fdt, chosen_node);
>> +	if (ret < 0)
>> +		return ret;
>> +	addr_cells = ret;
>> +
>> +	ret = fdt_size_cells(fdt, chosen_node);
>> +	if (ret < 0)
>>   		return ret;
>> +	size_cells = ret;
>>   
>>   	entry_size = 4 * (addr_cells + size_cells);
> 
> Ditto here.
> 

Will fix this.

thanks,
  -lakshmi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ