[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220725160316.GC9874@tellis.lin.mbt.kalray.eu>
Date: Mon, 25 Jul 2022 18:03:16 +0200
From: Jules Maselbas <jmaselbas@...ray.eu>
To: Claudiu Manoil <claudiu.manoil@....com>
Cc: Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: ethtool generate a buffer overflow in strlen
On Mon, Jul 25, 2022 at 12:26:40PM +0000, Claudiu Manoil wrote:
>
>
> > -----Original Message-----
> > From: Jules Maselbas <jmaselbas@...ray.eu>
> > Sent: Monday, July 25, 2022 3:20 PM
> > To: Jakub Kicinski <kuba@...nel.org>
> > Cc: Claudiu Manoil <claudiu.manoil@....com>; David S. Miller
> > <davem@...emloft.net>; netdev@...r.kernel.org
> > Subject: Re: ethtool generate a buffer overflow in strlen
> >
> > On Fri, Jul 22, 2022 at 02:29:42PM -0700, Jakub Kicinski wrote:
> > > On Fri, 22 Jul 2022 19:37:46 +0200 Jules Maselbas wrote:
> > > > There is suspicious lines in the file
> > drivers/net/ethernet/freescale/enetc/enetc_ethtool.c:
> > > > { ENETC_PM0_R1523X, "MAC rx 1523 to max-octet packets" },
> > > > and:
> > > > { ENETC_PM0_T1523X, "MAC tx 1523 to max-octet packets" },
> > > >
> > > > Where the string length is actually greater than 32 bytes which is more
> > > > than the reserved space for the name. This structure is defined as
> > > > follow:
> > > > static const struct {
> > > > int reg;
> > > > char name[ETH_GSTRING_LEN];
> > > > } enetc_port_counters[] = { ...
> > > >
> > > > In the function enetc_get_strings(), there is a strlcpy call on the
> > > > counters names which in turns calls strlen on the src string, causing
> > > > an out-of-bound read, at least out-of the string.
> > > >
> > > > I am not sure that's what caused the BUG, as I don't really know how
> > > > fortify works but I thinks this might only be visible when fortify is
> > > > enabled.
> > > >
> > > > I am not sure on how to fix this issue, maybe use `char *` instead of
> > > > an byte array.
> > >
> > > Thanks for the report!
> > Thanks for the replie :)
> >
> > > I'd suggest to just delete the RMON stats in the unstructured API
> > > in this driver and report them via
> > >
> > > ethtool -S eth0 --groups rmon
> > I am not familiar with ethtool: I don't understand what you're
> > suggesting. Would you mind giving some hints/links to what RMON stats
> > are?
> >
>
> I can do it if you're patient.
I am patient :]
Powered by blists - more mailing lists