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]
Message-ID: <4905e651-4c37-4fb4-bbc1-af9633013134@gmail.com>
Date: Fri, 5 Jul 2024 17:38:25 +0200
From: Klara Modin <klarasmodin@...il.com>
To: Oreoluwa Babatunde <quic_obabatun@...cinc.com>, robh@...nel.org,
 saravanak@...gle.com, hch@....de, m.szyprowski@...sung.com,
 robin.murphy@....com, will@...nel.org, catalin.marinas@....com
Cc: devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
 iommu@...ts.linux.dev, kernel@...cinc.com
Subject: Re: [PATCH v6 3/4] of: reserved_mem: Use unflatten_devicetree APIs to
 scan reserved memory nodes

On 2024-07-05 15:05, Klara Modin wrote:
> Hi,
> 
> On 2024-05-29 00:36, Oreoluwa Babatunde wrote:
>> The unflatten_devicetree APIs have been setup and are available to be
>> used by the time the fdt_init_reserved_mem() function is called.
>> Since the unflatten_devicetree APIs are a more efficient way of scanning
>> through the DT nodes, switch to using these APIs to facilitate the rest
>> of the reserved memory processing.
> 
> With this patch series, I've observed significantly less memory 
> available to userspace on my Raspberry Pi 1 and 3.
> 
> I see this message on the kernel console:
> Jul  4 23:13:49 bonnet kernel: OF: reserved mem: 0x1b000000..0x1effffff 
> (65536 KiB) map non-reusable linux
> 
> where it was previously marked as reusable:
> Jul  4 22:23:22 bonnet kernel: OF: reserved mem: 0x1b000000..0x1effffff 
> (65536 KiB) map reusable linux,cma
> 
> If I look at bcm283x.dtsi, it definitely has the reusable property.
> 
> I've below pointed out the snippet I think could be suspicous.
> 
>>
>> Signed-off-by: Oreoluwa Babatunde <quic_obabatun@...cinc.com>
>> ---
>>   drivers/of/of_reserved_mem.c    | 93 ++++++++++++++++++++-------------
>>   include/linux/of_reserved_mem.h |  2 +-
>>   kernel/dma/coherent.c           | 10 ++--
>>   kernel/dma/contiguous.c         |  8 +--
>>   kernel/dma/swiotlb.c            | 10 ++--
>>   5 files changed, 72 insertions(+), 51 deletions(-)
>>
>> diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
>> index 113d593ea031..05283cd24c3b 100644
>> --- a/drivers/of/of_reserved_mem.c
>> +++ b/drivers/of/of_reserved_mem.c

>> @@ -447,7 +476,7 @@ static int __init 
>> __reserved_mem_alloc_size(unsigned long node, const char *unam
>>                  uname, (unsigned long)(size / SZ_1M));
>>           return -ENOMEM;
>>       }
> 
> 
>> -    fdt_reserved_mem_save_node(node, uname, base, size);
>> +    fdt_reserved_mem_save_node(NULL, uname, base, size);
> 
> This could perhaps be suspicious?
> 
> The above message seems to come from of_init_reserved_mem_node when
> called from of_reserved_mem_save_node when called from here. This would 
> mean that the node is not actually saved to rmem and thus not marked 
> reusable?
> 
> 
>>       return 0;
>>   }

> 
> Regards,
> Klara Modin

Attaching kernel logs of old and new behavior, and my config for reference.
Download attachment "config.gz" of type "application/gzip" (27995 bytes)

Download attachment "kern-new.log.gz" of type "application/gzip" (5155 bytes)

Download attachment "kern-old.log.gz" of type "application/gzip" (4580 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ