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  PHC 
Open Source and information security mailing list archives
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 23 Sep 2021 09:01:46 -0700
From:   Linus Torvalds <>
To:     Mike Rapoport <>
Cc:     Andrew Morton <>,
        devicetree <>,
        iommu <>,
        kasan-dev <>,
        KVM list <>,
        alpha <>,
        Linux ARM <>,
        linux-efi <>,
        Linux Kernel Mailing List <>,
        "open list:BROADCOM NVRAM DRIVER" <>,
        Linux-MM <>,
        linux-riscv <>,
        linux-s390 <>,
        Linux-sh list <>,
        "open list:SYNOPSYS ARC ARCHITECTURE" 
        linux-um <>,,
        linuxppc-dev <>,
        linux-sparc <>,, Mike Rapoport <>
Subject: Re: [PATCH 0/3] memblock: cleanup memblock_free interface

On Thu, Sep 23, 2021 at 12:43 AM Mike Rapoport <> wrote:
> The core change is in the third patch that makes memblock_free() a
> counterpart of memblock_alloc() and adds memblock_phys_alloc() to be a

> counterpart of memblock_phys_alloc().

That should be 'memblock_phys_free()'


The real reason I'm replying is that this patch is horribly buggy, and
will cause subtle problems that are nasty to debug.

You need to be a LOT more careful.

>From a trivial check - exactly because I looked at doing it with a
script, and decided it's not so easy - I found cases like this:

-               memblock_free(__pa(paca_ptrs) + new_ptrs_size,
+               memblock_free(paca_ptrs + new_ptrs_size,

which is COMPLETELY wrong.

Why? Because now that addition is done as _pointer_ addition, not as
an integer addition, and the end result is something completely

pcac_ptrs is of type 'struct paca_struct **', so when you add
new_ptrs_size to it, it will add it in terms of that many pointers,
not that many bytes.

You need to use some smarter scripting, or some way to validate it.

And no, making the scripting just replace '__pa(x)' with '(void *)(x)'
- which _would_ be mindless and get the same result - is not
acceptable either, because it avoids one of the big improvements from
using the right interface, namely having compiler type checking (and
saner code that people understand).

So NAK. No broken automated scripting patches.


Powered by blists - more mailing lists