Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'net-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski:
"Including fixes from bpf and netfilter.

Previous releases - regressions:

- Revert "net: rtnetlink: Enslave device before bringing it up",
breaks the case inverse to the one it was trying to fix

- net: dsa: fix oob access in DSA's netdevice event handler
dereference netdev_priv() before check its a DSA port

- sched: track device in tcf_block_get/put_ext() only for clsact
binder types

- net: tls, fix WARNING in __sk_msg_free when record becomes full
during splice and MORE hint set

- sfp-bus: fix SFP mode detect from bitrate

- drv: stmmac: prevent DSA tags from breaking COE

Previous releases - always broken:

- bpf: fix no forward progress in in bpf_iter_udp if output buffer is
too small

- bpf: reject variable offset alu on registers with a type of
PTR_TO_FLOW_KEYS to prevent oob access

- netfilter: tighten input validation

- net: add more sanity check in virtio_net_hdr_to_skb()

- rxrpc: fix use of Don't Fragment flag on RESPONSE packets, avoid
infinite loop

- amt: do not use the portion of skb->cb area which may get clobbered

- mptcp: improve validation of the MPTCPOPT_MP_JOIN MCTCP option

Misc:

- spring cleanup of inactive maintainers"

* tag 'net-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (88 commits)
i40e: Include types.h to some headers
ipv6: mcast: fix data-race in ipv6_mc_down / mld_ifc_work
selftests: mlxsw: qos_pfc: Adjust the test to support 8 lanes
selftests: mlxsw: qos_pfc: Remove wrong description
mlxsw: spectrum_router: Register netdevice notifier before nexthop
mlxsw: spectrum_acl_tcam: Fix stack corruption
mlxsw: spectrum_acl_tcam: Fix NULL pointer dereference in error path
mlxsw: spectrum_acl_erp: Fix error flow of pool allocation failure
ethtool: netlink: Add missing ethnl_ops_begin/complete
selftests: bonding: Add more missing config options
selftests: netdevsim: add a config file
libbpf: warn on unexpected __arg_ctx type when rewriting BTF
selftests/bpf: add tests confirming type logic in kernel for __arg_ctx
bpf: enforce types for __arg_ctx-tagged arguments in global subprogs
bpf: extract bpf_ctx_convert_map logic and make it more reusable
libbpf: feature-detect arg:ctx tag support in kernel
ipvs: avoid stat macros calls from preemptible context
netfilter: nf_tables: reject NFT_SET_CONCAT with not field length description
netfilter: nf_tables: skip dead set elements in netlink dump
netfilter: nf_tables: do not allow mismatch field size and set key length
...

+1366 -235
+17
CREDITS
··· 179 179 P: 1024/AF7B30C1 CF 97 C2 CC 6D AE A7 FE C8 BA 9C FC 88 DE 32 C3 180 180 D: Linux/MIPS port 181 181 D: Linux/68k hacker 182 + D: AX25 maintainer 182 183 S: Hauptstrasse 19 183 184 S: 79837 St. Blasien 184 185 S: Germany ··· 678 677 D: EDAC drivers and EDAC 3.0 core rework 679 678 S: Brazil 680 679 680 + N: Landen Chao 681 + E: Landen.Chao@mediatek.com 682 + D: MT7531 Ethernet switch support 683 + 681 684 N: Raymond Chen 682 685 E: raymondc@microsoft.com 683 686 D: Author of Configure script ··· 818 813 D: Support for Xircom PGSDB9 (firmware and host driver) 819 814 S: Bucharest 820 815 S: Romania 816 + 817 + N: John Crispin 818 + E: john@phrozen.org 819 + D: MediaTek MT7623 Gigabit ethernet support 821 820 822 821 N: Laurence Culhane 823 822 E: loz@holmes.demon.co.uk ··· 1546 1537 N: Andrew Haylett 1547 1538 E: ajh@primag.co.uk 1548 1539 D: Selection mechanism 1540 + 1541 + N: Johan Hedberg 1542 + E: johan.hedberg@gmail.com 1543 + D: Bluetooth subsystem maintainer 1549 1544 1550 1545 N: Andre Hedrick 1551 1546 E: andre@linux-ide.org ··· 3064 3051 S: Demonstratsii 8-382 3065 3052 S: Tula 300000 3066 3053 S: Russia 3054 + 3055 + N: Thomas Petazzoni 3056 + E: thomas.petazzoni@bootlin.com 3057 + D: Driver for the Marvell Armada 370/XP network unit. 3067 3058 3068 3059 N: Gordon Peters 3069 3060 E: GordPeters@smarttech.com
+4 -12
MAINTAINERS
··· 3390 3390 F: drivers/iio/adc/hx711.c 3391 3391 3392 3392 AX.25 NETWORK LAYER 3393 - M: Ralf Baechle <ralf@linux-mips.org> 3394 3393 L: linux-hams@vger.kernel.org 3395 - S: Maintained 3394 + S: Orphan 3396 3395 W: https://linux-ax25.in-berlin.de 3397 3396 F: include/net/ax25.h 3398 3397 F: include/uapi/linux/ax25.h ··· 3630 3631 3631 3632 BLUETOOTH DRIVERS 3632 3633 M: Marcel Holtmann <marcel@holtmann.org> 3633 - M: Johan Hedberg <johan.hedberg@gmail.com> 3634 3634 M: Luiz Augusto von Dentz <luiz.dentz@gmail.com> 3635 3635 L: linux-bluetooth@vger.kernel.org 3636 3636 S: Supported ··· 4724 4726 F: drivers/i2c/busses/i2c-thunderx* 4725 4727 4726 4728 CAVIUM LIQUIDIO NETWORK DRIVER 4727 - M: Derek Chickles <dchickles@marvell.com> 4728 - M: Satanand Burla <sburla@marvell.com> 4729 - M: Felix Manlunas <fmanlunas@marvell.com> 4730 4729 L: netdev@vger.kernel.org 4731 - S: Supported 4730 + S: Orphan 4732 4731 W: http://www.marvell.com 4733 4732 F: drivers/net/ethernet/cavium/liquidio/ 4734 4733 ··· 10234 10239 M: Haren Myneni <haren@linux.ibm.com> 10235 10240 M: Rick Lindsley <ricklind@linux.ibm.com> 10236 10241 R: Nick Child <nnac123@linux.ibm.com> 10237 - R: Dany Madden <danymadden@us.ibm.com> 10238 10242 R: Thomas Falcon <tlfalcon@linux.ibm.com> 10239 10243 L: netdev@vger.kernel.org 10240 10244 S: Supported ··· 12997 13003 F: drivers/thermal/armada_thermal.c 12998 13004 12999 13005 MARVELL MVNETA ETHERNET DRIVER 13000 - M: Thomas Petazzoni <thomas.petazzoni@bootlin.com> 13006 + M: Marcin Wojtas <marcin.s.wojtas@gmail.com> 13001 13007 L: netdev@vger.kernel.org 13002 13008 S: Maintained 13003 - F: drivers/net/ethernet/marvell/mvneta.* 13009 + F: drivers/net/ethernet/marvell/mvneta* 13004 13010 13005 13011 MARVELL MVPP2 ETHERNET DRIVER 13006 13012 M: Marcin Wojtas <marcin.s.wojtas@gmail.com> ··· 13650 13656 13651 13657 MEDIATEK ETHERNET DRIVER 13652 13658 M: Felix Fietkau <nbd@nbd.name> 13653 - M: John Crispin <john@phrozen.org> 13654 13659 M: Sean Wang <sean.wang@mediatek.com> 13655 13660 M: Mark Lee <Mark-MC.Lee@mediatek.com> 13656 13661 M: Lorenzo Bianconi <lorenzo@kernel.org> ··· 13805 13812 MEDIATEK SWITCH DRIVER 13806 13813 M: Arınç ÜNAL <arinc.unal@arinc9.com> 13807 13814 M: Daniel Golle <daniel@makrotopia.org> 13808 - M: Landen Chao <Landen.Chao@mediatek.com> 13809 13815 M: DENG Qingfang <dqfext@gmail.com> 13810 13816 M: Sean Wang <sean.wang@mediatek.com> 13811 13817 L: netdev@vger.kernel.org
+3 -3
drivers/net/amt.c
··· 11 11 #include <linux/net.h> 12 12 #include <linux/igmp.h> 13 13 #include <linux/workqueue.h> 14 - #include <net/sch_generic.h> 14 + #include <net/pkt_sched.h> 15 15 #include <net/net_namespace.h> 16 16 #include <net/ip.h> 17 17 #include <net/udp.h> ··· 80 80 81 81 static struct amt_skb_cb *amt_skb_cb(struct sk_buff *skb) 82 82 { 83 - BUILD_BUG_ON(sizeof(struct amt_skb_cb) + sizeof(struct qdisc_skb_cb) > 83 + BUILD_BUG_ON(sizeof(struct amt_skb_cb) + sizeof(struct tc_skb_cb) > 84 84 sizeof_field(struct sk_buff, cb)); 85 85 86 86 return (struct amt_skb_cb *)((void *)skb->cb + 87 - sizeof(struct qdisc_skb_cb)); 87 + sizeof(struct tc_skb_cb)); 88 88 } 89 89 90 90 static void __amt_source_gc_work(void)
+2
drivers/net/dsa/vitesse-vsc73xx-core.c
··· 1135 1135 1136 1136 vsc->gc.label = devm_kasprintf(vsc->dev, GFP_KERNEL, "VSC%04x", 1137 1137 vsc->chipid); 1138 + if (!vsc->gc.label) 1139 + return -ENOMEM; 1138 1140 vsc->gc.ngpio = 4; 1139 1141 vsc->gc.owner = THIS_MODULE; 1140 1142 vsc->gc.parent = vsc->dev;
+1 -1
drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
··· 1490 1490 mbox_cmd.q_no = vfidx * oct->sriov_info.rings_per_vf; 1491 1491 mbox_cmd.recv_len = 0; 1492 1492 mbox_cmd.recv_status = 0; 1493 - mbox_cmd.fn = (octeon_mbox_callback_t)cn23xx_get_vf_stats_callback; 1493 + mbox_cmd.fn = cn23xx_get_vf_stats_callback; 1494 1494 ctx.stats = stats; 1495 1495 atomic_set(&ctx.status, 0); 1496 1496 mbox_cmd.fn_arg = (void *)&ctx;
+1 -1
drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c
··· 429 429 mbox_cmd.q_no = 0; 430 430 mbox_cmd.recv_len = 0; 431 431 mbox_cmd.recv_status = 0; 432 - mbox_cmd.fn = (octeon_mbox_callback_t)octeon_pfvf_hs_callback; 432 + mbox_cmd.fn = octeon_pfvf_hs_callback; 433 433 mbox_cmd.fn_arg = &status; 434 434 435 435 octeon_mbox_write(oct, &mbox_cmd);
+4 -1
drivers/net/ethernet/cavium/liquidio/octeon_mailbox.h
··· 57 57 } s; 58 58 }; 59 59 60 - typedef void (*octeon_mbox_callback_t)(void *, void *, void *); 60 + struct octeon_mbox_cmd; 61 + 62 + typedef void (*octeon_mbox_callback_t)(struct octeon_device *, 63 + struct octeon_mbox_cmd *, void *); 61 64 62 65 struct octeon_mbox_cmd { 63 66 union octeon_mbox_message msg;
+1
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
··· 5 5 #define _I40E_ADMINQ_CMD_H_ 6 6 7 7 #include <linux/bits.h> 8 + #include <linux/types.h> 8 9 9 10 /* This header file defines the i40e Admin Queue commands and is shared between 10 11 * i40e Firmware and Software.
+1
drivers/net/ethernet/intel/i40e/i40e_diag.h
··· 4 4 #ifndef _I40E_DIAG_H_ 5 5 #define _I40E_DIAG_H_ 6 6 7 + #include <linux/types.h> 7 8 #include "i40e_adminq_cmd.h" 8 9 9 10 /* forward-declare the HW struct for the compiler */
+6 -1
drivers/net/ethernet/marvell/octeontx2/af/rpm.c
··· 506 506 rpm_t *rpm = rpmd; 507 507 u8 num_lmacs; 508 508 u32 fifo_len; 509 + u16 max_lmac; 509 510 510 511 lmac_info = rpm_read(rpm, 0, RPM2_CMRX_RX_LMACS); 511 512 /* LMACs are divided into two groups and each group ··· 514 513 * Group0 lmac_id range {0..3} 515 514 * Group1 lmac_id range {4..7} 516 515 */ 517 - fifo_len = rpm->mac_ops->fifo_len / 2; 516 + max_lmac = (rpm_read(rpm, 0, CGX_CONST) >> 24) & 0xFF; 517 + if (max_lmac > 4) 518 + fifo_len = rpm->mac_ops->fifo_len / 2; 519 + else 520 + fifo_len = rpm->mac_ops->fifo_len; 518 521 519 522 if (lmac_id < 4) { 520 523 num_lmacs = hweight8(lmac_info & 0xF);
+5 -3
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c
··· 301 301 unsigned long *p_index) 302 302 { 303 303 unsigned int num_rows, entry_size; 304 + unsigned long index; 304 305 305 306 /* We only allow allocations of entire rows */ 306 307 if (num_erps % erp_core->num_erp_banks != 0) ··· 310 309 entry_size = erp_core->erpt_entries_size[region_type]; 311 310 num_rows = num_erps / erp_core->num_erp_banks; 312 311 313 - *p_index = gen_pool_alloc(erp_core->erp_tables, num_rows * entry_size); 314 - if (*p_index == 0) 312 + index = gen_pool_alloc(erp_core->erp_tables, num_rows * entry_size); 313 + if (!index) 315 314 return -ENOBUFS; 316 - *p_index -= MLXSW_SP_ACL_ERP_GENALLOC_OFFSET; 315 + 316 + *p_index = index - MLXSW_SP_ACL_ERP_GENALLOC_OFFSET; 317 317 318 318 return 0; 319 319 }
+4 -2
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
··· 681 681 mlxsw_sp_acl_tcam_region_destroy(struct mlxsw_sp *mlxsw_sp, 682 682 struct mlxsw_sp_acl_tcam_region *region) 683 683 { 684 + struct mlxsw_sp_acl_tcam *tcam = mlxsw_sp_acl_to_tcam(mlxsw_sp->acl); 684 685 const struct mlxsw_sp_acl_tcam_ops *ops = mlxsw_sp->acl_tcam_ops; 685 686 686 687 ops->region_fini(mlxsw_sp, region->priv); 687 688 mlxsw_sp_acl_tcam_region_disable(mlxsw_sp, region); 688 689 mlxsw_sp_acl_tcam_region_free(mlxsw_sp, region); 689 - mlxsw_sp_acl_tcam_region_id_put(region->group->tcam, 690 - region->id); 690 + mlxsw_sp_acl_tcam_region_id_put(tcam, region->id); 691 691 kfree(region); 692 692 } 693 693 ··· 1564 1564 tcam->max_groups = max_groups; 1565 1565 tcam->max_group_size = MLXSW_CORE_RES_GET(mlxsw_sp->core, 1566 1566 ACL_MAX_GROUP_SIZE); 1567 + tcam->max_group_size = min_t(unsigned int, tcam->max_group_size, 1568 + MLXSW_REG_PAGT_ACL_MAX_NUM); 1567 1569 1568 1570 err = ops->init(mlxsw_sp, tcam->priv, tcam); 1569 1571 if (err)
+12 -12
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
··· 11472 11472 if (err) 11473 11473 goto err_register_netevent_notifier; 11474 11474 11475 + mlxsw_sp->router->netdevice_nb.notifier_call = 11476 + mlxsw_sp_router_netdevice_event; 11477 + err = register_netdevice_notifier_net(mlxsw_sp_net(mlxsw_sp), 11478 + &mlxsw_sp->router->netdevice_nb); 11479 + if (err) 11480 + goto err_register_netdev_notifier; 11481 + 11475 11482 mlxsw_sp->router->nexthop_nb.notifier_call = 11476 11483 mlxsw_sp_nexthop_obj_event; 11477 11484 err = register_nexthop_notifier(mlxsw_sp_net(mlxsw_sp), ··· 11494 11487 if (err) 11495 11488 goto err_register_fib_notifier; 11496 11489 11497 - mlxsw_sp->router->netdevice_nb.notifier_call = 11498 - mlxsw_sp_router_netdevice_event; 11499 - err = register_netdevice_notifier_net(mlxsw_sp_net(mlxsw_sp), 11500 - &mlxsw_sp->router->netdevice_nb); 11501 - if (err) 11502 - goto err_register_netdev_notifier; 11503 - 11504 11490 return 0; 11505 11491 11506 - err_register_netdev_notifier: 11507 - unregister_fib_notifier(mlxsw_sp_net(mlxsw_sp), 11508 - &mlxsw_sp->router->fib_nb); 11509 11492 err_register_fib_notifier: 11510 11493 unregister_nexthop_notifier(mlxsw_sp_net(mlxsw_sp), 11511 11494 &mlxsw_sp->router->nexthop_nb); 11512 11495 err_register_nexthop_notifier: 11496 + unregister_netdevice_notifier_net(mlxsw_sp_net(mlxsw_sp), 11497 + &router->netdevice_nb); 11498 + err_register_netdev_notifier: 11513 11499 unregister_netevent_notifier(&mlxsw_sp->router->netevent_nb); 11514 11500 err_register_netevent_notifier: 11515 11501 unregister_inet6addr_validator_notifier(&router->inet6addr_valid_nb); ··· 11550 11550 { 11551 11551 struct mlxsw_sp_router *router = mlxsw_sp->router; 11552 11552 11553 - unregister_netdevice_notifier_net(mlxsw_sp_net(mlxsw_sp), 11554 - &router->netdevice_nb); 11555 11553 unregister_fib_notifier(mlxsw_sp_net(mlxsw_sp), &router->fib_nb); 11556 11554 unregister_nexthop_notifier(mlxsw_sp_net(mlxsw_sp), 11557 11555 &router->nexthop_nb); 11556 + unregister_netdevice_notifier_net(mlxsw_sp_net(mlxsw_sp), 11557 + &router->netdevice_nb); 11558 11558 unregister_netevent_notifier(&router->netevent_nb); 11559 11559 unregister_inet6addr_validator_notifier(&router->inet6addr_valid_nb); 11560 11560 unregister_inetaddr_validator_notifier(&router->inetaddr_valid_nb);
+1
drivers/net/ethernet/neterion/s2io.c
··· 414 414 END_SIGN 415 415 }; 416 416 417 + MODULE_DESCRIPTION("Neterion 10GbE driver"); 417 418 MODULE_LICENSE("GPL"); 418 419 MODULE_VERSION(DRV_VERSION); 419 420
+1 -1
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
··· 396 396 397 397 struct rtnl_link_ops rmnet_link_ops __read_mostly = { 398 398 .kind = "rmnet", 399 - .maxtype = __IFLA_RMNET_MAX, 399 + .maxtype = IFLA_RMNET_MAX, 400 400 .priv_size = sizeof(struct rmnet_priv), 401 401 .setup = rmnet_vnd_setup, 402 402 .validate = rmnet_rtnl_validate,
+1 -1
drivers/net/ethernet/renesas/ravb_main.c
··· 1949 1949 struct ravb_tstamp_skb *ts_skb; 1950 1950 struct ravb_tx_desc *desc; 1951 1951 unsigned long flags; 1952 - u32 dma_addr; 1952 + dma_addr_t dma_addr; 1953 1953 void *buffer; 1954 1954 u32 entry; 1955 1955 u32 len;
+1
drivers/net/ethernet/stmicro/stmmac/stmmac.h
··· 267 267 u32 msg_enable; 268 268 int wolopts; 269 269 int wol_irq; 270 + bool wol_irq_disabled; 270 271 int clk_csr; 271 272 struct timer_list eee_ctrl_timer; 272 273 int lpi_irq;
+14 -6
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
··· 321 321 { 322 322 struct stmmac_priv *priv = netdev_priv(dev); 323 323 324 - if (priv->hw->pcs & STMMAC_PCS_RGMII || 325 - priv->hw->pcs & STMMAC_PCS_SGMII) { 324 + if (!(priv->plat->flags & STMMAC_FLAG_HAS_INTEGRATED_PCS) && 325 + (priv->hw->pcs & STMMAC_PCS_RGMII || 326 + priv->hw->pcs & STMMAC_PCS_SGMII)) { 326 327 struct rgmii_adv adv; 327 328 u32 supported, advertising, lp_advertising; 328 329 ··· 408 407 { 409 408 struct stmmac_priv *priv = netdev_priv(dev); 410 409 411 - if (priv->hw->pcs & STMMAC_PCS_RGMII || 412 - priv->hw->pcs & STMMAC_PCS_SGMII) { 410 + if (!(priv->plat->flags & STMMAC_FLAG_HAS_INTEGRATED_PCS) && 411 + (priv->hw->pcs & STMMAC_PCS_RGMII || 412 + priv->hw->pcs & STMMAC_PCS_SGMII)) { 413 413 /* Only support ANE */ 414 414 if (cmd->base.autoneg != AUTONEG_ENABLE) 415 415 return -EINVAL; ··· 832 830 if (wol->wolopts) { 833 831 pr_info("stmmac: wakeup enable\n"); 834 832 device_set_wakeup_enable(priv->device, 1); 835 - enable_irq_wake(priv->wol_irq); 833 + /* Avoid unbalanced enable_irq_wake calls */ 834 + if (priv->wol_irq_disabled) 835 + enable_irq_wake(priv->wol_irq); 836 + priv->wol_irq_disabled = false; 836 837 } else { 837 838 device_set_wakeup_enable(priv->device, 0); 838 - disable_irq_wake(priv->wol_irq); 839 + /* Avoid unbalanced disable_irq_wake calls */ 840 + if (!priv->wol_irq_disabled) 841 + disable_irq_wake(priv->wol_irq); 842 + priv->wol_irq_disabled = true; 839 843 } 840 844 841 845 mutex_lock(&priv->lock);
+30 -3
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 3628 3628 /* Request the Wake IRQ in case of another line 3629 3629 * is used for WoL 3630 3630 */ 3631 + priv->wol_irq_disabled = true; 3631 3632 if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) { 3632 3633 int_name = priv->int_name_wol; 3633 3634 sprintf(int_name, "%s:%s", dev->name, "wol"); ··· 4436 4435 } 4437 4436 4438 4437 /** 4438 + * stmmac_has_ip_ethertype() - Check if packet has IP ethertype 4439 + * @skb: socket buffer to check 4440 + * 4441 + * Check if a packet has an ethertype that will trigger the IP header checks 4442 + * and IP/TCP checksum engine of the stmmac core. 4443 + * 4444 + * Return: true if the ethertype can trigger the checksum engine, false 4445 + * otherwise 4446 + */ 4447 + static bool stmmac_has_ip_ethertype(struct sk_buff *skb) 4448 + { 4449 + int depth = 0; 4450 + __be16 proto; 4451 + 4452 + proto = __vlan_get_protocol(skb, eth_header_parse_protocol(skb), 4453 + &depth); 4454 + 4455 + return (depth <= ETH_HLEN) && 4456 + (proto == htons(ETH_P_IP) || proto == htons(ETH_P_IPV6)); 4457 + } 4458 + 4459 + /** 4439 4460 * stmmac_xmit - Tx entry point of the driver 4440 4461 * @skb : the socket buffer 4441 4462 * @dev : device pointer ··· 4521 4498 /* DWMAC IPs can be synthesized to support tx coe only for a few tx 4522 4499 * queues. In that case, checksum offloading for those queues that don't 4523 4500 * support tx coe needs to fallback to software checksum calculation. 4501 + * 4502 + * Packets that won't trigger the COE e.g. most DSA-tagged packets will 4503 + * also have to be checksummed in software. 4524 4504 */ 4525 4505 if (csum_insertion && 4526 - priv->plat->tx_queues_cfg[queue].coe_unsupported) { 4506 + (priv->plat->tx_queues_cfg[queue].coe_unsupported || 4507 + !stmmac_has_ip_ethertype(skb))) { 4527 4508 if (unlikely(skb_checksum_help(skb))) 4528 4509 goto dma_map_err; 4529 4510 csum_insertion = !csum_insertion; ··· 5092 5065 stmmac_rx_vlan(priv->dev, skb); 5093 5066 skb->protocol = eth_type_trans(skb, priv->dev); 5094 5067 5095 - if (unlikely(!coe)) 5068 + if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb)) 5096 5069 skb_checksum_none_assert(skb); 5097 5070 else 5098 5071 skb->ip_summed = CHECKSUM_UNNECESSARY; ··· 5615 5588 5616 5589 skb->protocol = eth_type_trans(skb, priv->dev); 5617 5590 5618 - if (unlikely(!coe)) 5591 + if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb)) 5619 5592 skb_checksum_none_assert(skb); 5620 5593 else 5621 5594 skb->ip_summed = CHECKSUM_UNNECESSARY;
+3 -2
drivers/net/ethernet/ti/am65-cpsw-nuss.c
··· 56 56 #define AM65_CPSW_MAX_PORTS 8 57 57 58 58 #define AM65_CPSW_MIN_PACKET_SIZE VLAN_ETH_ZLEN 59 - #define AM65_CPSW_MAX_PACKET_SIZE (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN) 59 + #define AM65_CPSW_MAX_PACKET_SIZE 2024 60 60 61 61 #define AM65_CPSW_REG_CTL 0x004 62 62 #define AM65_CPSW_REG_STAT_PORT_EN 0x014 ··· 2244 2244 eth_hw_addr_set(port->ndev, port->slave.mac_addr); 2245 2245 2246 2246 port->ndev->min_mtu = AM65_CPSW_MIN_PACKET_SIZE; 2247 - port->ndev->max_mtu = AM65_CPSW_MAX_PACKET_SIZE; 2247 + port->ndev->max_mtu = AM65_CPSW_MAX_PACKET_SIZE - 2248 + (VLAN_ETH_HLEN + ETH_FCS_LEN); 2248 2249 port->ndev->hw_features = NETIF_F_SG | 2249 2250 NETIF_F_RXCSUM | 2250 2251 NETIF_F_HW_CSUM |
+1 -1
drivers/net/ethernet/wangxun/Kconfig
··· 26 26 tristate "Wangxun(R) GbE PCI Express adapters support" 27 27 depends on PCI 28 28 select LIBWX 29 - select PHYLIB 29 + select PHYLINK 30 30 help 31 31 This driver supports Wangxun(R) GbE PCI Express family of 32 32 adapters.
+1
drivers/net/ethernet/wangxun/libwx/wx_lib.c
··· 2769 2769 } 2770 2770 EXPORT_SYMBOL(wx_set_ring); 2771 2771 2772 + MODULE_DESCRIPTION("Common library for Wangxun(R) Ethernet drivers."); 2772 2773 MODULE_LICENSE("GPL");
+7 -2
drivers/net/netdevsim/netdev.c
··· 369 369 return err; 370 370 } 371 371 372 + static void nsim_exit_netdevsim(struct netdevsim *ns) 373 + { 374 + nsim_udp_tunnels_info_destroy(ns->netdev); 375 + mock_phc_destroy(ns->phc); 376 + } 377 + 372 378 struct netdevsim * 373 379 nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port) 374 380 { ··· 423 417 } 424 418 rtnl_unlock(); 425 419 if (nsim_dev_port_is_pf(ns->nsim_dev_port)) 426 - nsim_udp_tunnels_info_destroy(dev); 427 - mock_phc_destroy(ns->phc); 420 + nsim_exit_netdevsim(ns); 428 421 free_netdev(dev); 429 422 } 430 423
+9
drivers/net/phy/micrel.c
··· 3338 3338 #define LAN8841_ADC_CHANNEL_MASK 198 3339 3339 #define LAN8841_PTP_RX_PARSE_L2_ADDR_EN 370 3340 3340 #define LAN8841_PTP_RX_PARSE_IP_ADDR_EN 371 3341 + #define LAN8841_PTP_RX_VERSION 374 3341 3342 #define LAN8841_PTP_TX_PARSE_L2_ADDR_EN 434 3342 3343 #define LAN8841_PTP_TX_PARSE_IP_ADDR_EN 435 3344 + #define LAN8841_PTP_TX_VERSION 438 3343 3345 #define LAN8841_PTP_CMD_CTL 256 3344 3346 #define LAN8841_PTP_CMD_CTL_PTP_ENABLE BIT(2) 3345 3347 #define LAN8841_PTP_CMD_CTL_PTP_DISABLE BIT(1) ··· 3384 3382 LAN8841_PTP_TX_PARSE_IP_ADDR_EN, 0); 3385 3383 phy_write_mmd(phydev, KSZ9131RN_MMD_COMMON_CTRL_REG, 3386 3384 LAN8841_PTP_RX_PARSE_IP_ADDR_EN, 0); 3385 + 3386 + /* Disable checking for minorVersionPTP field */ 3387 + phy_write_mmd(phydev, KSZ9131RN_MMD_COMMON_CTRL_REG, 3388 + LAN8841_PTP_RX_VERSION, 0xff00); 3389 + phy_write_mmd(phydev, KSZ9131RN_MMD_COMMON_CTRL_REG, 3390 + LAN8841_PTP_TX_VERSION, 0xff00); 3387 3391 3388 3392 /* 100BT Clause 40 improvenent errata */ 3389 3393 phy_write_mmd(phydev, LAN8841_MMD_ANALOG_REG, ··· 4847 4839 .flags = PHY_POLL_CABLE_TEST, 4848 4840 .driver_data = &ksz9131_type, 4849 4841 .probe = kszphy_probe, 4842 + .soft_reset = genphy_soft_reset, 4850 4843 .config_init = ksz9131_config_init, 4851 4844 .config_intr = kszphy_config_intr, 4852 4845 .config_aneg = ksz9131_config_aneg,
+4 -4
drivers/net/phy/sfp-bus.c
··· 151 151 unsigned int br_min, br_nom, br_max; 152 152 __ETHTOOL_DECLARE_LINK_MODE_MASK(modes) = { 0, }; 153 153 154 - phylink_set(modes, Autoneg); 155 - phylink_set(modes, Pause); 156 - phylink_set(modes, Asym_Pause); 157 - 158 154 /* Decode the bitrate information to MBd */ 159 155 br_min = br_nom = br_max = 0; 160 156 if (id->base.br_nominal) { ··· 334 338 __set_bit(PHY_INTERFACE_MODE_2500BASEX, interfaces); 335 339 } 336 340 } 341 + 342 + phylink_set(modes, Autoneg); 343 + phylink_set(modes, Pause); 344 + phylink_set(modes, Asym_Pause); 337 345 338 346 if (bus->sfp_quirk && bus->sfp_quirk->modes) 339 347 bus->sfp_quirk->modes(id, modes, interfaces);
+1
drivers/net/slip/slhc.c
··· 752 752 EXPORT_SYMBOL(slhc_uncompress); 753 753 EXPORT_SYMBOL(slhc_toss); 754 754 755 + MODULE_DESCRIPTION("Compression helpers for SLIP (serial line)"); 755 756 MODULE_LICENSE("Dual BSD/GPL");
+1
drivers/net/slip/slip.c
··· 1437 1437 } 1438 1438 1439 1439 #endif 1440 + MODULE_DESCRIPTION("SLIP (serial line) protocol module"); 1440 1441 MODULE_LICENSE("GPL"); 1441 1442 MODULE_ALIAS_LDISC(N_SLIP);
+5 -4
drivers/net/virtio_net.c
··· 4295 4295 { 4296 4296 vq_callback_t **callbacks; 4297 4297 struct virtqueue **vqs; 4298 - int ret = -ENOMEM; 4299 - int i, total_vqs; 4300 4298 const char **names; 4299 + int ret = -ENOMEM; 4300 + int total_vqs; 4301 4301 bool *ctx; 4302 + u16 i; 4302 4303 4303 4304 /* We expect 1 RX virtqueue followed by 1 TX virtqueue, followed by 4304 4305 * possible N-1 RX/TX queue pairs used in multiqueue mode, followed by ··· 4336 4335 for (i = 0; i < vi->max_queue_pairs; i++) { 4337 4336 callbacks[rxq2vq(i)] = skb_recv_done; 4338 4337 callbacks[txq2vq(i)] = skb_xmit_done; 4339 - sprintf(vi->rq[i].name, "input.%d", i); 4340 - sprintf(vi->sq[i].name, "output.%d", i); 4338 + sprintf(vi->rq[i].name, "input.%u", i); 4339 + sprintf(vi->sq[i].name, "output.%u", i); 4341 4340 names[rxq2vq(i)] = vi->rq[i].name; 4342 4341 names[txq2vq(i)] = vi->sq[i].name; 4343 4342 if (ctx)
+1
drivers/net/wan/slic_ds26522.c
··· 28 28 29 29 static struct spi_device *g_spi; 30 30 31 + MODULE_DESCRIPTION("Slic Maxim DS26522 driver"); 31 32 MODULE_LICENSE("GPL"); 32 33 MODULE_AUTHOR("Zhao Qiang<B45475@freescale.com>"); 33 34
+1 -1
include/linux/btf.h
··· 512 512 int register_btf_id_dtor_kfuncs(const struct btf_id_dtor_kfunc *dtors, u32 add_cnt, 513 513 struct module *owner); 514 514 struct btf_struct_meta *btf_find_struct_meta(const struct btf *btf, u32 btf_id); 515 - const struct btf_member * 515 + const struct btf_type * 516 516 btf_get_prog_ctx_type(struct bpf_verifier_log *log, const struct btf *btf, 517 517 const struct btf_type *t, enum bpf_prog_type prog_type, 518 518 int arg);
+3 -3
include/linux/netfilter_bridge.h
··· 42 42 if (!nf_bridge) 43 43 return 0; 44 44 45 - return nf_bridge->physindev ? nf_bridge->physindev->ifindex : 0; 45 + return nf_bridge->physinif; 46 46 } 47 47 48 48 static inline int nf_bridge_get_physoutif(const struct sk_buff *skb) ··· 56 56 } 57 57 58 58 static inline struct net_device * 59 - nf_bridge_get_physindev(const struct sk_buff *skb) 59 + nf_bridge_get_physindev(const struct sk_buff *skb, struct net *net) 60 60 { 61 61 const struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb); 62 62 63 - return nf_bridge ? nf_bridge->physindev : NULL; 63 + return nf_bridge ? dev_get_by_index_rcu(net, nf_bridge->physinif) : NULL; 64 64 } 65 65 66 66 static inline struct net_device *
+1 -1
include/linux/skbuff.h
··· 295 295 u8 bridged_dnat:1; 296 296 u8 sabotage_in_done:1; 297 297 __u16 frag_max_size; 298 - struct net_device *physindev; 298 + int physinif; 299 299 300 300 /* always valid & non-NULL from FORWARD on, for physdev match */ 301 301 struct net_device *physoutdev;
+7 -2
include/linux/virtio_net.h
··· 3 3 #define _LINUX_VIRTIO_NET_H 4 4 5 5 #include <linux/if_vlan.h> 6 + #include <linux/ip.h> 7 + #include <linux/ipv6.h> 6 8 #include <linux/udp.h> 7 9 #include <uapi/linux/tcp.h> 8 10 #include <uapi/linux/virtio_net.h> ··· 51 49 const struct virtio_net_hdr *hdr, 52 50 bool little_endian) 53 51 { 52 + unsigned int nh_min_len = sizeof(struct iphdr); 54 53 unsigned int gso_type = 0; 55 54 unsigned int thlen = 0; 56 55 unsigned int p_off = 0; ··· 68 65 gso_type = SKB_GSO_TCPV6; 69 66 ip_proto = IPPROTO_TCP; 70 67 thlen = sizeof(struct tcphdr); 68 + nh_min_len = sizeof(struct ipv6hdr); 71 69 break; 72 70 case VIRTIO_NET_HDR_GSO_UDP: 73 71 gso_type = SKB_GSO_UDP; ··· 104 100 if (!skb_partial_csum_set(skb, start, off)) 105 101 return -EINVAL; 106 102 107 - p_off = skb_transport_offset(skb) + thlen; 103 + nh_min_len = max_t(u32, nh_min_len, skb_transport_offset(skb)); 104 + p_off = nh_min_len + thlen; 108 105 if (!pskb_may_pull(skb, p_off)) 109 106 return -EINVAL; 110 107 } else { ··· 145 140 146 141 skb_set_transport_header(skb, keys.control.thoff); 147 142 } else if (gso_type) { 148 - p_off = thlen; 143 + p_off = nh_min_len + thlen; 149 144 if (!pskb_may_pull(skb, p_off)) 150 145 return -EINVAL; 151 146 }
+1 -1
include/net/netdev_queues.h
··· 128 128 netdev_txq_completed_mb(txq, pkts, bytes); \ 129 129 \ 130 130 _res = -1; \ 131 - if (pkts && likely(get_desc > start_thrs)) { \ 131 + if (pkts && likely(get_desc >= start_thrs)) { \ 132 132 _res = 1; \ 133 133 if (unlikely(netif_tx_queue_stopped(txq)) && \ 134 134 !(down_cond)) { \
+205 -26
kernel/bpf/btf.c
··· 5615 5615 #undef BPF_MAP_TYPE 5616 5616 #undef BPF_LINK_TYPE 5617 5617 5618 - const struct btf_member * 5618 + static const struct btf_type *find_canonical_prog_ctx_type(enum bpf_prog_type prog_type) 5619 + { 5620 + const struct btf_type *conv_struct; 5621 + const struct btf_member *ctx_type; 5622 + 5623 + conv_struct = bpf_ctx_convert.t; 5624 + if (!conv_struct) 5625 + return NULL; 5626 + /* prog_type is valid bpf program type. No need for bounds check. */ 5627 + ctx_type = btf_type_member(conv_struct) + bpf_ctx_convert_map[prog_type] * 2; 5628 + /* ctx_type is a pointer to prog_ctx_type in vmlinux. 5629 + * Like 'struct __sk_buff' 5630 + */ 5631 + return btf_type_by_id(btf_vmlinux, ctx_type->type); 5632 + } 5633 + 5634 + static int find_kern_ctx_type_id(enum bpf_prog_type prog_type) 5635 + { 5636 + const struct btf_type *conv_struct; 5637 + const struct btf_member *ctx_type; 5638 + 5639 + conv_struct = bpf_ctx_convert.t; 5640 + if (!conv_struct) 5641 + return -EFAULT; 5642 + /* prog_type is valid bpf program type. No need for bounds check. */ 5643 + ctx_type = btf_type_member(conv_struct) + bpf_ctx_convert_map[prog_type] * 2 + 1; 5644 + /* ctx_type is a pointer to prog_ctx_type in vmlinux. 5645 + * Like 'struct sk_buff' 5646 + */ 5647 + return ctx_type->type; 5648 + } 5649 + 5650 + const struct btf_type * 5619 5651 btf_get_prog_ctx_type(struct bpf_verifier_log *log, const struct btf *btf, 5620 5652 const struct btf_type *t, enum bpf_prog_type prog_type, 5621 5653 int arg) 5622 5654 { 5623 - const struct btf_type *conv_struct; 5624 - const struct btf_type *ctx_struct; 5625 - const struct btf_member *ctx_type; 5655 + const struct btf_type *ctx_type; 5626 5656 const char *tname, *ctx_tname; 5627 5657 5628 - conv_struct = bpf_ctx_convert.t; 5629 - if (!conv_struct) { 5630 - bpf_log(log, "btf_vmlinux is malformed\n"); 5631 - return NULL; 5632 - } 5633 5658 t = btf_type_by_id(btf, t->type); 5634 5659 while (btf_type_is_modifier(t)) 5635 5660 t = btf_type_by_id(btf, t->type); ··· 5671 5646 bpf_log(log, "arg#%d struct doesn't have a name\n", arg); 5672 5647 return NULL; 5673 5648 } 5674 - /* prog_type is valid bpf program type. No need for bounds check. */ 5675 - ctx_type = btf_type_member(conv_struct) + bpf_ctx_convert_map[prog_type] * 2; 5676 - /* ctx_struct is a pointer to prog_ctx_type in vmlinux. 5677 - * Like 'struct __sk_buff' 5678 - */ 5679 - ctx_struct = btf_type_by_id(btf_vmlinux, ctx_type->type); 5680 - if (!ctx_struct) 5649 + 5650 + ctx_type = find_canonical_prog_ctx_type(prog_type); 5651 + if (!ctx_type) { 5652 + bpf_log(log, "btf_vmlinux is malformed\n"); 5681 5653 /* should not happen */ 5682 5654 return NULL; 5655 + } 5683 5656 again: 5684 - ctx_tname = btf_name_by_offset(btf_vmlinux, ctx_struct->name_off); 5657 + ctx_tname = btf_name_by_offset(btf_vmlinux, ctx_type->name_off); 5685 5658 if (!ctx_tname) { 5686 5659 /* should not happen */ 5687 5660 bpf_log(log, "Please fix kernel include/linux/bpf_types.h\n"); ··· 5700 5677 /* bpf_user_pt_regs_t is a typedef, so resolve it to 5701 5678 * underlying struct and check name again 5702 5679 */ 5703 - if (!btf_type_is_modifier(ctx_struct)) 5680 + if (!btf_type_is_modifier(ctx_type)) 5704 5681 return NULL; 5705 - while (btf_type_is_modifier(ctx_struct)) 5706 - ctx_struct = btf_type_by_id(btf_vmlinux, ctx_struct->type); 5682 + while (btf_type_is_modifier(ctx_type)) 5683 + ctx_type = btf_type_by_id(btf_vmlinux, ctx_type->type); 5707 5684 goto again; 5708 5685 } 5709 5686 return ctx_type; 5687 + } 5688 + 5689 + /* forward declarations for arch-specific underlying types of 5690 + * bpf_user_pt_regs_t; this avoids the need for arch-specific #ifdef 5691 + * compilation guards below for BPF_PROG_TYPE_PERF_EVENT checks, but still 5692 + * works correctly with __builtin_types_compatible_p() on respective 5693 + * architectures 5694 + */ 5695 + struct user_regs_struct; 5696 + struct user_pt_regs; 5697 + 5698 + static int btf_validate_prog_ctx_type(struct bpf_verifier_log *log, const struct btf *btf, 5699 + const struct btf_type *t, int arg, 5700 + enum bpf_prog_type prog_type, 5701 + enum bpf_attach_type attach_type) 5702 + { 5703 + const struct btf_type *ctx_type; 5704 + const char *tname, *ctx_tname; 5705 + 5706 + if (!btf_is_ptr(t)) { 5707 + bpf_log(log, "arg#%d type isn't a pointer\n", arg); 5708 + return -EINVAL; 5709 + } 5710 + t = btf_type_by_id(btf, t->type); 5711 + 5712 + /* KPROBE and PERF_EVENT programs allow bpf_user_pt_regs_t typedef */ 5713 + if (prog_type == BPF_PROG_TYPE_KPROBE || prog_type == BPF_PROG_TYPE_PERF_EVENT) { 5714 + while (btf_type_is_modifier(t) && !btf_type_is_typedef(t)) 5715 + t = btf_type_by_id(btf, t->type); 5716 + 5717 + if (btf_type_is_typedef(t)) { 5718 + tname = btf_name_by_offset(btf, t->name_off); 5719 + if (tname && strcmp(tname, "bpf_user_pt_regs_t") == 0) 5720 + return 0; 5721 + } 5722 + } 5723 + 5724 + /* all other program types don't use typedefs for context type */ 5725 + while (btf_type_is_modifier(t)) 5726 + t = btf_type_by_id(btf, t->type); 5727 + 5728 + /* `void *ctx __arg_ctx` is always valid */ 5729 + if (btf_type_is_void(t)) 5730 + return 0; 5731 + 5732 + tname = btf_name_by_offset(btf, t->name_off); 5733 + if (str_is_empty(tname)) { 5734 + bpf_log(log, "arg#%d type doesn't have a name\n", arg); 5735 + return -EINVAL; 5736 + } 5737 + 5738 + /* special cases */ 5739 + switch (prog_type) { 5740 + case BPF_PROG_TYPE_KPROBE: 5741 + if (__btf_type_is_struct(t) && strcmp(tname, "pt_regs") == 0) 5742 + return 0; 5743 + break; 5744 + case BPF_PROG_TYPE_PERF_EVENT: 5745 + if (__builtin_types_compatible_p(bpf_user_pt_regs_t, struct pt_regs) && 5746 + __btf_type_is_struct(t) && strcmp(tname, "pt_regs") == 0) 5747 + return 0; 5748 + if (__builtin_types_compatible_p(bpf_user_pt_regs_t, struct user_pt_regs) && 5749 + __btf_type_is_struct(t) && strcmp(tname, "user_pt_regs") == 0) 5750 + return 0; 5751 + if (__builtin_types_compatible_p(bpf_user_pt_regs_t, struct user_regs_struct) && 5752 + __btf_type_is_struct(t) && strcmp(tname, "user_regs_struct") == 0) 5753 + return 0; 5754 + break; 5755 + case BPF_PROG_TYPE_RAW_TRACEPOINT: 5756 + case BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE: 5757 + /* allow u64* as ctx */ 5758 + if (btf_is_int(t) && t->size == 8) 5759 + return 0; 5760 + break; 5761 + case BPF_PROG_TYPE_TRACING: 5762 + switch (attach_type) { 5763 + case BPF_TRACE_RAW_TP: 5764 + /* tp_btf program is TRACING, so need special case here */ 5765 + if (__btf_type_is_struct(t) && 5766 + strcmp(tname, "bpf_raw_tracepoint_args") == 0) 5767 + return 0; 5768 + /* allow u64* as ctx */ 5769 + if (btf_is_int(t) && t->size == 8) 5770 + return 0; 5771 + break; 5772 + case BPF_TRACE_ITER: 5773 + /* allow struct bpf_iter__xxx types only */ 5774 + if (__btf_type_is_struct(t) && 5775 + strncmp(tname, "bpf_iter__", sizeof("bpf_iter__") - 1) == 0) 5776 + return 0; 5777 + break; 5778 + case BPF_TRACE_FENTRY: 5779 + case BPF_TRACE_FEXIT: 5780 + case BPF_MODIFY_RETURN: 5781 + /* allow u64* as ctx */ 5782 + if (btf_is_int(t) && t->size == 8) 5783 + return 0; 5784 + break; 5785 + default: 5786 + break; 5787 + } 5788 + break; 5789 + case BPF_PROG_TYPE_LSM: 5790 + case BPF_PROG_TYPE_STRUCT_OPS: 5791 + /* allow u64* as ctx */ 5792 + if (btf_is_int(t) && t->size == 8) 5793 + return 0; 5794 + break; 5795 + case BPF_PROG_TYPE_TRACEPOINT: 5796 + case BPF_PROG_TYPE_SYSCALL: 5797 + case BPF_PROG_TYPE_EXT: 5798 + return 0; /* anything goes */ 5799 + default: 5800 + break; 5801 + } 5802 + 5803 + ctx_type = find_canonical_prog_ctx_type(prog_type); 5804 + if (!ctx_type) { 5805 + /* should not happen */ 5806 + bpf_log(log, "btf_vmlinux is malformed\n"); 5807 + return -EINVAL; 5808 + } 5809 + 5810 + /* resolve typedefs and check that underlying structs are matching as well */ 5811 + while (btf_type_is_modifier(ctx_type)) 5812 + ctx_type = btf_type_by_id(btf_vmlinux, ctx_type->type); 5813 + 5814 + /* if program type doesn't have distinctly named struct type for 5815 + * context, then __arg_ctx argument can only be `void *`, which we 5816 + * already checked above 5817 + */ 5818 + if (!__btf_type_is_struct(ctx_type)) { 5819 + bpf_log(log, "arg#%d should be void pointer\n", arg); 5820 + return -EINVAL; 5821 + } 5822 + 5823 + ctx_tname = btf_name_by_offset(btf_vmlinux, ctx_type->name_off); 5824 + if (!__btf_type_is_struct(t) || strcmp(ctx_tname, tname) != 0) { 5825 + bpf_log(log, "arg#%d should be `struct %s *`\n", arg, ctx_tname); 5826 + return -EINVAL; 5827 + } 5828 + 5829 + return 0; 5710 5830 } 5711 5831 5712 5832 static int btf_translate_to_vmlinux(struct bpf_verifier_log *log, ··· 5858 5692 enum bpf_prog_type prog_type, 5859 5693 int arg) 5860 5694 { 5861 - const struct btf_member *prog_ctx_type, *kern_ctx_type; 5862 - 5863 - prog_ctx_type = btf_get_prog_ctx_type(log, btf, t, prog_type, arg); 5864 - if (!prog_ctx_type) 5695 + if (!btf_get_prog_ctx_type(log, btf, t, prog_type, arg)) 5865 5696 return -ENOENT; 5866 - kern_ctx_type = prog_ctx_type + 1; 5867 - return kern_ctx_type->type; 5697 + return find_kern_ctx_type_id(prog_type); 5868 5698 } 5869 5699 5870 5700 int get_kern_ctx_btf_id(struct bpf_verifier_log *log, enum bpf_prog_type prog_type) ··· 7094 6932 bpf_log(log, "Arg#%d type %s in %s() is not supported yet.\n", 7095 6933 i, btf_type_str(t), tname); 7096 6934 return -EINVAL; 6935 + } 6936 + 6937 + for (i = 0; i < nargs; i++) { 6938 + const char *tag; 6939 + 6940 + if (sub->args[i].arg_type != ARG_PTR_TO_CTX) 6941 + continue; 6942 + 6943 + /* check if arg has "arg:ctx" tag */ 6944 + t = btf_type_by_id(btf, args[i].type); 6945 + tag = btf_find_decl_tag_value(btf, fn_t, i, "arg:"); 6946 + if (IS_ERR_OR_NULL(tag) || strcmp(tag, "ctx") != 0) 6947 + continue; 6948 + 6949 + if (btf_validate_prog_ctx_type(log, btf, t, i, prog_type, 6950 + prog->expected_attach_type)) 6951 + return -EINVAL; 7097 6952 } 7098 6953 7099 6954 sub->arg_cnt = nargs;
+4
kernel/bpf/verifier.c
··· 12826 12826 } 12827 12827 12828 12828 switch (base_type(ptr_reg->type)) { 12829 + case PTR_TO_FLOW_KEYS: 12830 + if (known) 12831 + break; 12832 + fallthrough; 12829 12833 case CONST_PTR_TO_MAP: 12830 12834 /* smin_val represents the known value */ 12831 12835 if (known && smin_val == 0 && opcode == BPF_ADD)
+34 -8
net/bridge/br_netfilter_hooks.c
··· 279 279 280 280 if ((READ_ONCE(neigh->nud_state) & NUD_CONNECTED) && 281 281 READ_ONCE(neigh->hh.hh_len)) { 282 + struct net_device *br_indev; 283 + 284 + br_indev = nf_bridge_get_physindev(skb, net); 285 + if (!br_indev) { 286 + neigh_release(neigh); 287 + goto free_skb; 288 + } 289 + 282 290 neigh_hh_bridge(&neigh->hh, skb); 283 - skb->dev = nf_bridge->physindev; 291 + skb->dev = br_indev; 292 + 284 293 ret = br_handle_frame_finish(net, sk, skb); 285 294 } else { 286 295 /* the neighbour function below overwrites the complete ··· 361 352 */ 362 353 static int br_nf_pre_routing_finish(struct net *net, struct sock *sk, struct sk_buff *skb) 363 354 { 364 - struct net_device *dev = skb->dev; 355 + struct net_device *dev = skb->dev, *br_indev; 365 356 struct iphdr *iph = ip_hdr(skb); 366 357 struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb); 367 358 struct rtable *rt; 368 359 int err; 360 + 361 + br_indev = nf_bridge_get_physindev(skb, net); 362 + if (!br_indev) { 363 + kfree_skb(skb); 364 + return 0; 365 + } 369 366 370 367 nf_bridge->frag_max_size = IPCB(skb)->frag_max_size; 371 368 ··· 412 397 } else { 413 398 if (skb_dst(skb)->dev == dev) { 414 399 bridged_dnat: 415 - skb->dev = nf_bridge->physindev; 400 + skb->dev = br_indev; 416 401 nf_bridge_update_protocol(skb); 417 402 nf_bridge_push_encap_header(skb); 418 403 br_nf_hook_thresh(NF_BR_PRE_ROUTING, ··· 425 410 skb->pkt_type = PACKET_HOST; 426 411 } 427 412 } else { 428 - rt = bridge_parent_rtable(nf_bridge->physindev); 413 + rt = bridge_parent_rtable(br_indev); 429 414 if (!rt) { 430 415 kfree_skb(skb); 431 416 return 0; ··· 434 419 skb_dst_set_noref(skb, &rt->dst); 435 420 } 436 421 437 - skb->dev = nf_bridge->physindev; 422 + skb->dev = br_indev; 438 423 nf_bridge_update_protocol(skb); 439 424 nf_bridge_push_encap_header(skb); 440 425 br_nf_hook_thresh(NF_BR_PRE_ROUTING, net, sk, skb, skb->dev, NULL, ··· 471 456 } 472 457 473 458 nf_bridge->in_prerouting = 1; 474 - nf_bridge->physindev = skb->dev; 459 + nf_bridge->physinif = skb->dev->ifindex; 475 460 skb->dev = brnf_get_logical_dev(skb, skb->dev, net); 476 461 477 462 if (skb->protocol == htons(ETH_P_8021Q)) ··· 568 553 if (skb->protocol == htons(ETH_P_IPV6)) 569 554 nf_bridge->frag_max_size = IP6CB(skb)->frag_max_size; 570 555 571 - in = nf_bridge->physindev; 556 + in = nf_bridge_get_physindev(skb, net); 557 + if (!in) { 558 + kfree_skb(skb); 559 + return 0; 560 + } 572 561 if (nf_bridge->pkt_otherhost) { 573 562 skb->pkt_type = PACKET_OTHERHOST; 574 563 nf_bridge->pkt_otherhost = false; ··· 918 899 static void br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb) 919 900 { 920 901 struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb); 902 + struct net_device *br_indev; 903 + 904 + br_indev = nf_bridge_get_physindev(skb, dev_net(skb->dev)); 905 + if (!br_indev) { 906 + kfree_skb(skb); 907 + return; 908 + } 921 909 922 910 skb_pull(skb, ETH_HLEN); 923 911 nf_bridge->bridged_dnat = 0; ··· 934 908 skb_copy_to_linear_data_offset(skb, -(ETH_HLEN - ETH_ALEN), 935 909 nf_bridge->neigh_header, 936 910 ETH_HLEN - ETH_ALEN); 937 - skb->dev = nf_bridge->physindev; 911 + skb->dev = br_indev; 938 912 939 913 nf_bridge->physoutdev = NULL; 940 914 br_handle_frame_finish(dev_net(skb->dev), NULL, skb);
+10 -4
net/bridge/br_netfilter_ipv6.c
··· 102 102 { 103 103 struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb); 104 104 struct rtable *rt; 105 - struct net_device *dev = skb->dev; 105 + struct net_device *dev = skb->dev, *br_indev; 106 106 const struct nf_ipv6_ops *v6ops = nf_get_ipv6_ops(); 107 + 108 + br_indev = nf_bridge_get_physindev(skb, net); 109 + if (!br_indev) { 110 + kfree_skb(skb); 111 + return 0; 112 + } 107 113 108 114 nf_bridge->frag_max_size = IP6CB(skb)->frag_max_size; 109 115 ··· 128 122 } 129 123 130 124 if (skb_dst(skb)->dev == dev) { 131 - skb->dev = nf_bridge->physindev; 125 + skb->dev = br_indev; 132 126 nf_bridge_update_protocol(skb); 133 127 nf_bridge_push_encap_header(skb); 134 128 br_nf_hook_thresh(NF_BR_PRE_ROUTING, ··· 139 133 ether_addr_copy(eth_hdr(skb)->h_dest, dev->dev_addr); 140 134 skb->pkt_type = PACKET_HOST; 141 135 } else { 142 - rt = bridge_parent_rtable(nf_bridge->physindev); 136 + rt = bridge_parent_rtable(br_indev); 143 137 if (!rt) { 144 138 kfree_skb(skb); 145 139 return 0; ··· 148 142 skb_dst_set_noref(skb, &rt->dst); 149 143 } 150 144 151 - skb->dev = nf_bridge->physindev; 145 + skb->dev = br_indev; 152 146 nf_bridge_update_protocol(skb); 153 147 nf_bridge_push_encap_header(skb); 154 148 br_nf_hook_thresh(NF_BR_PRE_ROUTING, net, sk, skb,
+7 -7
net/core/rtnetlink.c
··· 2899 2899 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); 2900 2900 } 2901 2901 2902 - if (tb[IFLA_MASTER]) { 2903 - err = do_set_master(dev, nla_get_u32(tb[IFLA_MASTER]), extack); 2904 - if (err) 2905 - goto errout; 2906 - status |= DO_SETLINK_MODIFIED; 2907 - } 2908 - 2909 2902 if (ifm->ifi_flags || ifm->ifi_change) { 2910 2903 err = dev_change_flags(dev, rtnl_dev_combine_flags(dev, ifm), 2911 2904 extack); 2912 2905 if (err < 0) 2913 2906 goto errout; 2907 + } 2908 + 2909 + if (tb[IFLA_MASTER]) { 2910 + err = do_set_master(dev, nla_get_u32(tb[IFLA_MASTER]), extack); 2911 + if (err) 2912 + goto errout; 2913 + status |= DO_SETLINK_MODIFIED; 2914 2914 } 2915 2915 2916 2916 if (tb[IFLA_CARRIER]) {
+5 -2
net/dsa/user.c
··· 2806 2806 static int dsa_user_changeupper(struct net_device *dev, 2807 2807 struct netdev_notifier_changeupper_info *info) 2808 2808 { 2809 - struct dsa_port *dp = dsa_user_to_port(dev); 2810 2809 struct netlink_ext_ack *extack; 2811 2810 int err = NOTIFY_DONE; 2811 + struct dsa_port *dp; 2812 2812 2813 2813 if (!dsa_user_dev_check(dev)) 2814 2814 return err; 2815 2815 2816 + dp = dsa_user_to_port(dev); 2816 2817 extack = netdev_notifier_info_to_extack(&info->info); 2817 2818 2818 2819 if (netif_is_bridge_master(info->upper_dev)) { ··· 2866 2865 static int dsa_user_prechangeupper(struct net_device *dev, 2867 2866 struct netdev_notifier_changeupper_info *info) 2868 2867 { 2869 - struct dsa_port *dp = dsa_user_to_port(dev); 2868 + struct dsa_port *dp; 2870 2869 2871 2870 if (!dsa_user_dev_check(dev)) 2872 2871 return NOTIFY_DONE; 2872 + 2873 + dp = dsa_user_to_port(dev); 2873 2874 2874 2875 if (netif_is_bridge_master(info->upper_dev) && !info->linking) 2875 2876 dsa_port_pre_bridge_leave(dp, info->upper_dev);
+7 -2
net/ethtool/features.c
··· 234 234 dev = req_info.dev; 235 235 236 236 rtnl_lock(); 237 + ret = ethnl_ops_begin(dev); 238 + if (ret < 0) 239 + goto out_rtnl; 237 240 ethnl_features_to_bitmap(old_active, dev->features); 238 241 ethnl_features_to_bitmap(old_wanted, dev->wanted_features); 239 242 ret = ethnl_parse_bitset(req_wanted, req_mask, NETDEV_FEATURE_COUNT, 240 243 tb[ETHTOOL_A_FEATURES_WANTED], 241 244 netdev_features_strings, info->extack); 242 245 if (ret < 0) 243 - goto out_rtnl; 246 + goto out_ops; 244 247 if (ethnl_bitmap_to_features(req_mask) & ~NETIF_F_ETHTOOL_BITS) { 245 248 GENL_SET_ERR_MSG(info, "attempt to change non-ethtool features"); 246 249 ret = -EINVAL; 247 - goto out_rtnl; 250 + goto out_ops; 248 251 } 249 252 250 253 /* set req_wanted bits not in req_mask from old_wanted */ ··· 284 281 if (mod) 285 282 netdev_features_change(dev); 286 283 284 + out_ops: 285 + ethnl_ops_complete(dev); 287 286 out_rtnl: 288 287 rtnl_unlock(); 289 288 ethnl_parse_header_dev_put(&req_info);
+1
net/hsr/hsr_main.c
··· 167 167 168 168 module_init(hsr_init); 169 169 module_exit(hsr_exit); 170 + MODULE_DESCRIPTION("High-availability Seamless Redundancy (HSR) driver"); 170 171 MODULE_LICENSE("GPL");
+6 -3
net/ipv4/netfilter/nf_reject_ipv4.c
··· 239 239 void nf_send_reset(struct net *net, struct sock *sk, struct sk_buff *oldskb, 240 240 int hook) 241 241 { 242 - struct net_device *br_indev __maybe_unused; 243 242 struct sk_buff *nskb; 244 243 struct iphdr *niph; 245 244 const struct tcphdr *oth; ··· 288 289 * build the eth header using the original destination's MAC as the 289 290 * source, and send the RST packet directly. 290 291 */ 291 - br_indev = nf_bridge_get_physindev(oldskb); 292 - if (br_indev) { 292 + if (nf_bridge_info_exists(oldskb)) { 293 293 struct ethhdr *oeth = eth_hdr(oldskb); 294 + struct net_device *br_indev; 295 + 296 + br_indev = nf_bridge_get_physindev(oldskb, net); 297 + if (!br_indev) 298 + goto free_nskb; 294 299 295 300 nskb->dev = br_indev; 296 301 niph->tot_len = htons(nskb->len);
+16 -18
net/ipv4/udp.c
··· 805 805 806 806 if (up->pending) { 807 807 up->len = 0; 808 - up->pending = 0; 808 + WRITE_ONCE(up->pending, 0); 809 809 ip_flush_pending_frames(sk); 810 810 } 811 811 } ··· 993 993 994 994 out: 995 995 up->len = 0; 996 - up->pending = 0; 996 + WRITE_ONCE(up->pending, 0); 997 997 return err; 998 998 } 999 999 EXPORT_SYMBOL(udp_push_pending_frames); ··· 1070 1070 getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag; 1071 1071 1072 1072 fl4 = &inet->cork.fl.u.ip4; 1073 - if (up->pending) { 1073 + if (READ_ONCE(up->pending)) { 1074 1074 /* 1075 1075 * There are pending frames. 1076 1076 * The socket lock must be held while it's corked. ··· 1269 1269 fl4->saddr = saddr; 1270 1270 fl4->fl4_dport = dport; 1271 1271 fl4->fl4_sport = inet->inet_sport; 1272 - up->pending = AF_INET; 1272 + WRITE_ONCE(up->pending, AF_INET); 1273 1273 1274 1274 do_append_data: 1275 1275 up->len += ulen; ··· 1281 1281 else if (!corkreq) 1282 1282 err = udp_push_pending_frames(sk); 1283 1283 else if (unlikely(skb_queue_empty(&sk->sk_write_queue))) 1284 - up->pending = 0; 1284 + WRITE_ONCE(up->pending, 0); 1285 1285 release_sock(sk); 1286 1286 1287 1287 out: ··· 1319 1319 struct sock *sk = sock->sk; 1320 1320 struct udp_sock *up = udp_sk(sk); 1321 1321 1322 - if (!up->pending || udp_test_bit(CORK, sk)) 1322 + if (!READ_ONCE(up->pending) || udp_test_bit(CORK, sk)) 1323 1323 return; 1324 1324 1325 1325 lock_sock(sk); ··· 3137 3137 struct bpf_udp_iter_state *iter = seq->private; 3138 3138 struct udp_iter_state *state = &iter->state; 3139 3139 struct net *net = seq_file_net(seq); 3140 + int resume_bucket, resume_offset; 3140 3141 struct udp_table *udptable; 3141 3142 unsigned int batch_sks = 0; 3142 3143 bool resized = false; 3143 3144 struct sock *sk; 3144 3145 3146 + resume_bucket = state->bucket; 3147 + resume_offset = iter->offset; 3148 + 3145 3149 /* The current batch is done, so advance the bucket. */ 3146 - if (iter->st_bucket_done) { 3150 + if (iter->st_bucket_done) 3147 3151 state->bucket++; 3148 - iter->offset = 0; 3149 - } 3150 3152 3151 3153 udptable = udp_get_table_seq(seq, net); 3152 3154 ··· 3168 3166 for (; state->bucket <= udptable->mask; state->bucket++) { 3169 3167 struct udp_hslot *hslot2 = &udptable->hash2[state->bucket]; 3170 3168 3171 - if (hlist_empty(&hslot2->head)) { 3172 - iter->offset = 0; 3169 + if (hlist_empty(&hslot2->head)) 3173 3170 continue; 3174 - } 3175 3171 3172 + iter->offset = 0; 3176 3173 spin_lock_bh(&hslot2->lock); 3177 3174 udp_portaddr_for_each_entry(sk, &hslot2->head) { 3178 3175 if (seq_sk_match(seq, sk)) { 3179 3176 /* Resume from the last iterated socket at the 3180 3177 * offset in the bucket before iterator was stopped. 3181 3178 */ 3182 - if (iter->offset) { 3183 - --iter->offset; 3179 + if (state->bucket == resume_bucket && 3180 + iter->offset < resume_offset) { 3181 + ++iter->offset; 3184 3182 continue; 3185 3183 } 3186 3184 if (iter->end_sk < iter->max_sk) { ··· 3194 3192 3195 3193 if (iter->end_sk) 3196 3194 break; 3197 - 3198 - /* Reset the current bucket's offset before moving to the next bucket. */ 3199 - iter->offset = 0; 3200 3195 } 3201 3196 3202 3197 /* All done: no batch made. */ ··· 3212 3213 /* After allocating a larger batch, retry one more time to grab 3213 3214 * the whole bucket. 3214 3215 */ 3215 - state->bucket--; 3216 3216 goto again; 3217 3217 } 3218 3218 done:
+4
net/ipv6/mcast.c
··· 2722 2722 synchronize_net(); 2723 2723 mld_query_stop_work(idev); 2724 2724 mld_report_stop_work(idev); 2725 + 2726 + mutex_lock(&idev->mc_lock); 2725 2727 mld_ifc_stop_work(idev); 2726 2728 mld_gq_stop_work(idev); 2729 + mutex_unlock(&idev->mc_lock); 2730 + 2727 2731 mld_dad_stop_work(idev); 2728 2732 } 2729 2733
+8 -3
net/ipv6/netfilter/nf_reject_ipv6.c
··· 278 278 void nf_send_reset6(struct net *net, struct sock *sk, struct sk_buff *oldskb, 279 279 int hook) 280 280 { 281 - struct net_device *br_indev __maybe_unused; 282 281 struct sk_buff *nskb; 283 282 struct tcphdr _otcph; 284 283 const struct tcphdr *otcph; ··· 353 354 * build the eth header using the original destination's MAC as the 354 355 * source, and send the RST packet directly. 355 356 */ 356 - br_indev = nf_bridge_get_physindev(oldskb); 357 - if (br_indev) { 357 + if (nf_bridge_info_exists(oldskb)) { 358 358 struct ethhdr *oeth = eth_hdr(oldskb); 359 + struct net_device *br_indev; 360 + 361 + br_indev = nf_bridge_get_physindev(oldskb, net); 362 + if (!br_indev) { 363 + kfree_skb(nskb); 364 + return; 365 + } 359 366 360 367 nskb->dev = br_indev; 361 368 nskb->protocol = htons(ETH_P_IPV6);
+8 -8
net/ipv6/udp.c
··· 1135 1135 udp_flush_pending_frames(sk); 1136 1136 else if (up->pending) { 1137 1137 up->len = 0; 1138 - up->pending = 0; 1138 + WRITE_ONCE(up->pending, 0); 1139 1139 ip6_flush_pending_frames(sk); 1140 1140 } 1141 1141 } ··· 1313 1313 &inet_sk(sk)->cork.base); 1314 1314 out: 1315 1315 up->len = 0; 1316 - up->pending = 0; 1316 + WRITE_ONCE(up->pending, 0); 1317 1317 return err; 1318 1318 } 1319 1319 ··· 1370 1370 default: 1371 1371 return -EINVAL; 1372 1372 } 1373 - } else if (!up->pending) { 1373 + } else if (!READ_ONCE(up->pending)) { 1374 1374 if (sk->sk_state != TCP_ESTABLISHED) 1375 1375 return -EDESTADDRREQ; 1376 1376 daddr = &sk->sk_v6_daddr; ··· 1401 1401 return -EMSGSIZE; 1402 1402 1403 1403 getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag; 1404 - if (up->pending) { 1405 - if (up->pending == AF_INET) 1404 + if (READ_ONCE(up->pending)) { 1405 + if (READ_ONCE(up->pending) == AF_INET) 1406 1406 return udp_sendmsg(sk, msg, len); 1407 1407 /* 1408 1408 * There are pending frames. ··· 1593 1593 goto out; 1594 1594 } 1595 1595 1596 - up->pending = AF_INET6; 1596 + WRITE_ONCE(up->pending, AF_INET6); 1597 1597 1598 1598 do_append_data: 1599 1599 if (ipc6.dontfrag < 0) ··· 1607 1607 else if (!corkreq) 1608 1608 err = udp_v6_push_pending_frames(sk); 1609 1609 else if (unlikely(skb_queue_empty(&sk->sk_write_queue))) 1610 - up->pending = 0; 1610 + WRITE_ONCE(up->pending, 0); 1611 1611 1612 1612 if (err > 0) 1613 1613 err = inet6_test_bit(RECVERR6, sk) ? net_xmit_errno(err) : 0; ··· 1648 1648 struct sock *sk = sock->sk; 1649 1649 struct udp_sock *up = udp_sk(sk); 1650 1650 1651 - if (!up->pending || udp_test_bit(CORK, sk)) 1651 + if (!READ_ONCE(up->pending) || udp_test_bit(CORK, sk)) 1652 1652 return; 1653 1653 1654 1654 lock_sock(sk);
+3 -3
net/mptcp/options.c
··· 123 123 break; 124 124 125 125 case MPTCPOPT_MP_JOIN: 126 - mp_opt->suboptions |= OPTIONS_MPTCP_MPJ; 127 126 if (opsize == TCPOLEN_MPTCP_MPJ_SYN) { 127 + mp_opt->suboptions |= OPTION_MPTCP_MPJ_SYN; 128 128 mp_opt->backup = *ptr++ & MPTCPOPT_BACKUP; 129 129 mp_opt->join_id = *ptr++; 130 130 mp_opt->token = get_unaligned_be32(ptr); ··· 135 135 mp_opt->backup, mp_opt->join_id, 136 136 mp_opt->token, mp_opt->nonce); 137 137 } else if (opsize == TCPOLEN_MPTCP_MPJ_SYNACK) { 138 + mp_opt->suboptions |= OPTION_MPTCP_MPJ_SYNACK; 138 139 mp_opt->backup = *ptr++ & MPTCPOPT_BACKUP; 139 140 mp_opt->join_id = *ptr++; 140 141 mp_opt->thmac = get_unaligned_be64(ptr); ··· 146 145 mp_opt->backup, mp_opt->join_id, 147 146 mp_opt->thmac, mp_opt->nonce); 148 147 } else if (opsize == TCPOLEN_MPTCP_MPJ_ACK) { 148 + mp_opt->suboptions |= OPTION_MPTCP_MPJ_ACK; 149 149 ptr += 2; 150 150 memcpy(mp_opt->hmac, ptr, MPTCPOPT_HMAC_LEN); 151 151 pr_debug("MP_JOIN hmac"); 152 - } else { 153 - mp_opt->suboptions &= ~OPTIONS_MPTCP_MPJ; 154 152 } 155 153 break; 156 154
+9 -8
net/mptcp/subflow.c
··· 157 157 158 158 mptcp_get_options(skb, &mp_opt); 159 159 160 - opt_mp_capable = !!(mp_opt.suboptions & OPTIONS_MPTCP_MPC); 161 - opt_mp_join = !!(mp_opt.suboptions & OPTIONS_MPTCP_MPJ); 160 + opt_mp_capable = !!(mp_opt.suboptions & OPTION_MPTCP_MPC_SYN); 161 + opt_mp_join = !!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYN); 162 162 if (opt_mp_capable) { 163 163 SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_MPCAPABLEPASSIVE); 164 164 ··· 254 254 subflow_init_req(req, sk_listener); 255 255 mptcp_get_options(skb, &mp_opt); 256 256 257 - opt_mp_capable = !!(mp_opt.suboptions & OPTIONS_MPTCP_MPC); 258 - opt_mp_join = !!(mp_opt.suboptions & OPTIONS_MPTCP_MPJ); 257 + opt_mp_capable = !!(mp_opt.suboptions & OPTION_MPTCP_MPC_ACK); 258 + opt_mp_join = !!(mp_opt.suboptions & OPTION_MPTCP_MPJ_ACK); 259 259 if (opt_mp_capable && opt_mp_join) 260 260 return -EINVAL; 261 261 ··· 486 486 487 487 mptcp_get_options(skb, &mp_opt); 488 488 if (subflow->request_mptcp) { 489 - if (!(mp_opt.suboptions & OPTIONS_MPTCP_MPC)) { 489 + if (!(mp_opt.suboptions & OPTION_MPTCP_MPC_SYNACK)) { 490 490 MPTCP_INC_STATS(sock_net(sk), 491 491 MPTCP_MIB_MPCAPABLEACTIVEFALLBACK); 492 492 mptcp_do_fallback(sk); ··· 506 506 } else if (subflow->request_join) { 507 507 u8 hmac[SHA256_DIGEST_SIZE]; 508 508 509 - if (!(mp_opt.suboptions & OPTIONS_MPTCP_MPJ)) { 509 + if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYNACK)) { 510 510 subflow->reset_reason = MPTCP_RST_EMPTCP; 511 511 goto do_reset; 512 512 } ··· 783 783 * options. 784 784 */ 785 785 mptcp_get_options(skb, &mp_opt); 786 - if (!(mp_opt.suboptions & OPTIONS_MPTCP_MPC)) 786 + if (!(mp_opt.suboptions & 787 + (OPTION_MPTCP_MPC_SYN | OPTION_MPTCP_MPC_ACK))) 787 788 fallback = true; 788 789 789 790 } else if (subflow_req->mp_join) { 790 791 mptcp_get_options(skb, &mp_opt); 791 - if (!(mp_opt.suboptions & OPTIONS_MPTCP_MPJ) || 792 + if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_ACK) || 792 793 !subflow_hmac_valid(req, &mp_opt) || 793 794 !mptcp_can_accept_new_subflow(subflow_req->msk)) { 794 795 SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
+4 -4
net/netfilter/ipset/ip_set_hash_netiface.c
··· 138 138 #include "ip_set_hash_gen.h" 139 139 140 140 #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) 141 - static const char *get_physindev_name(const struct sk_buff *skb) 141 + static const char *get_physindev_name(const struct sk_buff *skb, struct net *net) 142 142 { 143 - struct net_device *dev = nf_bridge_get_physindev(skb); 143 + struct net_device *dev = nf_bridge_get_physindev(skb, net); 144 144 145 145 return dev ? dev->name : NULL; 146 146 } ··· 177 177 178 178 if (opt->cmdflags & IPSET_FLAG_PHYSDEV) { 179 179 #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) 180 - const char *eiface = SRCDIR ? get_physindev_name(skb) : 180 + const char *eiface = SRCDIR ? get_physindev_name(skb, xt_net(par)) : 181 181 get_physoutdev_name(skb); 182 182 183 183 if (!eiface) ··· 395 395 396 396 if (opt->cmdflags & IPSET_FLAG_PHYSDEV) { 397 397 #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) 398 - const char *eiface = SRCDIR ? get_physindev_name(skb) : 398 + const char *eiface = SRCDIR ? get_physindev_name(skb, xt_net(par)) : 399 399 get_physoutdev_name(skb); 400 400 401 401 if (!eiface)
+2 -2
net/netfilter/ipvs/ip_vs_xmit.c
··· 271 271 skb->dev = dst->dev; 272 272 icmpv6_send(skb, ICMPV6_TIME_EXCEED, 273 273 ICMPV6_EXC_HOPLIMIT, 0); 274 - __IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS); 274 + IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS); 275 275 276 276 return false; 277 277 } ··· 286 286 { 287 287 if (ip_hdr(skb)->ttl <= 1) { 288 288 /* Tell the sender its packet died... */ 289 - __IP_INC_STATS(net, IPSTATS_MIB_INHDRERRORS); 289 + IP_INC_STATS(net, IPSTATS_MIB_INHDRERRORS); 290 290 icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0); 291 291 return false; 292 292 }
+7 -6
net/netfilter/nf_log_syslog.c
··· 111 111 unsigned int hooknum, const struct sk_buff *skb, 112 112 const struct net_device *in, 113 113 const struct net_device *out, 114 - const struct nf_loginfo *loginfo, const char *prefix) 114 + const struct nf_loginfo *loginfo, const char *prefix, 115 + struct net *net) 115 116 { 116 117 const struct net_device *physoutdev __maybe_unused; 117 118 const struct net_device *physindev __maybe_unused; ··· 122 121 in ? in->name : "", 123 122 out ? out->name : ""); 124 123 #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) 125 - physindev = nf_bridge_get_physindev(skb); 124 + physindev = nf_bridge_get_physindev(skb, net); 126 125 if (physindev && in != physindev) 127 126 nf_log_buf_add(m, "PHYSIN=%s ", physindev->name); 128 127 physoutdev = nf_bridge_get_physoutdev(skb); ··· 149 148 loginfo = &default_loginfo; 150 149 151 150 nf_log_dump_packet_common(m, pf, hooknum, skb, in, out, loginfo, 152 - prefix); 151 + prefix, net); 153 152 dump_arp_packet(m, loginfo, skb, skb_network_offset(skb)); 154 153 155 154 nf_log_buf_close(m); ··· 846 845 loginfo = &default_loginfo; 847 846 848 847 nf_log_dump_packet_common(m, pf, hooknum, skb, in, 849 - out, loginfo, prefix); 848 + out, loginfo, prefix, net); 850 849 851 850 if (in) 852 851 dump_mac_header(m, loginfo, skb); ··· 881 880 loginfo = &default_loginfo; 882 881 883 882 nf_log_dump_packet_common(m, pf, hooknum, skb, in, out, 884 - loginfo, prefix); 883 + loginfo, prefix, net); 885 884 886 885 if (in) 887 886 dump_mac_header(m, loginfo, skb); ··· 917 916 loginfo = &default_loginfo; 918 917 919 918 nf_log_dump_packet_common(m, pf, hooknum, skb, in, out, loginfo, 920 - prefix); 919 + prefix, net); 921 920 922 921 dump_mac_header(m, loginfo, skb); 923 922
+2 -4
net/netfilter/nf_queue.c
··· 82 82 { 83 83 #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) 84 84 const struct sk_buff *skb = entry->skb; 85 - struct nf_bridge_info *nf_bridge; 86 85 87 - nf_bridge = nf_bridge_info_get(skb); 88 - if (nf_bridge) { 89 - entry->physin = nf_bridge_get_physindev(skb); 86 + if (nf_bridge_info_exists(skb)) { 87 + entry->physin = nf_bridge_get_physindev(skb, entry->state.net); 90 88 entry->physout = nf_bridge_get_physoutdev(skb); 91 89 } else { 92 90 entry->physin = NULL;
+31 -13
net/netfilter/nf_tables_api.c
··· 2977 2977 */ 2978 2978 int nft_register_expr(struct nft_expr_type *type) 2979 2979 { 2980 + if (WARN_ON_ONCE(type->maxattr > NFT_EXPR_MAXATTR)) 2981 + return -ENOMEM; 2982 + 2980 2983 nfnl_lock(NFNL_SUBSYS_NFTABLES); 2981 2984 if (type->family == NFPROTO_UNSPEC) 2982 2985 list_add_tail_rcu(&type->list, &nf_tables_expressions); ··· 3274 3271 { 3275 3272 int err; 3276 3273 3277 - if (src->ops->clone) { 3278 - dst->ops = src->ops; 3279 - err = src->ops->clone(dst, src); 3280 - if (err < 0) 3281 - return err; 3282 - } else { 3283 - memcpy(dst, src, src->ops->size); 3284 - } 3274 + if (WARN_ON_ONCE(!src->ops->clone)) 3275 + return -EINVAL; 3276 + 3277 + dst->ops = src->ops; 3278 + err = src->ops->clone(dst, src); 3279 + if (err < 0) 3280 + return err; 3285 3281 3286 3282 __module_get(src->ops->type->owner); 3287 3283 ··· 4813 4811 static int nft_set_desc_concat(struct nft_set_desc *desc, 4814 4812 const struct nlattr *nla) 4815 4813 { 4814 + u32 num_regs = 0, key_num_regs = 0; 4816 4815 struct nlattr *attr; 4817 - u32 num_regs = 0; 4818 4816 int rem, err, i; 4819 4817 4820 4818 nla_for_each_nested(attr, nla, rem) { ··· 4828 4826 4829 4827 for (i = 0; i < desc->field_count; i++) 4830 4828 num_regs += DIV_ROUND_UP(desc->field_len[i], sizeof(u32)); 4829 + 4830 + key_num_regs = DIV_ROUND_UP(desc->klen, sizeof(u32)); 4831 + if (key_num_regs != num_regs) 4832 + return -EINVAL; 4831 4833 4832 4834 if (num_regs > NFT_REG32_COUNT) 4833 4835 return -E2BIG; ··· 5054 5048 } 5055 5049 5056 5050 desc.policy = NFT_SET_POL_PERFORMANCE; 5057 - if (nla[NFTA_SET_POLICY] != NULL) 5051 + if (nla[NFTA_SET_POLICY] != NULL) { 5058 5052 desc.policy = ntohl(nla_get_be32(nla[NFTA_SET_POLICY])); 5053 + switch (desc.policy) { 5054 + case NFT_SET_POL_PERFORMANCE: 5055 + case NFT_SET_POL_MEMORY: 5056 + break; 5057 + default: 5058 + return -EOPNOTSUPP; 5059 + } 5060 + } 5059 5061 5060 5062 if (nla[NFTA_SET_DESC] != NULL) { 5061 5063 err = nf_tables_set_desc_parse(&desc, nla[NFTA_SET_DESC]); 5062 5064 if (err < 0) 5063 5065 return err; 5064 5066 5065 - if (desc.field_count > 1 && !(flags & NFT_SET_CONCAT)) 5067 + if (desc.field_count > 1) { 5068 + if (!(flags & NFT_SET_CONCAT)) 5069 + return -EINVAL; 5070 + } else if (flags & NFT_SET_CONCAT) { 5066 5071 return -EINVAL; 5072 + } 5067 5073 } else if (flags & NFT_SET_CONCAT) { 5068 5074 return -EINVAL; 5069 5075 } ··· 5722 5704 const struct nft_set_ext *ext = nft_set_elem_ext(set, elem_priv); 5723 5705 struct nft_set_dump_args *args; 5724 5706 5725 - if (nft_set_elem_expired(ext)) 5707 + if (nft_set_elem_expired(ext) || nft_set_elem_is_dead(ext)) 5726 5708 return 0; 5727 5709 5728 5710 args = container_of(iter, struct nft_set_dump_args, iter); ··· 6586 6568 6587 6569 list_for_each_entry(catchall, &set->catchall_list, list) { 6588 6570 ext = nft_set_elem_ext(set, catchall->elem); 6589 - if (!nft_is_active(net, ext)) 6571 + if (!nft_is_active_next(net, ext)) 6590 6572 continue; 6591 6573 6592 6574 kfree(elem->priv);
+12 -7
net/netfilter/nft_limit.c
··· 58 58 static int nft_limit_init(struct nft_limit_priv *priv, 59 59 const struct nlattr * const tb[], bool pkts) 60 60 { 61 + bool invert = false; 61 62 u64 unit, tokens; 62 63 63 64 if (tb[NFTA_LIMIT_RATE] == NULL || ··· 91 90 priv->rate); 92 91 } 93 92 93 + if (tb[NFTA_LIMIT_FLAGS]) { 94 + u32 flags = ntohl(nla_get_be32(tb[NFTA_LIMIT_FLAGS])); 95 + 96 + if (flags & ~NFT_LIMIT_F_INV) 97 + return -EOPNOTSUPP; 98 + 99 + if (flags & NFT_LIMIT_F_INV) 100 + invert = true; 101 + } 102 + 94 103 priv->limit = kmalloc(sizeof(*priv->limit), GFP_KERNEL_ACCOUNT); 95 104 if (!priv->limit) 96 105 return -ENOMEM; 97 106 98 107 priv->limit->tokens = tokens; 99 108 priv->tokens_max = priv->limit->tokens; 100 - 101 - if (tb[NFTA_LIMIT_FLAGS]) { 102 - u32 flags = ntohl(nla_get_be32(tb[NFTA_LIMIT_FLAGS])); 103 - 104 - if (flags & NFT_LIMIT_F_INV) 105 - priv->invert = true; 106 - } 109 + priv->invert = invert; 107 110 priv->limit->last = ktime_get_ns(); 108 111 spin_lock_init(&priv->limit->lock); 109 112
+1 -1
net/netfilter/xt_physdev.c
··· 59 59 (!!outdev ^ !(info->invert & XT_PHYSDEV_OP_BRIDGED))) 60 60 return false; 61 61 62 - physdev = nf_bridge_get_physindev(skb); 62 + physdev = nf_bridge_get_physindev(skb, xt_net(par)); 63 63 indev = physdev ? physdev->name : NULL; 64 64 65 65 if ((info->bitmask & XT_PHYSDEV_OP_ISIN &&
+1
net/nfc/digital_core.c
··· 858 858 } 859 859 EXPORT_SYMBOL(nfc_digital_unregister_device); 860 860 861 + MODULE_DESCRIPTION("NFC Digital protocol stack"); 861 862 MODULE_LICENSE("GPL");
+1
net/nfc/nci/core.c
··· 1577 1577 } 1578 1578 } 1579 1579 1580 + MODULE_DESCRIPTION("NFC Controller Interface"); 1580 1581 MODULE_LICENSE("GPL");
+1
net/nfc/nci/spi.c
··· 319 319 } 320 320 EXPORT_SYMBOL_GPL(nci_spi_read); 321 321 322 + MODULE_DESCRIPTION("NFC Controller Interface (NCI) SPI link layer"); 322 323 MODULE_LICENSE("GPL");
+1
net/rxrpc/ar-internal.h
··· 1079 1079 /* 1080 1080 * local_object.c 1081 1081 */ 1082 + void rxrpc_local_dont_fragment(const struct rxrpc_local *local, bool set); 1082 1083 struct rxrpc_local *rxrpc_lookup_local(struct net *, const struct sockaddr_rxrpc *); 1083 1084 struct rxrpc_local *rxrpc_get_local(struct rxrpc_local *, enum rxrpc_local_trace); 1084 1085 struct rxrpc_local *rxrpc_get_local_maybe(struct rxrpc_local *, enum rxrpc_local_trace);
+12 -1
net/rxrpc/local_object.c
··· 37 37 } 38 38 39 39 /* 40 + * Set or clear the Don't Fragment flag on a socket. 41 + */ 42 + void rxrpc_local_dont_fragment(const struct rxrpc_local *local, bool set) 43 + { 44 + if (set) 45 + ip_sock_set_mtu_discover(local->socket->sk, IP_PMTUDISC_DO); 46 + else 47 + ip_sock_set_mtu_discover(local->socket->sk, IP_PMTUDISC_DONT); 48 + } 49 + 50 + /* 40 51 * Compare a local to an address. Return -ve, 0 or +ve to indicate less than, 41 52 * same or greater than. 42 53 * ··· 214 203 ip_sock_set_recverr(usk); 215 204 216 205 /* we want to set the don't fragment bit */ 217 - ip_sock_set_mtu_discover(usk, IP_PMTUDISC_DO); 206 + rxrpc_local_dont_fragment(local, true); 218 207 219 208 /* We want receive timestamps. */ 220 209 sock_enable_timestamps(usk);
+2 -4
net/rxrpc/output.c
··· 494 494 switch (conn->local->srx.transport.family) { 495 495 case AF_INET6: 496 496 case AF_INET: 497 - ip_sock_set_mtu_discover(conn->local->socket->sk, 498 - IP_PMTUDISC_DONT); 497 + rxrpc_local_dont_fragment(conn->local, false); 499 498 rxrpc_inc_stat(call->rxnet, stat_tx_data_send_frag); 500 499 ret = do_udp_sendmsg(conn->local->socket, &msg, len); 501 500 conn->peer->last_tx_at = ktime_get_seconds(); 502 501 503 - ip_sock_set_mtu_discover(conn->local->socket->sk, 504 - IP_PMTUDISC_DO); 502 + rxrpc_local_dont_fragment(conn->local, true); 505 503 break; 506 504 507 505 default:
+2
net/rxrpc/rxkad.c
··· 724 724 serial = atomic_inc_return(&conn->serial); 725 725 whdr.serial = htonl(serial); 726 726 727 + rxrpc_local_dont_fragment(conn->local, false); 727 728 ret = kernel_sendmsg(conn->local->socket, &msg, iov, 3, len); 729 + rxrpc_local_dont_fragment(conn->local, true); 728 730 if (ret < 0) { 729 731 trace_rxrpc_tx_fail(conn->debug_id, serial, ret, 730 732 rxrpc_tx_point_rxkad_response);
+10 -2
net/sched/cls_api.c
··· 1424 1424 WARN_ON(1); 1425 1425 } 1426 1426 1427 + static bool tcf_block_tracks_dev(struct tcf_block *block, 1428 + struct tcf_block_ext_info *ei) 1429 + { 1430 + return tcf_block_shared(block) && 1431 + (ei->binder_type == FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS || 1432 + ei->binder_type == FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS); 1433 + } 1434 + 1427 1435 int tcf_block_get_ext(struct tcf_block **p_block, struct Qdisc *q, 1428 1436 struct tcf_block_ext_info *ei, 1429 1437 struct netlink_ext_ack *extack) ··· 1470 1462 if (err) 1471 1463 goto err_block_offload_bind; 1472 1464 1473 - if (tcf_block_shared(block)) { 1465 + if (tcf_block_tracks_dev(block, ei)) { 1474 1466 err = xa_insert(&block->ports, dev->ifindex, dev, GFP_KERNEL); 1475 1467 if (err) { 1476 1468 NL_SET_ERR_MSG(extack, "block dev insert failed"); ··· 1524 1516 1525 1517 if (!block) 1526 1518 return; 1527 - if (tcf_block_shared(block)) 1519 + if (tcf_block_tracks_dev(block, ei)) 1528 1520 xa_erase(&block->ports, dev->ifindex); 1529 1521 tcf_chain0_head_change_cb_del(block, ei); 1530 1522 tcf_block_owner_del(block, q, ei->binder_type);
+1
net/sunrpc/auth_gss/auth_gss.c
··· 2280 2280 } 2281 2281 2282 2282 MODULE_ALIAS("rpc-auth-6"); 2283 + MODULE_DESCRIPTION("Sun RPC Kerberos RPCSEC_GSS client authentication"); 2283 2284 MODULE_LICENSE("GPL"); 2284 2285 module_param_named(expired_cred_retry_delay, 2285 2286 gss_expired_cred_retry_delay,
+1
net/sunrpc/auth_gss/gss_krb5_mech.c
··· 650 650 gss_mech_unregister(&gss_kerberos_mech); 651 651 } 652 652 653 + MODULE_DESCRIPTION("Sun RPC Kerberos 5 module"); 653 654 MODULE_LICENSE("GPL"); 654 655 module_init(init_kerberos_module); 655 656 module_exit(cleanup_kerberos_module);
+1
net/sunrpc/sunrpc_syms.c
··· 148 148 #endif 149 149 rcu_barrier(); /* Wait for completion of call_rcu()'s */ 150 150 } 151 + MODULE_DESCRIPTION("Sun RPC core"); 151 152 MODULE_LICENSE("GPL"); 152 153 fs_initcall(init_sunrpc); /* Ensure we're initialised before nfs */ 153 154 module_exit(cleanup_sunrpc);
+5 -1
net/tls/tls_sw.c
··· 1052 1052 if (ret < 0) 1053 1053 goto send_end; 1054 1054 tls_ctx->pending_open_record_frags = true; 1055 - if (full_record || eor || sk_msg_full(msg_pl)) 1055 + 1056 + if (sk_msg_full(msg_pl)) 1057 + full_record = true; 1058 + 1059 + if (full_record || eor) 1056 1060 goto copied; 1057 1061 continue; 1058 1062 }
+133 -9
tools/lib/bpf/libbpf.c
··· 6695 6695 /* all other program types don't have "named" context structs */ 6696 6696 }; 6697 6697 6698 + static bool need_func_arg_type_fixup(const struct btf *btf, const struct bpf_program *prog, 6699 + const char *subprog_name, int arg_idx, 6700 + int arg_type_id, const char *ctx_name) 6701 + { 6702 + const struct btf_type *t; 6703 + const char *tname; 6704 + 6705 + /* check if existing parameter already matches verifier expectations */ 6706 + t = skip_mods_and_typedefs(btf, arg_type_id, NULL); 6707 + if (!btf_is_ptr(t)) 6708 + goto out_warn; 6709 + 6710 + /* typedef bpf_user_pt_regs_t is a special PITA case, valid for kprobe 6711 + * and perf_event programs, so check this case early on and forget 6712 + * about it for subsequent checks 6713 + */ 6714 + while (btf_is_mod(t)) 6715 + t = btf__type_by_id(btf, t->type); 6716 + if (btf_is_typedef(t) && 6717 + (prog->type == BPF_PROG_TYPE_KPROBE || prog->type == BPF_PROG_TYPE_PERF_EVENT)) { 6718 + tname = btf__str_by_offset(btf, t->name_off) ?: "<anon>"; 6719 + if (strcmp(tname, "bpf_user_pt_regs_t") == 0) 6720 + return false; /* canonical type for kprobe/perf_event */ 6721 + } 6722 + 6723 + /* now we can ignore typedefs moving forward */ 6724 + t = skip_mods_and_typedefs(btf, t->type, NULL); 6725 + 6726 + /* if it's `void *`, definitely fix up BTF info */ 6727 + if (btf_is_void(t)) 6728 + return true; 6729 + 6730 + /* if it's already proper canonical type, no need to fix up */ 6731 + tname = btf__str_by_offset(btf, t->name_off) ?: "<anon>"; 6732 + if (btf_is_struct(t) && strcmp(tname, ctx_name) == 0) 6733 + return false; 6734 + 6735 + /* special cases */ 6736 + switch (prog->type) { 6737 + case BPF_PROG_TYPE_KPROBE: 6738 + case BPF_PROG_TYPE_PERF_EVENT: 6739 + /* `struct pt_regs *` is expected, but we need to fix up */ 6740 + if (btf_is_struct(t) && strcmp(tname, "pt_regs") == 0) 6741 + return true; 6742 + break; 6743 + case BPF_PROG_TYPE_RAW_TRACEPOINT: 6744 + case BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE: 6745 + /* allow u64* as ctx */ 6746 + if (btf_is_int(t) && t->size == 8) 6747 + return true; 6748 + break; 6749 + default: 6750 + break; 6751 + } 6752 + 6753 + out_warn: 6754 + pr_warn("prog '%s': subprog '%s' arg#%d is expected to be of `struct %s *` type\n", 6755 + prog->name, subprog_name, arg_idx, ctx_name); 6756 + return false; 6757 + } 6758 + 6698 6759 static int clone_func_btf_info(struct btf *btf, int orig_fn_id, struct bpf_program *prog) 6699 6760 { 6700 6761 int fn_id, fn_proto_id, ret_type_id, orig_proto_id; ··· 6818 6757 return fn_id; 6819 6758 } 6820 6759 6760 + static int probe_kern_arg_ctx_tag(void) 6761 + { 6762 + /* To minimize merge conflicts with BPF token series that refactors 6763 + * feature detection code a lot, we don't integrate 6764 + * probe_kern_arg_ctx_tag() into kernel_supports() feature-detection 6765 + * framework yet, doing our own caching internally. 6766 + * This will be cleaned up a bit later when bpf/bpf-next trees settle. 6767 + */ 6768 + static int cached_result = -1; 6769 + static const char strs[] = "\0a\0b\0arg:ctx\0"; 6770 + const __u32 types[] = { 6771 + /* [1] INT */ 6772 + BTF_TYPE_INT_ENC(1 /* "a" */, BTF_INT_SIGNED, 0, 32, 4), 6773 + /* [2] PTR -> VOID */ 6774 + BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_PTR, 0, 0), 0), 6775 + /* [3] FUNC_PROTO `int(void *a)` */ 6776 + BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_FUNC_PROTO, 0, 1), 1), 6777 + BTF_PARAM_ENC(1 /* "a" */, 2), 6778 + /* [4] FUNC 'a' -> FUNC_PROTO (main prog) */ 6779 + BTF_TYPE_ENC(1 /* "a" */, BTF_INFO_ENC(BTF_KIND_FUNC, 0, BTF_FUNC_GLOBAL), 3), 6780 + /* [5] FUNC_PROTO `int(void *b __arg_ctx)` */ 6781 + BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_FUNC_PROTO, 0, 1), 1), 6782 + BTF_PARAM_ENC(3 /* "b" */, 2), 6783 + /* [6] FUNC 'b' -> FUNC_PROTO (subprog) */ 6784 + BTF_TYPE_ENC(3 /* "b" */, BTF_INFO_ENC(BTF_KIND_FUNC, 0, BTF_FUNC_GLOBAL), 5), 6785 + /* [7] DECL_TAG 'arg:ctx' -> func 'b' arg 'b' */ 6786 + BTF_TYPE_DECL_TAG_ENC(5 /* "arg:ctx" */, 6, 0), 6787 + }; 6788 + const struct bpf_insn insns[] = { 6789 + /* main prog */ 6790 + BPF_CALL_REL(+1), 6791 + BPF_EXIT_INSN(), 6792 + /* global subprog */ 6793 + BPF_EMIT_CALL(BPF_FUNC_get_func_ip), /* needs PTR_TO_CTX */ 6794 + BPF_EXIT_INSN(), 6795 + }; 6796 + const struct bpf_func_info_min func_infos[] = { 6797 + { 0, 4 }, /* main prog -> FUNC 'a' */ 6798 + { 2, 6 }, /* subprog -> FUNC 'b' */ 6799 + }; 6800 + LIBBPF_OPTS(bpf_prog_load_opts, opts); 6801 + int prog_fd, btf_fd, insn_cnt = ARRAY_SIZE(insns); 6802 + 6803 + if (cached_result >= 0) 6804 + return cached_result; 6805 + 6806 + btf_fd = libbpf__load_raw_btf((char *)types, sizeof(types), strs, sizeof(strs)); 6807 + if (btf_fd < 0) 6808 + return 0; 6809 + 6810 + opts.prog_btf_fd = btf_fd; 6811 + opts.func_info = &func_infos; 6812 + opts.func_info_cnt = ARRAY_SIZE(func_infos); 6813 + opts.func_info_rec_size = sizeof(func_infos[0]); 6814 + 6815 + prog_fd = bpf_prog_load(BPF_PROG_TYPE_KPROBE, "det_arg_ctx", 6816 + "GPL", insns, insn_cnt, &opts); 6817 + close(btf_fd); 6818 + 6819 + cached_result = probe_fd(prog_fd); 6820 + return cached_result; 6821 + } 6822 + 6821 6823 /* Check if main program or global subprog's function prototype has `arg:ctx` 6822 6824 * argument tags, and, if necessary, substitute correct type to match what BPF 6823 6825 * verifier would expect, taking into account specific program type. This ··· 6890 6766 */ 6891 6767 static int bpf_program_fixup_func_info(struct bpf_object *obj, struct bpf_program *prog) 6892 6768 { 6893 - const char *ctx_name = NULL, *ctx_tag = "arg:ctx"; 6769 + const char *ctx_name = NULL, *ctx_tag = "arg:ctx", *fn_name; 6894 6770 struct bpf_func_info_min *func_rec; 6895 6771 struct btf_type *fn_t, *fn_proto_t; 6896 6772 struct btf *btf = obj->btf; ··· 6902 6778 6903 6779 /* no .BTF.ext, no problem */ 6904 6780 if (!obj->btf_ext || !prog->func_info) 6781 + return 0; 6782 + 6783 + /* don't do any fix ups if kernel natively supports __arg_ctx */ 6784 + if (probe_kern_arg_ctx_tag() > 0) 6905 6785 return 0; 6906 6786 6907 6787 /* some BPF program types just don't have named context structs, so ··· 6970 6842 if (arg_idx < 0 || arg_idx >= arg_cnt) 6971 6843 continue; 6972 6844 6973 - /* check if existing parameter already matches verifier expectations */ 6845 + /* check if we should fix up argument type */ 6974 6846 p = &btf_params(fn_proto_t)[arg_idx]; 6975 - t = skip_mods_and_typedefs(btf, p->type, NULL); 6976 - if (btf_is_ptr(t) && 6977 - (t = skip_mods_and_typedefs(btf, t->type, NULL)) && 6978 - btf_is_struct(t) && 6979 - strcmp(btf__str_by_offset(btf, t->name_off), ctx_name) == 0) { 6980 - continue; /* no need for fix up */ 6981 - } 6847 + fn_name = btf__str_by_offset(btf, fn_t->name_off) ?: "<anon>"; 6848 + if (!need_func_arg_type_fixup(btf, prog, fn_name, arg_idx, p->type, ctx_name)) 6849 + continue; 6982 6850 6983 6851 /* clone fn/fn_proto, unless we already did it for another arg */ 6984 6852 if (func_rec->type_id == orig_fn_id) {
+135
tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Copyright (c) 2024 Meta 3 + 4 + #include <test_progs.h> 5 + #include "network_helpers.h" 6 + #include "sock_iter_batch.skel.h" 7 + 8 + #define TEST_NS "sock_iter_batch_netns" 9 + 10 + static const int nr_soreuse = 4; 11 + 12 + static void do_test(int sock_type, bool onebyone) 13 + { 14 + int err, i, nread, to_read, total_read, iter_fd = -1; 15 + int first_idx, second_idx, indices[nr_soreuse]; 16 + struct bpf_link *link = NULL; 17 + struct sock_iter_batch *skel; 18 + int *fds[2] = {}; 19 + 20 + skel = sock_iter_batch__open(); 21 + if (!ASSERT_OK_PTR(skel, "sock_iter_batch__open")) 22 + return; 23 + 24 + /* Prepare 2 buckets of sockets in the kernel hashtable */ 25 + for (i = 0; i < ARRAY_SIZE(fds); i++) { 26 + int local_port; 27 + 28 + fds[i] = start_reuseport_server(AF_INET6, sock_type, "::1", 0, 0, 29 + nr_soreuse); 30 + if (!ASSERT_OK_PTR(fds[i], "start_reuseport_server")) 31 + goto done; 32 + local_port = get_socket_local_port(*fds[i]); 33 + if (!ASSERT_GE(local_port, 0, "get_socket_local_port")) 34 + goto done; 35 + skel->rodata->ports[i] = ntohs(local_port); 36 + } 37 + 38 + err = sock_iter_batch__load(skel); 39 + if (!ASSERT_OK(err, "sock_iter_batch__load")) 40 + goto done; 41 + 42 + link = bpf_program__attach_iter(sock_type == SOCK_STREAM ? 43 + skel->progs.iter_tcp_soreuse : 44 + skel->progs.iter_udp_soreuse, 45 + NULL); 46 + if (!ASSERT_OK_PTR(link, "bpf_program__attach_iter")) 47 + goto done; 48 + 49 + iter_fd = bpf_iter_create(bpf_link__fd(link)); 50 + if (!ASSERT_GE(iter_fd, 0, "bpf_iter_create")) 51 + goto done; 52 + 53 + /* Test reading a bucket (either from fds[0] or fds[1]). 54 + * Only read "nr_soreuse - 1" number of sockets 55 + * from a bucket and leave one socket out from 56 + * that bucket on purpose. 57 + */ 58 + to_read = (nr_soreuse - 1) * sizeof(*indices); 59 + total_read = 0; 60 + first_idx = -1; 61 + do { 62 + nread = read(iter_fd, indices, onebyone ? sizeof(*indices) : to_read); 63 + if (nread <= 0 || nread % sizeof(*indices)) 64 + break; 65 + total_read += nread; 66 + 67 + if (first_idx == -1) 68 + first_idx = indices[0]; 69 + for (i = 0; i < nread / sizeof(*indices); i++) 70 + ASSERT_EQ(indices[i], first_idx, "first_idx"); 71 + } while (total_read < to_read); 72 + ASSERT_EQ(nread, onebyone ? sizeof(*indices) : to_read, "nread"); 73 + ASSERT_EQ(total_read, to_read, "total_read"); 74 + 75 + free_fds(fds[first_idx], nr_soreuse); 76 + fds[first_idx] = NULL; 77 + 78 + /* Read the "whole" second bucket */ 79 + to_read = nr_soreuse * sizeof(*indices); 80 + total_read = 0; 81 + second_idx = !first_idx; 82 + do { 83 + nread = read(iter_fd, indices, onebyone ? sizeof(*indices) : to_read); 84 + if (nread <= 0 || nread % sizeof(*indices)) 85 + break; 86 + total_read += nread; 87 + 88 + for (i = 0; i < nread / sizeof(*indices); i++) 89 + ASSERT_EQ(indices[i], second_idx, "second_idx"); 90 + } while (total_read <= to_read); 91 + ASSERT_EQ(nread, 0, "nread"); 92 + /* Both so_reuseport ports should be in different buckets, so 93 + * total_read must equal to the expected to_read. 94 + * 95 + * For a very unlikely case, both ports collide at the same bucket, 96 + * the bucket offset (i.e. 3) will be skipped and it cannot 97 + * expect the to_read number of bytes. 98 + */ 99 + if (skel->bss->bucket[0] != skel->bss->bucket[1]) 100 + ASSERT_EQ(total_read, to_read, "total_read"); 101 + 102 + done: 103 + for (i = 0; i < ARRAY_SIZE(fds); i++) 104 + free_fds(fds[i], nr_soreuse); 105 + if (iter_fd < 0) 106 + close(iter_fd); 107 + bpf_link__destroy(link); 108 + sock_iter_batch__destroy(skel); 109 + } 110 + 111 + void test_sock_iter_batch(void) 112 + { 113 + struct nstoken *nstoken = NULL; 114 + 115 + SYS_NOFAIL("ip netns del " TEST_NS " &> /dev/null"); 116 + SYS(done, "ip netns add %s", TEST_NS); 117 + SYS(done, "ip -net %s link set dev lo up", TEST_NS); 118 + 119 + nstoken = open_netns(TEST_NS); 120 + if (!ASSERT_OK_PTR(nstoken, "open_netns")) 121 + goto done; 122 + 123 + if (test__start_subtest("tcp")) { 124 + do_test(SOCK_STREAM, true); 125 + do_test(SOCK_STREAM, false); 126 + } 127 + if (test__start_subtest("udp")) { 128 + do_test(SOCK_DGRAM, true); 129 + do_test(SOCK_DGRAM, false); 130 + } 131 + close_netns(nstoken); 132 + 133 + done: 134 + SYS_NOFAIL("ip netns del " TEST_NS " &> /dev/null"); 135 + }
+13
tools/testing/selftests/bpf/prog_tests/test_global_funcs.c
··· 47 47 struct btf *btf = NULL; 48 48 __u32 info_len = sizeof(info); 49 49 int err, fd, i; 50 + struct btf *kern_btf = NULL; 51 + 52 + kern_btf = btf__load_vmlinux_btf(); 53 + if (!ASSERT_OK_PTR(kern_btf, "kern_btf_load")) 54 + return; 55 + 56 + /* simple detection of kernel native arg:ctx tag support */ 57 + if (btf__find_by_name_kind(kern_btf, "bpf_subprog_arg_info", BTF_KIND_STRUCT) > 0) { 58 + test__skip(); 59 + btf__free(kern_btf); 60 + return; 61 + } 62 + btf__free(kern_btf); 50 63 51 64 skel = test_global_func_ctx_args__open(); 52 65 if (!ASSERT_OK_PTR(skel, "skel_open"))
+3
tools/testing/selftests/bpf/progs/bpf_tracing_net.h
··· 72 72 #define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr 73 73 #define inet_dport sk.__sk_common.skc_dport 74 74 75 + #define udp_portaddr_hash inet.sk.__sk_common.skc_u16hashes[1] 76 + 75 77 #define ir_loc_addr req.__req_common.skc_rcv_saddr 76 78 #define ir_num req.__req_common.skc_num 77 79 #define ir_rmt_addr req.__req_common.skc_daddr ··· 87 85 #define sk_rmem_alloc sk_backlog.rmem_alloc 88 86 #define sk_refcnt __sk_common.skc_refcnt 89 87 #define sk_state __sk_common.skc_state 88 + #define sk_net __sk_common.skc_net 90 89 #define sk_v6_daddr __sk_common.skc_v6_daddr 91 90 #define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr 92 91 #define sk_flags __sk_common.skc_flags
+91
tools/testing/selftests/bpf/progs/sock_iter_batch.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Copyright (c) 2024 Meta 3 + 4 + #include "vmlinux.h" 5 + #include <bpf/bpf_helpers.h> 6 + #include <bpf/bpf_core_read.h> 7 + #include <bpf/bpf_endian.h> 8 + #include "bpf_tracing_net.h" 9 + #include "bpf_kfuncs.h" 10 + 11 + #define ATTR __always_inline 12 + #include "test_jhash.h" 13 + 14 + static bool ipv6_addr_loopback(const struct in6_addr *a) 15 + { 16 + return (a->s6_addr32[0] | a->s6_addr32[1] | 17 + a->s6_addr32[2] | (a->s6_addr32[3] ^ bpf_htonl(1))) == 0; 18 + } 19 + 20 + volatile const __u16 ports[2]; 21 + unsigned int bucket[2]; 22 + 23 + SEC("iter/tcp") 24 + int iter_tcp_soreuse(struct bpf_iter__tcp *ctx) 25 + { 26 + struct sock *sk = (struct sock *)ctx->sk_common; 27 + struct inet_hashinfo *hinfo; 28 + unsigned int hash; 29 + struct net *net; 30 + int idx; 31 + 32 + if (!sk) 33 + return 0; 34 + 35 + sk = bpf_rdonly_cast(sk, bpf_core_type_id_kernel(struct sock)); 36 + if (sk->sk_family != AF_INET6 || 37 + sk->sk_state != TCP_LISTEN || 38 + !ipv6_addr_loopback(&sk->sk_v6_rcv_saddr)) 39 + return 0; 40 + 41 + if (sk->sk_num == ports[0]) 42 + idx = 0; 43 + else if (sk->sk_num == ports[1]) 44 + idx = 1; 45 + else 46 + return 0; 47 + 48 + /* bucket selection as in inet_lhash2_bucket_sk() */ 49 + net = sk->sk_net.net; 50 + hash = jhash2(sk->sk_v6_rcv_saddr.s6_addr32, 4, net->hash_mix); 51 + hash ^= sk->sk_num; 52 + hinfo = net->ipv4.tcp_death_row.hashinfo; 53 + bucket[idx] = hash & hinfo->lhash2_mask; 54 + bpf_seq_write(ctx->meta->seq, &idx, sizeof(idx)); 55 + 56 + return 0; 57 + } 58 + 59 + #define udp_sk(ptr) container_of(ptr, struct udp_sock, inet.sk) 60 + 61 + SEC("iter/udp") 62 + int iter_udp_soreuse(struct bpf_iter__udp *ctx) 63 + { 64 + struct sock *sk = (struct sock *)ctx->udp_sk; 65 + struct udp_table *udptable; 66 + int idx; 67 + 68 + if (!sk) 69 + return 0; 70 + 71 + sk = bpf_rdonly_cast(sk, bpf_core_type_id_kernel(struct sock)); 72 + if (sk->sk_family != AF_INET6 || 73 + !ipv6_addr_loopback(&sk->sk_v6_rcv_saddr)) 74 + return 0; 75 + 76 + if (sk->sk_num == ports[0]) 77 + idx = 0; 78 + else if (sk->sk_num == ports[1]) 79 + idx = 1; 80 + else 81 + return 0; 82 + 83 + /* bucket selection as in udp_hashslot2() */ 84 + udptable = sk->sk_net.net->ipv4.udp_table; 85 + bucket[idx] = udp_sk(sk)->udp_portaddr_hash & udptable->mask; 86 + bpf_seq_write(ctx->meta->seq, &idx, sizeof(idx)); 87 + 88 + return 0; 89 + } 90 + 91 + char _license[] SEC("license") = "GPL";
+31
tools/testing/selftests/bpf/progs/test_jhash.h
··· 69 69 70 70 return c; 71 71 } 72 + 73 + static __always_inline u32 jhash2(const u32 *k, u32 length, u32 initval) 74 + { 75 + u32 a, b, c; 76 + 77 + /* Set up the internal state */ 78 + a = b = c = JHASH_INITVAL + (length<<2) + initval; 79 + 80 + /* Handle most of the key */ 81 + while (length > 3) { 82 + a += k[0]; 83 + b += k[1]; 84 + c += k[2]; 85 + __jhash_mix(a, b, c); 86 + length -= 3; 87 + k += 3; 88 + } 89 + 90 + /* Handle the last 3 u32's */ 91 + switch (length) { 92 + case 3: c += k[2]; 93 + case 2: b += k[1]; 94 + case 1: a += k[0]; 95 + __jhash_final(a, b, c); 96 + break; 97 + case 0: /* Nothing left to add */ 98 + break; 99 + } 100 + 101 + return c; 102 + }
+161 -3
tools/testing/selftests/bpf/progs/verifier_global_subprogs.c
··· 3 3 4 4 #include <vmlinux.h> 5 5 #include <bpf/bpf_helpers.h> 6 + #include <bpf/bpf_tracing.h> 6 7 #include "bpf_misc.h" 7 8 #include "xdp_metadata.h" 8 9 #include "bpf_kfuncs.h" ··· 139 138 return bpf_get_stack(ctx, stack, sizeof(stack), 0); 140 139 } 141 140 141 + __weak int raw_tp_canonical(struct bpf_raw_tracepoint_args *ctx __arg_ctx) 142 + { 143 + return 0; 144 + } 145 + 146 + __weak int raw_tp_u64_array(u64 *ctx __arg_ctx) 147 + { 148 + return 0; 149 + } 150 + 142 151 SEC("?raw_tp") 143 152 __success __log_level(2) 144 153 int arg_tag_ctx_raw_tp(void *ctx) 145 154 { 146 - return subprog_ctx_tag(ctx); 155 + return subprog_ctx_tag(ctx) + raw_tp_canonical(ctx) + raw_tp_u64_array(ctx); 156 + } 157 + 158 + SEC("?raw_tp.w") 159 + __success __log_level(2) 160 + int arg_tag_ctx_raw_tp_writable(void *ctx) 161 + { 162 + return subprog_ctx_tag(ctx) + raw_tp_canonical(ctx) + raw_tp_u64_array(ctx); 163 + } 164 + 165 + SEC("?tp_btf/sys_enter") 166 + __success __log_level(2) 167 + int arg_tag_ctx_raw_tp_btf(void *ctx) 168 + { 169 + return subprog_ctx_tag(ctx) + raw_tp_canonical(ctx) + raw_tp_u64_array(ctx); 170 + } 171 + 172 + struct whatever { }; 173 + 174 + __weak int tp_whatever(struct whatever *ctx __arg_ctx) 175 + { 176 + return 0; 147 177 } 148 178 149 179 SEC("?tp") 150 180 __success __log_level(2) 151 181 int arg_tag_ctx_tp(void *ctx) 152 182 { 153 - return subprog_ctx_tag(ctx); 183 + return subprog_ctx_tag(ctx) + tp_whatever(ctx); 184 + } 185 + 186 + __weak int kprobe_subprog_pt_regs(struct pt_regs *ctx __arg_ctx) 187 + { 188 + return 0; 189 + } 190 + 191 + __weak int kprobe_subprog_typedef(bpf_user_pt_regs_t *ctx __arg_ctx) 192 + { 193 + return 0; 154 194 } 155 195 156 196 SEC("?kprobe") 157 197 __success __log_level(2) 158 198 int arg_tag_ctx_kprobe(void *ctx) 159 199 { 160 - return subprog_ctx_tag(ctx); 200 + return subprog_ctx_tag(ctx) + 201 + kprobe_subprog_pt_regs(ctx) + 202 + kprobe_subprog_typedef(ctx); 203 + } 204 + 205 + __weak int perf_subprog_regs( 206 + #if defined(bpf_target_riscv) 207 + struct user_regs_struct *ctx __arg_ctx 208 + #elif defined(bpf_target_s390) 209 + /* user_pt_regs typedef is anonymous struct, so only `void *` works */ 210 + void *ctx __arg_ctx 211 + #elif defined(bpf_target_loongarch) || defined(bpf_target_arm64) || defined(bpf_target_powerpc) 212 + struct user_pt_regs *ctx __arg_ctx 213 + #else 214 + struct pt_regs *ctx __arg_ctx 215 + #endif 216 + ) 217 + { 218 + return 0; 219 + } 220 + 221 + __weak int perf_subprog_typedef(bpf_user_pt_regs_t *ctx __arg_ctx) 222 + { 223 + return 0; 224 + } 225 + 226 + __weak int perf_subprog_canonical(struct bpf_perf_event_data *ctx __arg_ctx) 227 + { 228 + return 0; 229 + } 230 + 231 + SEC("?perf_event") 232 + __success __log_level(2) 233 + int arg_tag_ctx_perf(void *ctx) 234 + { 235 + return subprog_ctx_tag(ctx) + 236 + perf_subprog_regs(ctx) + 237 + perf_subprog_typedef(ctx) + 238 + perf_subprog_canonical(ctx); 239 + } 240 + 241 + __weak int iter_subprog_void(void *ctx __arg_ctx) 242 + { 243 + return 0; 244 + } 245 + 246 + __weak int iter_subprog_typed(struct bpf_iter__task *ctx __arg_ctx) 247 + { 248 + return 0; 249 + } 250 + 251 + SEC("?iter/task") 252 + __success __log_level(2) 253 + int arg_tag_ctx_iter_task(struct bpf_iter__task *ctx) 254 + { 255 + return (iter_subprog_void(ctx) + iter_subprog_typed(ctx)) & 1; 256 + } 257 + 258 + __weak int tracing_subprog_void(void *ctx __arg_ctx) 259 + { 260 + return 0; 261 + } 262 + 263 + __weak int tracing_subprog_u64(u64 *ctx __arg_ctx) 264 + { 265 + return 0; 266 + } 267 + 268 + int acc; 269 + 270 + SEC("?fentry/" SYS_PREFIX "sys_nanosleep") 271 + __success __log_level(2) 272 + int BPF_PROG(arg_tag_ctx_fentry) 273 + { 274 + acc += tracing_subprog_void(ctx) + tracing_subprog_u64(ctx); 275 + return 0; 276 + } 277 + 278 + SEC("?fexit/" SYS_PREFIX "sys_nanosleep") 279 + __success __log_level(2) 280 + int BPF_PROG(arg_tag_ctx_fexit) 281 + { 282 + acc += tracing_subprog_void(ctx) + tracing_subprog_u64(ctx); 283 + return 0; 284 + } 285 + 286 + SEC("?fmod_ret/" SYS_PREFIX "sys_nanosleep") 287 + __success __log_level(2) 288 + int BPF_PROG(arg_tag_ctx_fmod_ret) 289 + { 290 + return tracing_subprog_void(ctx) + tracing_subprog_u64(ctx); 291 + } 292 + 293 + SEC("?lsm/bpf") 294 + __success __log_level(2) 295 + int BPF_PROG(arg_tag_ctx_lsm) 296 + { 297 + return tracing_subprog_void(ctx) + tracing_subprog_u64(ctx); 298 + } 299 + 300 + SEC("?struct_ops/test_1") 301 + __success __log_level(2) 302 + int BPF_PROG(arg_tag_ctx_struct_ops) 303 + { 304 + return tracing_subprog_void(ctx) + tracing_subprog_u64(ctx); 305 + } 306 + 307 + SEC(".struct_ops") 308 + struct bpf_dummy_ops dummy_1 = { 309 + .test_1 = (void *)arg_tag_ctx_struct_ops, 310 + }; 311 + 312 + SEC("?syscall") 313 + __success __log_level(2) 314 + int arg_tag_ctx_syscall(void *ctx) 315 + { 316 + return tracing_subprog_void(ctx) + tracing_subprog_u64(ctx) + tp_whatever(ctx); 161 317 } 162 318 163 319 __weak int subprog_dynptr(struct bpf_dynptr *dptr)
+19
tools/testing/selftests/bpf/progs/verifier_value_illegal_alu.c
··· 146 146 : __clobber_all); 147 147 } 148 148 149 + SEC("flow_dissector") 150 + __description("flow_keys illegal alu op with variable offset") 151 + __failure __msg("R7 pointer arithmetic on flow_keys prohibited") 152 + __naked void flow_keys_illegal_variable_offset_alu(void) 153 + { 154 + asm volatile(" \ 155 + r6 = r1; \ 156 + r7 = *(u64*)(r6 + %[flow_keys_off]); \ 157 + r8 = 8; \ 158 + r8 /= 1; \ 159 + r8 &= 8; \ 160 + r7 += r8; \ 161 + r0 = *(u64*)(r7 + 0); \ 162 + exit; \ 163 + " : 164 + : __imm_const(flow_keys_off, offsetof(struct __sk_buff, flow_keys)) 165 + : __clobber_all); 166 + } 167 + 149 168 char _license[] SEC("license") = "GPL";
+8
tools/testing/selftests/drivers/net/bonding/config
··· 1 1 CONFIG_BONDING=y 2 + CONFIG_BRIDGE=y 3 + CONFIG_DUMMY=y 4 + CONFIG_IPV6=y 2 5 CONFIG_MACVLAN=y 6 + CONFIG_NET_ACT_GACT=y 7 + CONFIG_NET_CLS_FLOWER=y 8 + CONFIG_NET_SCH_INGRESS=y 9 + CONFIG_NLMON=y 10 + CONFIG_VETH=y
+1 -1
tools/testing/selftests/drivers/net/bonding/mode-1-recovery-updelay.sh
··· 1 - #!/bin/sh 1 + #!/bin/bash 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 4 # Regression Test:
+1 -1
tools/testing/selftests/drivers/net/bonding/mode-2-recovery-updelay.sh
··· 1 - #!/bin/sh 1 + #!/bin/bash 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 4 # Regression Test:
+17 -2
tools/testing/selftests/drivers/net/mlxsw/qos_pfc.sh
··· 40 40 # | + $swp1 $swp3 + + $swp4 | 41 41 # | | iPOOL1 iPOOL0 | | iPOOL2 | 42 42 # | | ePOOL4 ePOOL5 | | ePOOL4 | 43 - # | | 1Gbps | | 1Gbps | 44 43 # | | PFC:enabled=1 | | PFC:enabled=1 | 45 44 # | +-|----------------------|-+ +-|------------------------+ | 46 45 # | | + $swp1.111 $swp3.111 + | | + $swp4.111 | | ··· 119 120 120 121 switch_create() 121 122 { 123 + local lanes_swp4 124 + local pg1_size 125 + 122 126 # pools 123 127 # ----- 124 128 ··· 231 229 dcb pfc set dev $swp4 prio-pfc all:off 1:on 232 230 # PG0 will get autoconfigured to Xoff, give PG1 arbitrarily 100K, which 233 231 # is (-2*MTU) about 80K of delay provision. 234 - dcb buffer set dev $swp4 buffer-size all:0 1:$_100KB 232 + pg1_size=$_100KB 233 + 234 + setup_wait_dev_with_timeout $swp4 235 + 236 + lanes_swp4=$(ethtool $swp4 | grep 'Lanes:') 237 + lanes_swp4=${lanes_swp4#*"Lanes: "} 238 + 239 + # 8-lane ports use two buffers among which the configured buffer 240 + # is split, so double the size to get twice (20K + 80K). 241 + if [[ $lanes_swp4 -eq 8 ]]; then 242 + pg1_size=$((pg1_size * 2)) 243 + fi 244 + 245 + dcb buffer set dev $swp4 buffer-size all:0 1:$pg1_size 235 246 236 247 # bridges 237 248 # -------
+105 -1
tools/testing/selftests/drivers/net/mlxsw/spectrum-2/tc_flower.sh
··· 10 10 ALL_TESTS="single_mask_test identical_filters_test two_masks_test \ 11 11 multiple_masks_test ctcam_edge_cases_test delta_simple_test \ 12 12 delta_two_masks_one_key_test delta_simple_rehash_test \ 13 - bloom_simple_test bloom_complex_test bloom_delta_test" 13 + bloom_simple_test bloom_complex_test bloom_delta_test \ 14 + max_erp_entries_test max_group_size_test" 14 15 NUM_NETIFS=2 15 16 source $lib_dir/lib.sh 16 17 source $lib_dir/tc_common.sh ··· 982 981 tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower 983 982 984 983 log_test "bloom delta test ($tcflags)" 984 + } 985 + 986 + max_erp_entries_test() 987 + { 988 + # The number of eRP entries is limited. Once the maximum number of eRPs 989 + # has been reached, filters cannot be added. This test verifies that 990 + # when this limit is reached, inserstion fails without crashing. 991 + 992 + RET=0 993 + 994 + local num_masks=32 995 + local num_regions=15 996 + local chain_failed 997 + local mask_failed 998 + local ret 999 + 1000 + if [[ "$tcflags" != "skip_sw" ]]; then 1001 + return 0; 1002 + fi 1003 + 1004 + for ((i=1; i < $num_regions; i++)); do 1005 + for ((j=$num_masks; j >= 0; j--)); do 1006 + tc filter add dev $h2 ingress chain $i protocol ip \ 1007 + pref $i handle $j flower $tcflags \ 1008 + dst_ip 192.1.0.0/$j &> /dev/null 1009 + ret=$? 1010 + 1011 + if [ $ret -ne 0 ]; then 1012 + chain_failed=$i 1013 + mask_failed=$j 1014 + break 2 1015 + fi 1016 + done 1017 + done 1018 + 1019 + # We expect to exceed the maximum number of eRP entries, so that 1020 + # insertion eventually fails. Otherwise, the test should be adjusted to 1021 + # add more filters. 1022 + check_fail $ret "expected to exceed number of eRP entries" 1023 + 1024 + for ((; i >= 1; i--)); do 1025 + for ((j=0; j <= $num_masks; j++)); do 1026 + tc filter del dev $h2 ingress chain $i protocol ip \ 1027 + pref $i handle $j flower &> /dev/null 1028 + done 1029 + done 1030 + 1031 + log_test "max eRP entries test ($tcflags). " \ 1032 + "max chain $chain_failed, mask $mask_failed" 1033 + } 1034 + 1035 + max_group_size_test() 1036 + { 1037 + # The number of ACLs in an ACL group is limited. Once the maximum 1038 + # number of ACLs has been reached, filters cannot be added. This test 1039 + # verifies that when this limit is reached, insertion fails without 1040 + # crashing. 1041 + 1042 + RET=0 1043 + 1044 + local num_acls=32 1045 + local max_size 1046 + local ret 1047 + 1048 + if [[ "$tcflags" != "skip_sw" ]]; then 1049 + return 0; 1050 + fi 1051 + 1052 + for ((i=1; i < $num_acls; i++)); do 1053 + if [[ $(( i % 2 )) == 1 ]]; then 1054 + tc filter add dev $h2 ingress pref $i proto ipv4 \ 1055 + flower $tcflags dst_ip 198.51.100.1/32 \ 1056 + ip_proto tcp tcp_flags 0x01/0x01 \ 1057 + action drop &> /dev/null 1058 + else 1059 + tc filter add dev $h2 ingress pref $i proto ipv6 \ 1060 + flower $tcflags dst_ip 2001:db8:1::1/128 \ 1061 + action drop &> /dev/null 1062 + fi 1063 + 1064 + ret=$? 1065 + [[ $ret -ne 0 ]] && max_size=$((i - 1)) && break 1066 + done 1067 + 1068 + # We expect to exceed the maximum number of ACLs in a group, so that 1069 + # insertion eventually fails. Otherwise, the test should be adjusted to 1070 + # add more filters. 1071 + check_fail $ret "expected to exceed number of ACLs in a group" 1072 + 1073 + for ((; i >= 1; i--)); do 1074 + if [[ $(( i % 2 )) == 1 ]]; then 1075 + tc filter del dev $h2 ingress pref $i proto ipv4 \ 1076 + flower $tcflags dst_ip 198.51.100.1/32 \ 1077 + ip_proto tcp tcp_flags 0x01/0x01 \ 1078 + action drop &> /dev/null 1079 + else 1080 + tc filter del dev $h2 ingress pref $i proto ipv6 \ 1081 + flower $tcflags dst_ip 2001:db8:1::1/128 \ 1082 + action drop &> /dev/null 1083 + fi 1084 + done 1085 + 1086 + log_test "max ACL group size test ($tcflags). max size $max_size" 985 1087 } 986 1088 987 1089 setup_prepare()
+10
tools/testing/selftests/drivers/net/netdevsim/config
··· 1 + CONFIG_DUMMY=y 2 + CONFIG_GENEVE=m 3 + CONFIG_IPV6=y 4 + CONFIG_NETDEVSIM=m 5 + CONFIG_NET_SCH_MQPRIO=y 6 + CONFIG_NET_SCH_MULTIQ=y 7 + CONFIG_NET_SCH_PRIO=y 8 + CONFIG_PSAMPLE=y 9 + CONFIG_PTP_1588_CLOCK_MOCK=y 10 + CONFIG_VXLAN=m
+1
tools/testing/selftests/drivers/net/netdevsim/ethtool-common.sh
··· 51 51 fi 52 52 53 53 echo $NSIM_ID $@ > /sys/bus/netdevsim/new_device 54 + udevadm settle 54 55 # get new device name 55 56 ls /sys/bus/netdevsim/devices/netdevsim${NSIM_ID}/net/ 56 57 }
+11 -7
tools/testing/selftests/drivers/net/netdevsim/ethtool-fec.sh
··· 8 8 9 9 set -o pipefail 10 10 11 + # Since commit 2b3ddcb35357 ("ethtool: fec: Change the prompt ...") 12 + # in ethtool CLI the Configured lines start with Supported/Configured. 13 + configured=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2 | head -1 | cut -d' ' -f1) 14 + 11 15 # netdevsim starts out with None/None 12 16 s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2) 13 - check $? "$s" "Configured FEC encodings: None 17 + check $? "$s" "$configured FEC encodings: None 14 18 Active FEC encoding: None" 15 19 16 20 # Test Auto 17 21 $ETHTOOL --set-fec $NSIM_NETDEV encoding auto 18 22 check $? 19 23 s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2) 20 - check $? "$s" "Configured FEC encodings: Auto 24 + check $? "$s" "$configured FEC encodings: Auto 21 25 Active FEC encoding: Off" 22 26 23 27 # Test case in-sensitivity ··· 29 25 $ETHTOOL --set-fec $NSIM_NETDEV encoding $o 30 26 check $? 31 27 s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2) 32 - check $? "$s" "Configured FEC encodings: Off 28 + check $? "$s" "$configured FEC encodings: Off 33 29 Active FEC encoding: Off" 34 30 done 35 31 ··· 37 33 $ETHTOOL --set-fec $NSIM_NETDEV encoding $o 38 34 check $? 39 35 s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2) 40 - check $? "$s" "Configured FEC encodings: BaseR 36 + check $? "$s" "$configured FEC encodings: BaseR 41 37 Active FEC encoding: BaseR" 42 38 done 43 39 ··· 45 41 $ETHTOOL --set-fec $NSIM_NETDEV encoding $o 46 42 check $? 47 43 s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2) 48 - check $? "$s" "Configured FEC encodings: ${o^^} 44 + check $? "$s" "$configured FEC encodings: ${o^^} 49 45 Active FEC encoding: ${o^^}" 50 46 done 51 47 ··· 53 49 $ETHTOOL --set-fec $NSIM_NETDEV encoding rs llrs 54 50 check $? 55 51 s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2) 56 - check $? "$s" "Configured FEC encodings: RS LLRS 52 + check $? "$s" "$configured FEC encodings: RS LLRS 57 53 Active FEC encoding: LLRS" 58 54 59 55 $ETHTOOL --set-fec $NSIM_NETDEV encoding rs off auto 60 56 check $? 61 57 s=$($ETHTOOL --show-fec $NSIM_NETDEV | tail -2) 62 - check $? "$s" "Configured FEC encodings: Auto Off RS 58 + check $? "$s" "$configured FEC encodings: Auto Off RS 63 59 Active FEC encoding: RS" 64 60 65 61 # Make sure other link modes are rejected
+1
tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh
··· 233 233 function get_netdev_name { 234 234 local -n old=$1 235 235 236 + udevadm settle 236 237 new=$(ls /sys/class/net) 237 238 238 239 for netdev in $new; do
tools/testing/selftests/net/forwarding/lib.sh
+26
tools/testing/selftests/net/rtnetlink.sh
··· 28 28 kci_test_neigh_get 29 29 kci_test_bridge_parent_id 30 30 kci_test_address_proto 31 + kci_test_enslave_bonding 31 32 " 32 33 33 34 devdummy="test-dummy0" ··· 1240 1239 check_err $? 1241 1240 1242 1241 return $ret 1242 + } 1243 + 1244 + kci_test_enslave_bonding() 1245 + { 1246 + local bond="bond123" 1247 + local ret=0 1248 + 1249 + setup_ns testns 1250 + if [ $? -ne 0 ]; then 1251 + end_test "SKIP bonding tests: cannot add net namespace $testns" 1252 + return $ksft_skip 1253 + fi 1254 + 1255 + run_cmd ip -netns $testns link add dev $bond type bond mode balance-rr 1256 + run_cmd ip -netns $testns link add dev $devdummy type dummy 1257 + run_cmd ip -netns $testns link set dev $devdummy up 1258 + run_cmd ip -netns $testns link set dev $devdummy master $bond down 1259 + if [ $ret -ne 0 ]; then 1260 + end_test "FAIL: initially up interface added to a bond and set down" 1261 + ip netns del "$testns" 1262 + return 1 1263 + fi 1264 + 1265 + end_test "PASS: enslave interface in a bond" 1266 + ip netns del "$testns" 1243 1267 } 1244 1268 1245 1269 kci_test_rtnl()
+2 -2
tools/testing/selftests/net/tcp_ao/Makefile
··· 52 52 53 53 $(OUTPUT)/icmps-accept_ipv4: CFLAGS+= -DTEST_ICMPS_ACCEPT 54 54 $(OUTPUT)/icmps-accept_ipv6: CFLAGS+= -DTEST_ICMPS_ACCEPT 55 - $(OUTPUT)/bench-lookups_ipv4: LDFLAGS+= -lm 56 - $(OUTPUT)/bench-lookups_ipv6: LDFLAGS+= -lm 55 + $(OUTPUT)/bench-lookups_ipv4: LDLIBS+= -lm 56 + $(OUTPUT)/bench-lookups_ipv6: LDLIBS+= -lm
+14
tools/testing/selftests/net/tls.c
··· 707 707 EXPECT_EQ(memcmp(mem_send, mem_recv, send_len), 0); 708 708 } 709 709 710 + TEST_F(tls, splice_more) 711 + { 712 + unsigned int f = SPLICE_F_NONBLOCK | SPLICE_F_MORE | SPLICE_F_GIFT; 713 + int send_len = TLS_PAYLOAD_MAX_LEN; 714 + char mem_send[TLS_PAYLOAD_MAX_LEN]; 715 + int i, send_pipe = 1; 716 + int p[2]; 717 + 718 + ASSERT_GE(pipe(p), 0); 719 + EXPECT_GE(write(p[1], mem_send, send_len), 0); 720 + for (i = 0; i < 32; i++) 721 + EXPECT_EQ(splice(p[0], NULL, self->fd, NULL, send_pipe, f), 1); 722 + } 723 + 710 724 TEST_F(tls, splice_from_pipe2) 711 725 { 712 726 int send_len = 16000;