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
| ||
|
Message-ID: <20221012133148.6apqbip3kvnjuafu@skbuf> Date: Wed, 12 Oct 2022 16:31:48 +0300 From: Vladimir Oltean <olteanv@...il.com> To: Christian Marangi <ansuelsmth@...il.com> Cc: Andrew Lunn <andrew@...n.ch>, Vivien Didelot <vivien.didelot@...il.com>, Florian Fainelli <f.fainelli@...il.com>, "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>, netdev@...r.kernel.org, linux-kernel@...r.kernel.org, Pawel Dembicki <paweldembicki@...il.com>, Lech Perczak <lech.perczak@...il.com> Subject: Re: [net PATCH 1/2] net: dsa: qca8k: fix inband mgmt for big-endian systems On Wed, Oct 12, 2022 at 02:59:17PM +0200, Christian Marangi wrote: > > > Humm... > > > > > > This might have the same alignment issue as the second patch. In fact, > > > because the Ethernet header is 14 bytes in size, it is often > > > deliberately out of alignment by 2 bytes, so that the IP header is > > > aligned. You should probably be using get_unaligned_le32() when > > > accessing members of mgmt_ethhdr. > > > > > > Andrew > > > > Should I replace everything to get_unaligned_le32? Or this is only > > needed for the mgmt_ethhdr as it's 12 bytes? > > > > The skb data is all 32 bit contiguous stuff so it should be safe? Or > > should we treat that also as unalligned just to make sure? > > > > Same question for patch 2. the rest of the mib in skb data are all 32 or > > 64 values contiguous so wonder if we just take extra care of the > > mgmt_ethhdr. > > > > Also also... Should I use put_unalligned to fill the mgmt_ethhdr? Documentation/core-api/unaligned-memory-access.rst section "Alignment vs. Networking" says that the IP header is aligned to a 4 byte boundary. Relative to the IP header, skb_mac_header(skb) is a pointer that's 14 bytes behind, right? 14 bytes behind something aligned to a 4 byte boundary is something that's not aligned to a 4 byte boundary. That's why Andrew is suggesting to use the unaligned helper for accesses (both put and get). On-stack data structures don't need this, the compiler should take care of aligning them and their fields appropriately. The trouble is with pointers generated using manual arithmetics.
Powered by blists - more mailing lists