History

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

Pull networking fixes from Jakub Kicinski: "Including fixes from bpf, can and netfilter. Current release - regressions: - bpf: do not reject when the stack read size is different from the tracked scalar size - net: fix premature exit from NAPI state polling in napi_disable() - riscv, bpf: fix RV32 broken build, and silence RV64 warning Current release - new code bugs: - net: fix possible NULL deref in sock_reserve_memory - amt: fix error return code in amt_init(); fix stopping the workqueue - ax88796c: use the correct ioctl callback Previous releases - always broken: - bpf: stop caching subprog index in the bpf_pseudo_func insn - security: fixups for the security hooks in sctp - nfc: add necessary privilege flags in netlink layer, limit operations to admin only - vsock: prevent unnecessary refcnt inc for non-blocking connect - net/smc: fix sk_refcnt underflow on link down and fallback - nfnetlink_queue: fix OOB when mac header was cleared - can: j1939: ignore invalid messages per standard - bpf, sockmap: - fix race in ingress receive verdict with redirect to self - fix incorrect sk_skb data_end access when src_reg = dst_reg - strparser, and tls are reusing qdisc_skb_cb and colliding - ethtool: fix ethtool msg len calculation for pause stats - vlan: fix a UAF in vlan_dev_real_dev() when ref-holder tries to access an unregistering real_dev - udp6: make encap_rcv() bump the v6 not v4 stats - drv: prestera: add explicit padding to fix m68k build - drv: felix: fix broken VLAN-tagged PTP under VLAN-aware bridge - drv: mvpp2: fix wrong SerDes reconfiguration order Misc & small latecomers: - ipvs: auto-load ipvs on genl access - mctp: sanity check the struct sockaddr_mctp padding fields - libfs: support RENAME_EXCHANGE in simple_rename() - avoid double accounting for pure zerocopy skbs" * tag 'net-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (123 commits) selftests/net: udpgso_bench_rx: fix port argument net: wwan: iosm: fix compilation warning cxgb4: fix eeprom len when diagnostics not implemented net: fix premature exit from NAPI state polling in napi_disable() net/smc: fix sk_refcnt underflow on linkdown and fallback net/mlx5: Lag, fix a potential Oops with mlx5_lag_create_definer() gve: fix unmatched u64_stats_update_end() net: ethernet: lantiq_etop: Fix compilation error selftests: forwarding: Fix packet matching in mirroring selftests vsock: prevent unnecessary refcnt inc for nonblocking connect net: marvell: mvpp2: Fix wrong SerDes reconfiguration order net: ethernet: ti: cpsw_ale: Fix access to un-initialized memory net: stmmac: allow a tc-taprio base-time of zero selftests: net: test_vxlan_under_vrf: fix HV connectivity test net: hns3: allow configure ETS bandwidth of all TCs net: hns3: remove check VF uc mac exist when set by PF net: hns3: fix some mac statistics is always 0 in device version V2 net: hns3: fix kernel crash when unload VF while it is being reset net: hns3: sync rx ring head in echo common pull net: hns3: fix pfc packet number incorrect after querying pfc parameters ...

Linus Torvalds committed 5 years ago

Commit f54ca912 parents c55a041 d336509134 files · +1242 −730Browse files

Showing the changes to include (14 of 134 files). Show all

Unified · Split

14 files
  1. include/linux/bpf.h +6 −0
  2. include/linux/dsa/ocelot.h +1 −0
  3. include/linux/ethtool_netlink.h +3 −0
  4. include/linux/fs.h +2 −0
  5. include/linux/lsm_hook_defs.h +4 −2
  6. include/linux/lsm_hooks.h +9 −4
  7. include/linux/security.h +12 −5
  8. include/linux/skbuff.h +34 −1
  9. include/linux/skmsg.h +12 −0
  10. include/net/llc.h +3 −1
  11. include/net/sctp/structs.h +10 −10
  12. include/net/strparser.h +19 −1
  13. include/net/tcp.h +6 −2
  14. include/uapi/linux/ethtool_netlink.h +3 −1
include/linux/bpf.h+6−0
@@ -484,6 +484,12 @@ bpf_ctx_record_field_size(struct bpf_insn_access_aux *aux, u32 size) · 483 unmodified lines
484484 aux->ctx_field_size = size;
485485 }
486486
487+static inline bool bpf_pseudo_func(const struct bpf_insn *insn)
488+{
489+ return insn->code == (BPF_LD | BPF_IMM | BPF_DW) &&
490+ insn->src_reg == BPF_PSEUDO_FUNC;
491+}
492+
487493 struct bpf_prog_ops {
488494 int (*test_run)(struct bpf_prog *prog, const union bpf_attr *kattr,
489495 union bpf_attr __user *uattr);
include/linux/dsa/ocelot.h+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 struct ocelot_skb_cb {
1313 struct sk_buff *clone;
1414 unsigned int ptp_class; /* valid only for clones */
15+ u32 tstamp_lo;
1516 u8 ptp_cmd;
1617 u8 ts_id;
1718 };
include/linux/ethtool_netlink.h+3−0
@@ -10,6 +10,9 @@ · 9 unmodified lines
1010 #define __ETHTOOL_LINK_MODE_MASK_NWORDS \
1111 DIV_ROUND_UP(__ETHTOOL_LINK_MODE_MASK_NBITS, 32)
1212
13+#define ETHTOOL_PAUSE_STAT_CNT (__ETHTOOL_A_PAUSE_STAT_CNT - \
14+ ETHTOOL_A_PAUSE_STAT_TX_FRAMES)
15+
1316 enum ethtool_multicast_groups {
1417 ETHNL_MCGRP_MONITOR,
1518 };
include/linux/fs.h+2−0
@@ -3385,6 +3385,8 @@ extern int simple_open(struct inode *inode, struct file *file); · 3384 unmodified lines
33853385 extern int simple_link(struct dentry *, struct inode *, struct dentry *);
33863386 extern int simple_unlink(struct inode *, struct dentry *);
33873387 extern int simple_rmdir(struct inode *, struct dentry *);
3388+extern int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
3389+ struct inode *new_dir, struct dentry *new_dentry);
33883390 extern int simple_rename(struct user_namespace *, struct inode *,
33893391 struct dentry *, struct inode *, struct dentry *,
33903392 unsigned int);
include/linux/lsm_hook_defs.h+4−2
@@ -329,12 +329,14 @@ LSM_HOOK(int, 0, tun_dev_create, void) · 328 unmodified lines
329329 LSM_HOOK(int, 0, tun_dev_attach_queue, void *security)
330330 LSM_HOOK(int, 0, tun_dev_attach, struct sock *sk, void *security)
331331 LSM_HOOK(int, 0, tun_dev_open, void *security)
332−LSM_HOOK(int, 0, sctp_assoc_request, struct sctp_endpoint *ep,
332+LSM_HOOK(int, 0, sctp_assoc_request, struct sctp_association *asoc,
333333 struct sk_buff *skb)
334334 LSM_HOOK(int, 0, sctp_bind_connect, struct sock *sk, int optname,
335335 struct sockaddr *address, int addrlen)
336−LSM_HOOK(void, LSM_RET_VOID, sctp_sk_clone, struct sctp_endpoint *ep,
336+LSM_HOOK(void, LSM_RET_VOID, sctp_sk_clone, struct sctp_association *asoc,
337337 struct sock *sk, struct sock *newsk)
338+LSM_HOOK(void, LSM_RET_VOID, sctp_assoc_established, struct sctp_association *asoc,
339+ struct sk_buff *skb)
338340 #endif /* CONFIG_SECURITY_NETWORK */
339341
340342 #ifdef CONFIG_SECURITY_INFINIBAND
include/linux/lsm_hooks.h+9−4
@@ -1027,9 +1027,9 @@ · 1026 unmodified lines
10271027 * Security hooks for SCTP
10281028 *
10291029 * @sctp_assoc_request:
1030− * Passes the @ep and @chunk->skb of the association INIT packet to
1030+ * Passes the @asoc and @chunk->skb of the association INIT packet to
10311031 * the security module.
1032− * @ep pointer to sctp endpoint structure.
1032+ * @asoc pointer to sctp association structure.
10331033 * @skb pointer to skbuff of association packet.
10341034 * Return 0 on success, error on failure.
10351035 * @sctp_bind_connect:
@@ -1047,9 +1047,14 @@ · 11 unmodified lines
10471047 * Called whenever a new socket is created by accept(2) (i.e. a TCP
10481048 * style socket) or when a socket is 'peeled off' e.g userspace
10491049 * calls sctp_peeloff(3).
1050− * @ep pointer to current sctp endpoint structure.
1050+ * @asoc pointer to current sctp association structure.
10511051 * @sk pointer to current sock structure.
1052− * @sk pointer to new sock structure.
1052+ * @newsk pointer to new sock structure.
1053+ * @sctp_assoc_established:
1054+ * Passes the @asoc and @chunk->skb of the association COOKIE_ACK packet
1055+ * to the security module.
1056+ * @asoc pointer to sctp association structure.
1057+ * @skb pointer to skbuff of association packet.
10531058 *
10541059 * Security hooks for Infiniband
10551060 *
include/linux/security.h+12−5
@@ -179,7 +179,7 @@ struct xfrm_policy; · 178 unmodified lines
179179 struct xfrm_state;
180180 struct xfrm_user_sec_ctx;
181181 struct seq_file;
182−struct sctp_endpoint;
182+struct sctp_association;
183183
184184 #ifdef CONFIG_MMU
185185 extern unsigned long mmap_min_addr;
@@ -1425,11 +1425,13 @@ int security_tun_dev_create(void); · 1239 unmodified lines
14251425 int security_tun_dev_attach_queue(void *security);
14261426 int security_tun_dev_attach(struct sock *sk, void *security);
14271427 int security_tun_dev_open(void *security);
1428−int security_sctp_assoc_request(struct sctp_endpoint *ep, struct sk_buff *skb);
1428+int security_sctp_assoc_request(struct sctp_association *asoc, struct sk_buff *skb);
14291429 int security_sctp_bind_connect(struct sock *sk, int optname,
14301430 struct sockaddr *address, int addrlen);
1431−void security_sctp_sk_clone(struct sctp_endpoint *ep, struct sock *sk,
1431+void security_sctp_sk_clone(struct sctp_association *asoc, struct sock *sk,
14321432 struct sock *newsk);
1433+void security_sctp_assoc_established(struct sctp_association *asoc,
1434+ struct sk_buff *skb);
14331435
14341436 #else /* CONFIG_SECURITY_NETWORK */
14351437 static inline int security_unix_stream_connect(struct sock *sock,
@@ -1631,7 +1633,7 @@ static inline int security_tun_dev_open(void *security) · 195 unmodified lines
16311633 return 0;
16321634 }
16331635
1634−static inline int security_sctp_assoc_request(struct sctp_endpoint *ep,
1636+static inline int security_sctp_assoc_request(struct sctp_association *asoc,
16351637 struct sk_buff *skb)
16361638 {
16371639 return 0;
@@ -1644,11 +1646,16 @@ static inline int security_sctp_bind_connect(struct sock *sk, int optname, · 6 unmodified lines
16441646 return 0;
16451647 }
16461648
1647−static inline void security_sctp_sk_clone(struct sctp_endpoint *ep,
1649+static inline void security_sctp_sk_clone(struct sctp_association *asoc,
16481650 struct sock *sk,
16491651 struct sock *newsk)
16501652 {
16511653 }
1654+
1655+static inline void security_sctp_assoc_established(struct sctp_association *asoc,
1656+ struct sk_buff *skb)
1657+{
1658+}
16521659 #endif /* CONFIG_SECURITY_NETWORK */
16531660
16541661 #ifdef CONFIG_SECURITY_INFINIBAND
include/linux/skbuff.h+34−1
@@ -454,9 +454,15 @@ enum { · 453 unmodified lines
454454 * all frags to avoid possible bad checksum
455455 */
456456 SKBFL_SHARED_FRAG = BIT(1),
457+
458+ /* segment contains only zerocopy data and should not be
459+ * charged to the kernel memory.
460+ */
461+ SKBFL_PURE_ZEROCOPY = BIT(2),
457462 };
458463
459464 #define SKBFL_ZEROCOPY_FRAG (SKBFL_ZEROCOPY_ENABLE | SKBFL_SHARED_FRAG)
465+#define SKBFL_ALL_ZEROCOPY (SKBFL_ZEROCOPY_FRAG | SKBFL_PURE_ZEROCOPY)
460466
461467 /*
462468 * The callback notifies userspace to release buffers when skb DMA is done in
@@ -1464,6 +1470,17 @@ static inline struct ubuf_info *skb_zcopy(struct sk_buff *skb) · 1001 unmodified lines
14641470 return is_zcopy ? skb_uarg(skb) : NULL;
14651471 }
14661472
1473+static inline bool skb_zcopy_pure(const struct sk_buff *skb)
1474+{
1475+ return skb_shinfo(skb)->flags & SKBFL_PURE_ZEROCOPY;
1476+}
1477+
1478+static inline bool skb_pure_zcopy_same(const struct sk_buff *skb1,
1479+ const struct sk_buff *skb2)
1480+{
1481+ return skb_zcopy_pure(skb1) == skb_zcopy_pure(skb2);
1482+}
1483+
14671484 static inline void net_zcopy_get(struct ubuf_info *uarg)
14681485 {
14691486 refcount_inc(&uarg->refcnt);
@@ -1528,7 +1545,7 @@ static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy_success) · 58 unmodified lines
15281545 if (!skb_zcopy_is_nouarg(skb))
15291546 uarg->callback(skb, uarg, zerocopy_success);
15301547
1531− skb_shinfo(skb)->flags &= ~SKBFL_ZEROCOPY_FRAG;
1548+ skb_shinfo(skb)->flags &= ~SKBFL_ALL_ZEROCOPY;
15321549 }
15331550 }
15341551
@@ -1675,6 +1692,22 @@ static inline int skb_unclone(struct sk_buff *skb, gfp_t pri) · 140 unmodified lines
16751692 return 0;
16761693 }
16771694
1695+/* This variant of skb_unclone() makes sure skb->truesize is not changed */
1696+static inline int skb_unclone_keeptruesize(struct sk_buff *skb, gfp_t pri)
1697+{
1698+ might_sleep_if(gfpflags_allow_blocking(pri));
1699+
1700+ if (skb_cloned(skb)) {
1701+ unsigned int save = skb->truesize;
1702+ int res;
1703+
1704+ res = pskb_expand_head(skb, 0, 0, pri);
1705+ skb->truesize = save;
1706+ return res;
1707+ }
1708+ return 0;
1709+}
1710+
16781711 /**
16791712 * skb_header_cloned - is the header a clone
16801713 * @skb: buffer to check
include/linux/skmsg.h+12−0
@@ -507,6 +507,18 @@ static inline bool sk_psock_strp_enabled(struct sk_psock *psock) · 506 unmodified lines
507507 return !!psock->saved_data_ready;
508508 }
509509
510+static inline bool sk_is_tcp(const struct sock *sk)
511+{
512+ return sk->sk_type == SOCK_STREAM &&
513+ sk->sk_protocol == IPPROTO_TCP;
514+}
515+
516+static inline bool sk_is_udp(const struct sock *sk)
517+{
518+ return sk->sk_type == SOCK_DGRAM &&
519+ sk->sk_protocol == IPPROTO_UDP;
520+}
521+
510522 #if IS_ENABLED(CONFIG_NET_SOCK_MSG)
511523
512524 #define BPF_F_STRPARSER (1UL << 1)
include/net/llc.h+3−1
@@ -72,7 +72,9 @@ struct llc_sap { · 71 unmodified lines
7272 static inline
7373 struct hlist_head *llc_sk_dev_hash(struct llc_sap *sap, int ifindex)
7474 {
75− return &sap->sk_dev_hash[ifindex % LLC_SK_DEV_HASH_ENTRIES];
75+ u32 bucket = hash_32(ifindex, LLC_SK_DEV_HASH_BITS);
76+
77+ return &sap->sk_dev_hash[bucket];
7678 }
7779
7880 static inline
include/net/sctp/structs.h+10−10
@@ -1355,16 +1355,6 @@ struct sctp_endpoint { · 1354 unmodified lines
13551355 reconf_enable:1;
13561356
13571357 __u8 strreset_enable;
1358−
1359− /* Security identifiers from incoming (INIT). These are set by
1360− * security_sctp_assoc_request(). These will only be used by
1361− * SCTP TCP type sockets and peeled off connections as they
1362− * cause a new socket to be generated. security_sctp_sk_clone()
1363− * will then plug these into the new socket.
1364− */
1365−
1366− u32 secid;
1367− u32 peer_secid;
13681358 };
13691359
13701360 /* Recover the outter endpoint structure. */
@@ -2104,6 +2094,16 @@ struct sctp_association { · 733 unmodified lines
21042094 __u64 abandoned_unsent[SCTP_PR_INDEX(MAX) + 1];
21052095 __u64 abandoned_sent[SCTP_PR_INDEX(MAX) + 1];
21062096
2097+ /* Security identifiers from incoming (INIT). These are set by
2098+ * security_sctp_assoc_request(). These will only be used by
2099+ * SCTP TCP type sockets and peeled off connections as they
2100+ * cause a new socket to be generated. security_sctp_sk_clone()
2101+ * will then plug these into the new socket.
2102+ */
2103+
2104+ u32 secid;
2105+ u32 peer_secid;
2106+
21072107 struct rcu_head rcu;
21082108 };
21092109
include/net/strparser.h+19−1
@@ -54,10 +54,28 @@ struct strp_msg { · 53 unmodified lines
5454 int offset;
5555 };
5656
57+struct _strp_msg {
58+ /* Internal cb structure. struct strp_msg must be first for passing
59+ * to upper layer.
60+ */
61+ struct strp_msg strp;
62+ int accum_len;
63+};
64+
65+struct sk_skb_cb {
66+#define SK_SKB_CB_PRIV_LEN 20
67+ unsigned char data[SK_SKB_CB_PRIV_LEN];
68+ struct _strp_msg strp;
69+ /* temp_reg is a temporary register used for bpf_convert_data_end_access
70+ * when dst_reg == src_reg.
71+ */
72+ u64 temp_reg;
73+};
74+
5775 static inline struct strp_msg *strp_msg(struct sk_buff *skb)
5876 {
5977 return (struct strp_msg *)((void *)skb->cb +
60− offsetof(struct qdisc_skb_cb, data));
78+ offsetof(struct sk_skb_cb, strp));
6179 }
6280
6381 /* Structure for an attached lower socket */
include/net/tcp.h+6−2
@@ -293,7 +293,10 @@ static inline bool tcp_out_of_memory(struct sock *sk) · 292 unmodified lines
293293 static inline void tcp_wmem_free_skb(struct sock *sk, struct sk_buff *skb)
294294 {
295295 sk_wmem_queued_add(sk, -skb->truesize);
296− sk_mem_uncharge(sk, skb->truesize);
296+ if (!skb_zcopy_pure(skb))
297+ sk_mem_uncharge(sk, skb->truesize);
298+ else
299+ sk_mem_uncharge(sk, SKB_TRUESIZE(skb_end_offset(skb)));
297300 __kfree_skb(skb);
298301 }
299302
@@ -974,7 +977,8 @@ static inline bool tcp_skb_can_collapse(const struct sk_buff *to, · 674 unmodified lines
974977 const struct sk_buff *from)
975978 {
976979 return likely(tcp_skb_can_collapse_to(to) &&
977− mptcp_skb_can_collapse(to, from));
980+ mptcp_skb_can_collapse(to, from) &&
981+ skb_pure_zcopy_same(to, from));
978982 }
979983
980984 /* Events passed to congestion control interface */
include/uapi/linux/ethtool_netlink.h+3−1
@@ -411,7 +411,9 @@ enum { · 410 unmodified lines
411411 ETHTOOL_A_PAUSE_STAT_TX_FRAMES,
412412 ETHTOOL_A_PAUSE_STAT_RX_FRAMES,
413413
414− /* add new constants above here */
414+ /* add new constants above here
415+ * adjust ETHTOOL_PAUSE_STAT_CNT if adding non-stats!
416+ */
415417 __ETHTOOL_A_PAUSE_STAT_CNT,
416418 ETHTOOL_A_PAUSE_STAT_MAX = (__ETHTOOL_A_PAUSE_STAT_CNT - 1)
417419 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t