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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20210212155031.08ad8742@xps13>
Date:   Fri, 12 Feb 2021 15:50:31 +0100
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc:     "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Richard Weinberger <richard@....at>,
        Vignesh Raghavendra <vigneshr@...com>,
        Serge Semin <Sergey.Semin@...kalelectronics.ru>,
        linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Kees Cook <keescook@...omium.org>,
        linux-hardening@...r.kernel.org
Subject: Re: [PATCH] mtd: physmap: physmap-bt1-rom: Fix unintentional stack
 access

Hi Gustavo,

"Gustavo A. R. Silva" <gustavo@...eddedor.com> wrote on Fri, 12 Feb
2021 08:45:33 -0600:

> On 2/12/21 08:12, Miquel Raynal wrote:
> > Hi Gustavo,
> > 
> > "Gustavo A. R. Silva" <gustavoars@...nel.org> wrote on Fri, 12 Feb 2021
> > 04:40:22 -0600:
> >   
> >> Cast &data to (char *) in order to avoid unintentionally accessing
> >> the stack.
> >>
> >> Notice that data is of type u32, so any increment to &data
> >> will be in the order of 4-byte chunks, and this piece of code
> >> is actually intended to be a byte offset.  
> > 
> > I don't have the same reading. I don't say that Coverity report is
> > wrong, but let's discuss this a bit further.
> > 
> > Given that &data is of type u32 *, you say that "&data + shift"
> > produces increments of 4-bytes, ie. we would access "&data + 4 *
> > shift"? Because I don't think this is the case (again, I may be wrong).  
> 
> Yep; this is pointer arithmetic. If you have an object ptr of type u32 *:
> 
> u32 *ptr;
> 
> and let's say it points to address 100. If you increment it by one:
> 
> ptr++
> 
> ptr will now point to address 104, not to 101.
> 
> Now, if instead, you first cast ptr to 'char *' and increment it by 1,
> then it will point to address 101.

Yep, I got confused with the proper addition compared to dereferencing.

Patch looks legitimate.

Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ