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  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]
Date:   Wed, 9 Dec 2020 18:55:47 +0000
From:   Madalin Bucur <madalin.bucur@....com>
To:     Patrick Havelange <patrick.havelange@...ensium.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH net 1/4] net: freescale/fman: Split the main resource
 region reservation

> -----Original Message-----
> From: Patrick Havelange <patrick.havelange@...ensium.com>
> Sent: 09 December 2020 16:17
> To: Madalin Bucur <madalin.bucur@....com>; David S. Miller
> <davem@...emloft.net>; Jakub Kicinski <kuba@...nel.org>;
> netdev@...r.kernel.org; linux-kernel@...r.kernel.org
> Subject: Re: [PATCH net 1/4] net: freescale/fman: Split the main resource
> region reservation
> 
> >>> area. I'm assuming this is the problem you are trying to address here,
> >>> besides the stack corruption issue.
> >>
> >> Yes exactly.
> >> I did not add this behaviour (having a main region and subdrivers using
> >> subregions), I'm just trying to correct what is already there.
> >> For example: this is some content of /proc/iomem for one board I'm
> >> working with, with the current existing code:
> >> ffe400000-ffe4fdfff : fman
> >>     ffe4e0000-ffe4e0fff : mac
> >>     ffe4e2000-ffe4e2fff : mac
> >>     ffe4e4000-ffe4e4fff : mac
> >>     ffe4e6000-ffe4e6fff : mac
> >>     ffe4e8000-ffe4e8fff : mac
> >>
> >> and now with my patches:
> >> ffe400000-ffe4fdfff : /soc@...000000/fman@...000
> >>     ffe400000-ffe480fff : fman
> >>     ffe488000-ffe488fff : fman-port
> >>     ffe489000-ffe489fff : fman-port
> >>     ffe48a000-ffe48afff : fman-port
> >>     ffe48b000-ffe48bfff : fman-port
> >>     ffe48c000-ffe48cfff : fman-port
> >>     ffe4a8000-ffe4a8fff : fman-port
> >>     ffe4a9000-ffe4a9fff : fman-port
> >>     ffe4aa000-ffe4aafff : fman-port
> >>     ffe4ab000-ffe4abfff : fman-port
> >>     ffe4ac000-ffe4acfff : fman-port
> >>     ffe4c0000-ffe4dffff : fman
> >>     ffe4e0000-ffe4e0fff : mac
> >>     ffe4e2000-ffe4e2fff : mac
> >>     ffe4e4000-ffe4e4fff : mac
> >>     ffe4e6000-ffe4e6fff : mac
> >>     ffe4e8000-ffe4e8fff : mac
> >>
> >>> While for the latter I think we can
> >>> put together a quick fix, for the former I'd like to take a bit of
> time
> >>> to select the best fix, if one is really needed. So, please, let's
> split
> >>> the two problems and first address the incorrect stack memory use.
> >>
> >> I have no idea how you can fix it without a (more correct this time)
> >> dummy region passed as parameter (and you don't want to use the first
> >> patch). But then it will be useless to do the call anyway, as it won't
> >> do any proper verification at all, so it could also be removed entirely,
> >> which begs the question, why do it at all in the first place (the
> >> devm_request_mem_region).
> >>
> >> I'm not an expert in that part of the code so feel free to correct me
> if
> >> I missed something.
> >>
> >> BR,
> >>
> >> Patrick H.
> >
> > Hi, Patrick,
> >
> > the DPAA entities are described in the device tree. Adding some
> hardcoding in
> > the driver is not really the solution for this problem. And I'm not sure
> we have
> 
> I'm not seeing any problem here, the offsets used by the fman driver
> were already there, I just reorganized them in 2 blocks.
> 
> > a clear problem statement to start with. Can you help me on that part?
> 
> - The current call to __devm_request_region in fman_port.c is not correct.
> 
> One way to fix this is to use devm_request_mem_region, however this
> requires that the main fman would not be reserving the whole region.
> This leads to the second problem:
> - Make sure the main fman driver is not reserving the whole region.
> 
> Is that clearer like this ?
> 
> Patrick H.

The overlapping IO areas result from the device tree description, that in turn
mimics the HW description in the manual. If we really want to remove the nesting,
we should change the device trees, not the drivers. If we want to hack it,
instead of splitting ioremaps, we can reserve 4 kB in the FMan driver,
and keep the ioremap as it is now, with the benefit of less code churn.
In the end, what the reservation is trying to achieve is to make sure there
is a single driver controlling a certain peripeheral, and this basic
requirement would be addressed by that change plus devm_of_iomap() for child
devices (ports, MACs).

Madalin

Powered by blists - more mailing lists