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: <YoeSbH0d3qlAtwo6@lunn.ch>
Date:   Fri, 20 May 2022 15:06:52 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
        pabeni@...hat.com, keescook@...omium.org, nbd@....name,
        john@...ozen.org, sean.wang@...iatek.com, Mark-MC.Lee@...iatek.com,
        matthias.bgg@...il.com
Subject: Re: [PATCH net-next] eth: mtk_eth_soc: silence the GCC 12
 array-bounds warning

On Thu, May 19, 2022 at 10:59:40PM -0700, Jakub Kicinski wrote:
> GCC 12 gets upset because in mtk_foe_entry_commit_subflow()
> this driver allocates a partial structure. The writes are
> within bounds.

I'm wondering if the partial structure is worth it:

struct mtk_flow_entry {
        union {
                struct hlist_node list;
                struct {
                        struct rhash_head l2_node;
                        struct hlist_head l2_flows;
                };
        };
        u8 type;
        s8 wed_index;
        u16 hash;
        union {
                struct mtk_foe_entry data;
                struct {
                        struct mtk_flow_entry *base_flow;
                        struct hlist_node list;
                        struct {} end;
                } l2_data;
        };
        struct rhash_head node;
        unsigned long cookie;
};


It allocates upto l2_data.end

struct rhash contains a single pointer

So this is saving 8 or 16 bytes depending on architecture.

I estimate the structure as a whole is at least 100 bytes on 32bit
systems.

I suppose it might make sense if this makes the allocation go from 129
bytes to <= 128, and the allocater is rounding up to the nearest power
of 2?

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ