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: <20240905153318-ef305b5f-7987-410b-8256-aa6d01574fc9@linutronix.de>
Date: Thu, 5 Sep 2024 15:41:14 +0200
From: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
To: Rob Herring <robh@...nel.org>
Cc: Saravana Kannan <saravanak@...gle.com>, devicetree@...r.kernel.org, 
	linux-kernel@...r.kernel.org, Nam Cao <namcao@...utronix.de>
Subject: Re: [PATCH] of: address: Report error on resource bounds overflow

On Thu, Sep 05, 2024 at 08:15:40AM GMT, Rob Herring wrote:
> On Thu, Sep 5, 2024 at 2:46 AM Thomas Weißschuh
> <thomas.weissschuh@...utronix.de> wrote:
> >
> > The members "start" and "end" of struct resource are of type
> > "resource_size_t" which can be 32bit wide.
> > Values read from OF however are always 64bit wide.
> > Avoid silently truncating the value and instead return an error value.
> >
> > This can happen on real systems when the DT was created for a
> > PAE-enabled kernel and a non-PAE kernel is actually running.
> > For example with an arm defconfig and "qemu-system-arm -M virt".
> 
> A nice follow-up would be to make of_pci_range_to_resource() use
> overflows_type() as well instead of open coding it.

Good catch.

There are some differences though, it
* returns -EINVAL on overflow instead of -EOVERFLOW
* sets ->start and ->end to OF_BAD_ADDR on overflow
* does not check ->end for overflow

I don't have much experience with OF, so I'm not sure which of these are
important and if overflow checks on intermediate calculations are also
necessary.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ