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: <20190618081553.GL16364@dell>
Date:   Tue, 18 Jun 2019 09:15:53 +0100
From:   Lee Jones <lee.jones@...aro.org>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Dan Carpenter <dan.carpenter@...cle.com>,
        Linux List Kernel Mailing <linux-kernel@...r.kernel.org>
Subject: Re: [GIT PULL] MFD fixes for v5.2

On Mon, 17 Jun 2019, Linus Torvalds wrote:

> On Mon, Jun 17, 2019 at 3:01 AM Lee Jones <lee.jones@...aro.org> wrote:
> >
> > Enjoy!
> 
> No.
> 
> This is still entirely wrong.
> 
> You can't just randomly cast an "u32 *" to "unsigned long *".
> 
> It wasn't correct when you did it the other way in regmap_read(), but
> it's also not correct when you now for it this way for
> for_each_set_bit().
> 
> You can do
> 
>     u32 regmap_bits;
>     unsigned long bits;
> 
> and then
> 
>     ret = regmap_read(stmfx->map, STMFX_REG_IRQ_PENDING, &regmap_bits);
>     ...
>     bits = regmap_bits;
>     for_each_set_bit(n, &bits, STMFX_REG_IRQ_SRC_MAX) ..
> 
> but casting pointers at either point is *completely* wrong.
> 
> Yes, yes, it happens to work on little-endian, but on a 64-bit
> big-endian machine, the low 32 bits of the "unsigned int" will have
> absolutely _zero_ overlap with the low 32 bits of the "unsigned long"
> in memory.
> 
> When you moved the cast to for_each_set_bit(), it only moves the
> access of the bogus bits to another place instead.
> 
> So that patch doesn't fix anything at all, it only moves the same error around.

Good catch.  Thank you for taking the time to review Linus.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ