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: <a9d13878-7820-d41c-9357-135094c8357f@csgroup.eu>
Date:   Mon, 11 Apr 2022 09:10:29 +0000
From:   Christophe Leroy <christophe.leroy@...roup.eu>
To:     Ariel Marcovitch <arielmarcovitch@...il.com>,
        Mike Rapoport <rppt@...nel.org>,
        Catalin Marinas <catalin.marinas@....com>
CC:     "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "mpe@...erman.id.au" <mpe@...erman.id.au>,
        "benh@...nel.crashing.org" <benh@...nel.crashing.org>,
        "paulus@...ba.org" <paulus@...ba.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: False positive kmemleak report for dtb properties names on
 powerpc

Hi Ariel

Le 09/04/2022 à 15:47, Ariel Marcovitch a écrit :
> Hi Christophe, did you get the chance to look at this?

I tested something this morning, it works for me, see below

> 
> On 23/03/2022 21:06, Mike Rapoport wrote:
>> Hi Catalin,
>>
>> On Wed, Mar 23, 2022 at 05:22:38PM +0000, Catalin Marinas wrote:
>>> Hi Ariel,
>>>
>>> On Fri, Feb 18, 2022 at 09:45:51PM +0200, Ariel Marcovitch wrote:
>>>> I was running a powerpc 32bit kernel (built using
>>>> qemu_ppc_mpc8544ds_defconfig
>>>> buildroot config, with enabling DEBUGFS+KMEMLEAK+HIGHMEM in the kernel
>>>> config)

...

>>>> I don't suppose I can just shuffle the calls in setup_arch() around, 
>>>> so I
>>>> wanted to hear your opinions first
>>> I think it's better if we change the logic than shuffling the calls.
>>> IIUC MEMBLOCK_ALLOC_ACCESSIBLE means that __va() works on the phys
>>> address return by memblock, so something like below (untested):
>> MEMBLOCK_ALLOC_ACCESSIBLE means "anywhere", see commit e63075a3c937
>> ("memblock: Introduce default allocation limit and use it to replace
>> explicit ones"), so it won't help to detect high memory.
>>
>> If I remember correctly, ppc initializes memblock *very* early, so 
>> setting
>> max_low_pfn along with lowmem_end_addr in
>> arch/powerpc/mm/init_32::MMU_init() makes sense to me.
>>
>> Maybe ppc folks have other ideas...
>> I've added Christophe who works on ppc32 these days.

I think memblock is already available at the end of MMU_init() on PPC32 
and at the end of early_setup() on PPC64. It means it is ready when we 
enter setup_arch().

I tested the change below, it works for me, I don't get any kmemleak 
report anymore.

diff --git a/arch/powerpc/kernel/setup-common.c 
b/arch/powerpc/kernel/setup-common.c
index 518ae5aa9410..9f4e50b176c9 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -840,6 +840,9 @@ void __init setup_arch(char **cmdline_p)
  	/* Set a half-reasonable default so udelay does something sensible */
  	loops_per_jiffy = 500000000 / HZ;

+	/* Parse memory topology */
+	mem_topology_setup();
+
  	/* Unflatten the device-tree passed by prom_init or kexec */
  	unflatten_device_tree();

@@ -882,9 +885,6 @@ void __init setup_arch(char **cmdline_p)
  	/* Check the SMT related command line arguments (ppc64). */
  	check_smt_enabled();

-	/* Parse memory topology */
-	mem_topology_setup();
-
  	/*
  	 * Release secondary cpus out of their spinloops at 0x60 now that
  	 * we can map physical -> logical CPU ids.
---


Christophe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ