ipv6: Ensure natural alignment of const ipv6 loopback and router addresses
Subsystems (3)
PATCH 1/1 ipv6: Ensure natural alignment of const ipv6 loopback and router addresses
On a parisc64 kernel I notice sometimes this kernel warning:
Kernel unaligned access to 0x40ff8814 at ndisc_send_skb+0xc0/0x4d8
The address 0x40ff8814 points to the in6addr_linklocal_allrouters variable and the warning simply means that some ipv6 function tries to read a 64-bit word directly from the not-64-bit aligned in6addr_linklocal_allrouters variable.
The patch below ensures that those ipv6 loopback and router addresses always will be naturally aligned and as such prevents unaligned accesses for all architectures.
net/ipv6/addrconf_core.c +14 -7
@@ -220,19 +220,26 @@ const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {EXPORT_SYMBOL_GPL (ipv6_stub);/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */ -const struct in6_addr in6addr_loopback =IN6ADDR_LOOPBACK_INIT ; +const struct in6_addr in6addr_loopback__aligned(BITS_PER_LONG/8) + =IN6ADDR_LOOPBACK_INIT ;EXPORT_SYMBOL (in6addr_loopback); -const struct in6_addr in6addr_any =IN6ADDR_ANY_INIT ; +const struct in6_addr in6addr_any__aligned(BITS_PER_LONG/8) + =IN6ADDR_ANY_INIT ;EXPORT_SYMBOL (in6addr_any); -const struct in6_addr in6addr_linklocal_allnodes =IN6ADDR_LINKLOCAL_ALLNODES_INIT ; +const struct in6_addr in6addr_linklocal_allnodes__aligned(BITS_PER_LONG/8) + =IN6ADDR_LINKLOCAL_ALLNODES_INIT ;EXPORT_SYMBOL (in6addr_linklocal_allnodes); -const struct in6_addr in6addr_linklocal_allrouters =IN6ADDR_LINKLOCAL_ALLROUTERS_INIT ; +const struct in6_addr in6addr_linklocal_allrouters__aligned(BITS_PER_LONG/8) + =IN6ADDR_LINKLOCAL_ALLROUTERS_INIT ;EXPORT_SYMBOL (in6addr_linklocal_allrouters); -const struct in6_addr in6addr_interfacelocal_allnodes =IN6ADDR_INTERFACELOCAL_ALLNODES_INIT ; +const struct in6_addr in6addr_interfacelocal_allnodes__aligned(BITS_PER_LONG/8) + =IN6ADDR_INTERFACELOCAL_ALLNODES_INIT ;EXPORT_SYMBOL (in6addr_interfacelocal_allnodes); -const struct in6_addr in6addr_interfacelocal_allrouters =IN6ADDR_INTERFACELOCAL_ALLROUTERS_INIT ; +const struct in6_addr in6addr_interfacelocal_allrouters__aligned(BITS_PER_LONG/8) + =IN6ADDR_INTERFACELOCAL_ALLROUTERS_INIT ;EXPORT_SYMBOL (in6addr_interfacelocal_allrouters); -const struct in6_addr in6addr_sitelocal_allrouters =IN6ADDR_SITELOCAL_ALLROUTERS_INIT ; +const struct in6_addr in6addr_sitelocal_allrouters__aligned(BITS_PER_LONG/8) + =IN6ADDR_SITELOCAL_ALLROUTERS_INIT ;EXPORT_SYMBOL (in6addr_sitelocal_allrouters);static void snmp6_free_dev (struct inet6_dev *idev)
Paolo Abeni
maintainerQuoted 8 lines · Helge Deller
On a parisc64 kernel I notice sometimes this kernel warning:
Kernel unaligned access to0x40ff8814atndisc_send_skb+0xc0/0x4d8The address
0x40ff8814points to thein6addr_linklocal_allroutersvariable and the warning simply means that some ipv6 function tries to read a 64-bit word directly from the not-64-bit alignedin6addr_linklocal_allroutersvariable.
Quoted 5 lines
The patch below ensures that those ipv6 loopback and router addresses always will be naturally aligned and as such prevents unaligned accesses for all architectures.
Signed-off-by Helge Deller <[email protected]>
The patch LGTM, but the above looks like material for the 'net' tree, would you mind sending a v2 including a relevant fixes tag, the target tree in the subject prefix and possibly the stacktrace you observe?
Feel free to include my acked-by tag in v2.
Thanks,
Paolo