OpenCloudOS-Kernel/arch/um/drivers
Nathan Chancellor 857710e1b1 um: net: Fix return type of uml_net_start_xmit()
[ Upstream commit 7d748f60a4b82b50bf25fad1bd42d33f049f76aa ]

With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG),
indirect call targets are validated against the expected function
pointer prototype to make sure the call target is valid to help mitigate
ROP attacks. If they are not identical, there is a failure at run time,
which manifests as either a kernel panic or thread getting killed. A
warning in clang aims to catch these at compile time, which reveals:

  arch/um/drivers/net_kern.c:353:21: warning: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Wincompatible-function-pointer-types-strict]
    353 |         .ndo_start_xmit         = uml_net_start_xmit,
        |                                   ^~~~~~~~~~~~~~~~~~
  1 warning generated.

->ndo_start_xmit() in 'struct net_device_ops' expects a return type of
'netdev_tx_t', not 'int'. Adjust the return type of uml_net_start_xmit()
to match the prototype's to resolve the warning. While UML does not
currently implement support for kCFI, it could in the future, which
means this warning becomes a fatal CFI failure at run time.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202310031340.v1vPh207-lkp@intel.com/
Acked-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-02-05 20:14:31 +00:00
..
Kconfig um: Fix hostaudio build errors 2023-08-19 23:30:22 +02:00
Makefile um: Fix hostaudio build errors 2023-08-19 23:30:22 +02:00
chan.h um: remove unused reactivate_chan() declaration 2022-09-19 23:02:21 +02:00
chan_kern.c um: line: Use separate IRQs per line 2022-05-27 09:03:41 +02:00
chan_user.c um: chan_user: Fix winch_tramp() return value 2022-05-27 09:03:41 +02:00
chan_user.h um: Add an option to make serial driver non-raw 2020-01-19 22:41:50 +01:00
cow.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
cow_sys.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cow_user.c um: ubd: use 64-bit time_t where possible 2019-12-18 18:07:31 +01:00
daemon.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
daemon_kern.c um: daemon: Make default socket configurable 2022-05-27 09:00:40 +02:00
daemon_user.c um: Some fixes to build UML with musl 2020-10-11 23:13:06 +02:00
fd.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
harddog.h um: harddog: fix modular build 2023-05-10 00:21:30 +02:00
harddog_kern.c um: harddog: fix modular build 2023-05-10 00:21:30 +02:00
harddog_user.c um: harddog: fix modular build 2023-05-10 00:21:30 +02:00
harddog_user_exp.c um: harddog: fix modular build 2023-05-10 00:21:30 +02:00
hostaudio_kern.c uml: audio: fix -Wmissing-variable-declarations 2023-08-26 22:43:42 +02:00
line.c tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
line.h tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
mconsole.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
mconsole_kern.c um: Refactor deprecated strncpy to memcpy 2023-08-26 22:48:38 +02:00
mconsole_kern.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
mconsole_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
mmapper_kern.c um: mmaper: add __exit annotations to module exit funcs 2022-09-19 23:01:50 +02:00
net_kern.c um: net: Fix return type of uml_net_start_xmit() 2024-02-05 20:14:31 +00:00
net_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
null.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
pcap_kern.c um: Avoid pcap multiple definition errors 2023-02-13 10:13:48 +01:00
pcap_user.c um: Some fixes to build UML with musl 2020-10-11 23:13:06 +02:00
pcap_user.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
port.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
port_kern.c um: port_kern: fix -Wmissing-variable-declarations 2023-08-26 22:44:37 +02:00
port_user.c um: port_user: Improve error handling when port-helper is not found 2022-03-11 10:55:55 +01:00
pty.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
random.c hwrng: core - treat default_quality as a maximum and default to 1024 2022-11-18 16:59:34 +08:00
rtc.h um: add a pseudo RTC 2021-02-12 21:38:52 +01:00
rtc_kern.c um: add a pseudo RTC 2021-02-12 21:38:52 +01:00
rtc_user.c isystem: trim/fixup stdarg.h and other headers 2021-08-19 09:02:55 +09:00
slip.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
slip_common.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
slip_common.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
slip_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
slip_user.c um: fix error return code in slip_open() 2021-06-17 22:10:05 +02:00
slirp.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
slirp_kern.c um: fix 3 instances of -Wmissing-prototypes 2023-08-26 22:45:05 +02:00
slirp_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
ssl.c um: Do not initialise statics to 0. 2022-09-19 23:10:07 +02:00
stderr_console.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
stdio_console.c um: Do not initialise statics to 0. 2022-09-19 23:10:07 +02:00
stdio_console.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
tty.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
ubd.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
ubd_kern.c block: replace fmode_t with a block-specific type for block open flags 2023-06-12 08:04:05 -06:00
ubd_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
umcast.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
umcast_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
umcast_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
vde.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
vde_kern.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
vde_user.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
vector_kern.c um: vector: Fix memory leak in vector_config 2023-02-01 22:11:27 +01:00
vector_kern.h um: Migrate vector drivers to NAPI 2022-03-11 10:45:21 +01:00
vector_transports.c um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
vector_user.c um: vector: refactor deprecated strncpy 2023-08-26 22:42:50 +02:00
vector_user.h uml: vector: Remove unused definitions VECTOR_{WRITE,HEADERS} 2023-02-13 10:14:32 +01:00
vhost_user.h um: virtio: Replace zero-length array with flexible-array 2020-06-02 22:38:00 +02:00
virt-pci.c um: virt-pci: fix platform map offset 2024-01-25 15:35:50 -08:00
virtio_uml.c um: virtio_uml: move device breaking into workqueue 2023-02-13 10:14:32 +01:00
xterm.c um: xterm: Make default terminal emulator configurable 2022-05-27 08:50:07 +02:00
xterm.h um: Add SPDX headers for files in arch/um/drivers 2019-09-15 21:37:16 +02:00
xterm_kern.c um: fix 3 instances of -Wmissing-prototypes 2023-08-26 22:45:05 +02:00