Message ID | 20250520222452.work.063-kees@kernel.org |
---|---|
Headers | show |
Series | net: Convert dev_set_mac_address() to struct sockaddr_storage | expand |
From: Kees Cook <kees@kernel.org> Date: Tue, 20 May 2025 15:30:59 -0700 > Hi, > > As part of the effort to allow the compiler to reason about object sizes, > we need to deal with the problematic variably sized struct sockaddr, > which has no internal runtime size tracking. In much of the network > stack the use of struct sockaddr_storage has been adopted. Continue the > transition toward this for more of the internal APIs. Specifically: > > - inet_addr_is_any() > - netif_set_mac_address() > - dev_set_mac_address() > > Only 3 callers of dev_set_mac_address() needed adjustment; all others > were already using struct sockaddr_storage internally. I guess dev_set_mac_address_user() was missed on the way ? For example, tap_ioctl() still uses sockaddr and calls dev_set_mac_address_user(), which cast it to _storage.
On Tue, 20 May 2025 17:42:32 -0700 Kees Cook wrote: > Ah yes, I can include that in the next version if you want? I was trying > to find a stopping point since everything kind of touches everything ... Looks like the build considers -Wincompatible-pointer-types to always imply -Werror or some such? We explicitly disable CONFIG_WERROR in our CI, but we still get: drivers/net/macvlan.c:1302:34: error: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct __kernel_sockaddr_storage *' [-Werror,-Wincompatible-pointer-types] 1302 | dev_set_mac_address(port->dev, &sa, NULL); | ^~~ on this series :(
On May 20, 2025 8:09:29 PM PDT, Jakub Kicinski <kuba@kernel.org> wrote: >On Tue, 20 May 2025 17:42:32 -0700 Kees Cook wrote: >> Ah yes, I can include that in the next version if you want? I was trying >> to find a stopping point since everything kind of touches everything ... > >Looks like the build considers -Wincompatible-pointer-types to always >imply -Werror or some such? We explicitly disable CONFIG_WERROR in our >CI, but we still get: > >drivers/net/macvlan.c:1302:34: error: incompatible pointer types passing 'struct sockaddr *' to parameter of type 'struct __kernel_sockaddr_storage *' [-Werror,-Wincompatible-pointer-types] > 1302 | dev_set_mac_address(port->dev, &sa, NULL); > | ^~~ > >on this series :( I'll get this fixed and add dev_set_mac_address_user() for v3...