* [PATCH net v4 03/12] bonding: fix unexpected IFF_BONDING bit unset
From: Taehee Yoo @ 2019-09-28 16:48 UTC (permalink / raw)
To: davem, netdev, linux-wireless, jakub.kicinski, johannes,
j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm, manishc,
rahulv, kys, haiyangz, stephen, sashal, hare, varun, ubraun,
kgraul, jay.vosburgh, schuffelen, bjorn
Cc: ap420073
In-Reply-To: <20190928164843.31800-1-ap420073@gmail.com>
The IFF_BONDING means bonding master or bonding slave device.
->ndo_add_slave() sets IFF_BONDING flag and ->ndo_del_slave() unsets
IFF_BONDING flag.
bond0<--bond1
Both bond0 and bond1 are bonding device and these should keep having
IFF_BONDING flag until they are removed.
But bond1 would lose IFF_BONDING at ->ndo_del_slave() because that routine
do not check whether the slave device is the bonding type or not.
This patch adds the interface type check routine before removing
IFF_BONDING flag.
Test commands:
ip link add bond0 type bond
ip link add bond1 type bond
ip link set bond1 master bond0
ip link set bond1 nomaster
ip link del bond1 type bond
ip link add bond1 type bond
Splat looks like:
[ 38.843933] proc_dir_entry 'bonding/bond1' already registered
[ 38.844741] WARNING: CPU: 1 PID: 631 at fs/proc/generic.c:361 proc_register+0x2a9/0x3e0
[ 38.845741] Modules linked in: bonding ip_tables x_tables
[ 38.846432] CPU: 1 PID: 631 Comm: ip Not tainted 5.3.0+ #3
[ 38.847234] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[ 38.848489] RIP: 0010:proc_register+0x2a9/0x3e0
[ 38.849164] Code: 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 39 01 00 00 48 8b 04 24 48 89 ea 48 c7 c7 e0 2b 34 b3 48 8b b0 e
0 00 00 00 e8 c7 b6 89 ff <0f> 0b 48 c7 c7 40 3d c5 b3 e8 99 7a 38 01 48 8b 4c 24 10 48 b8 00
[ 38.851317] RSP: 0018:ffff888061527078 EFLAGS: 00010282
[ 38.851902] RAX: dffffc0000000008 RBX: ffff888064dc8cb0 RCX: ffffffffb1d252a2
[ 38.852684] RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffff88806cbf6b8c
[ 38.853464] RBP: ffff888064dc8f33 R08: ffffed100d980019 R09: ffffed100d980019
[ 38.854242] R10: 0000000000000001 R11: ffffed100d980018 R12: ffff888064dc8e48
[ 38.855929] R13: ffff888064dc8f32 R14: dffffc0000000000 R15: ffffed100c9b91e6
[ 38.856695] FS: 00007fc9fcc230c0(0000) GS:ffff88806ca00000(0000) knlGS:0000000000000000
[ 38.857541] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 38.858150] CR2: 000055948b91c118 CR3: 0000000057110006 CR4: 00000000000606e0
[ 38.858957] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 38.859785] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 38.860700] Call Trace:
[ 38.861004] proc_create_seq_private+0xb3/0xf0
[ 38.861460] bond_create_proc_entry+0x1b3/0x3f0 [bonding]
[ 38.862113] bond_netdev_event+0x433/0x970 [bonding]
[ 38.862762] ? __module_text_address+0x13/0x140
[ 38.867678] notifier_call_chain+0x90/0x160
[ 38.868257] register_netdevice+0x9b3/0xd80
[ 38.868791] ? alloc_netdev_mqs+0x854/0xc10
[ 38.869335] ? netdev_change_features+0xa0/0xa0
[ 38.869852] ? rtnl_create_link+0x2ed/0xad0
[ 38.870423] bond_newlink+0x2a/0x60 [bonding]
[ 38.870935] __rtnl_newlink+0xb9f/0x11b0
[ ... ]
Fixes: 0b680e753724 ("[PATCH] bonding: Add priv_flag to avoid event mishandling")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v2 -> v4 :
- This patch is not changed
v1 -> v2 :
- Do not add a new priv_flag.
drivers/net/bonding/bond_main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 931d9d935686..0db12fcfc953 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1816,7 +1816,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
slave_disable_netpoll(new_slave);
err_close:
- slave_dev->priv_flags &= ~IFF_BONDING;
+ if (!netif_is_bond_master(slave_dev))
+ slave_dev->priv_flags &= ~IFF_BONDING;
dev_close(slave_dev);
err_restore_mac:
@@ -2017,7 +2018,8 @@ static int __bond_release_one(struct net_device *bond_dev,
else
dev_set_mtu(slave_dev, slave->original_mtu);
- slave_dev->priv_flags &= ~IFF_BONDING;
+ if (!netif_is_bond_master(slave_dev))
+ slave_dev->priv_flags &= ~IFF_BONDING;
bond_free_slave(slave);
--
2.17.1
^ permalink raw reply related
* [PATCH net v4 01/12] net: core: limit nested device depth
From: Taehee Yoo @ 2019-09-28 16:48 UTC (permalink / raw)
To: davem, netdev, linux-wireless, jakub.kicinski, johannes,
j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm, manishc,
rahulv, kys, haiyangz, stephen, sashal, hare, varun, ubraun,
kgraul, jay.vosburgh, schuffelen, bjorn
Cc: ap420073
In-Reply-To: <20190928164843.31800-1-ap420073@gmail.com>
Current code doesn't limit the number of nested devices.
Nested devices would be handled recursively and this needs huge stack
memory. So, unlimited nested devices could make stack overflow.
This patch adds upper_level and lower_level, they are common variables
and represent maximum lower/upper depth.
When upper/lower device is attached or dettached,
{lower/upper}_level are updated. and if maximum depth is bigger than 8,
attach routine fails and returns -EMLINK.
In addition, this patch converts recursive routine of
netdev_walk_all_{lower/upper} to iterator routine.
Test commands:
ip link add dummy0 type dummy
ip link add link dummy0 name vlan1 type vlan id 1
ip link set vlan1 up
for i in {2..200}
do
let A=$i-1
ip link add vlan$i link vlan$A type vlan id $i
done
ip link del vlan1
Splat looks like:
[ 923.102992] Thread overran stack, or stack corrupted
[ 923.103471] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI
[ 923.104086] CPU: 0 PID: 1597 Comm: ip Not tainted 5.3.0+ #3
[ 923.104771] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[ 923.108837] RIP: 0010:stack_depot_fetch+0x10/0x30
[ 923.109470] Code: 00 75 10 48 8b 73 18 48 89 ef 5b 5d e9 79 b1 83 ff 0f 0b e8 92 96 97 ff eb e9 89 f8 c1 ef 11 25 ff 0
[ 923.111775] RSP: 0018:ffff8880541ceb78 EFLAGS: 00010006
[ 923.112452] RAX: 00000000001fffff RBX: ffff8880541cee88 RCX: 0000000000000000
[ 923.113399] RDX: 000000000000001d RSI: ffff8880541ceb80 RDI: 0000000000003ff0
[ 923.114284] RBP: ffffea0001507380 R08: ffffed100d8fdf23 R09: ffffed100d8fdf23
[ 923.115183] R10: 0000000000000001 R11: ffffed100d8fdf22 R12: ffff88806c240880
[ 923.115986] R13: ffff8880541cec98 R14: ffff8880541cee88 R15: ffff8880541ced20
[ 923.120477] FS: 00007ff38ab4f0c0(0000) GS:ffff88806c600000(0000) knlGS:0000000000000000
[ 923.121486] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 923.122451] CR2: ffffffffa5be5658 CR3: 0000000053532004 CR4: 00000000000606f0
[ 923.123303] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 923.128422] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 923.129399] Call Trace:
[ 923.129710] Modules linked in: 8021q dummy ip_tables x_tables
[ 923.130518] CR2: ffffffffa5be5658
[ 923.130909] ---[ end trace 9568b7d36ab26094 ]---
[ 923.131457] RIP: 0010:stack_depot_fetch+0x10/0x30
[ 923.132006] Code: 00 75 10 48 8b 73 18 48 89 ef 5b 5d e9 79 b1 83 ff 0f 0b e8 92 96 97 ff eb e9 89 f8 c1 ef 11 25 ff 0
[ 923.134219] RSP: 0018:ffff8880541ceb78 EFLAGS: 00010006
[ 923.134834] RAX: 00000000001fffff RBX: ffff8880541cee88 RCX: 0000000000000000
[ 923.135664] RDX: 000000000000001d RSI: ffff8880541ceb80 RDI: 0000000000003ff0
[ 923.136514] RBP: ffffea0001507380 R08: ffffed100d8fdf23 R09: ffffed100d8fdf23
[ 923.137276] R10: 0000000000000001 R11: ffffed100d8fdf22 R12: ffff88806c240880
[ 923.138025] R13: ffff8880541cec98 R14: ffff8880541cee88 R15: ffff8880541ced20
[ 923.138773] FS: 00007ff38ab4f0c0(0000) GS:ffff88806c600000(0000) knlGS:0000000000000000
[ 923.140099] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 923.140763] CR2: ffffffffa5be5658 CR3: 0000000053532004 CR4: 00000000000606f0
[ 923.141539] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 923.144930] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 923.145942] Kernel panic - not syncing: Fatal exception
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v3 -> v4 :
- This patch is not changed
v2 -> v3 :
- Modify nesting infra code to use iterator instead of recursive
v1 -> v2 :
- This patch is not changed
include/linux/netdevice.h | 4 +
net/core/dev.c | 286 ++++++++++++++++++++++++++++++++------
2 files changed, 245 insertions(+), 45 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9eda1c31d1f7..613007aa5986 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1637,6 +1637,8 @@ enum netdev_priv_flags {
* @type: Interface hardware type
* @hard_header_len: Maximum hardware header length.
* @min_header_len: Minimum hardware header length
+ * @upper_level: Maximum depth level of upper devices.
+ * @lower_level: Maximum depth level of lower devices.
*
* @needed_headroom: Extra headroom the hardware may need, but not in all
* cases can this be guaranteed
@@ -1867,6 +1869,8 @@ struct net_device {
unsigned short type;
unsigned short hard_header_len;
unsigned char min_header_len;
+ unsigned char upper_level;
+ unsigned char lower_level;
unsigned short needed_headroom;
unsigned short needed_tailroom;
diff --git a/net/core/dev.c b/net/core/dev.c
index bf3ed413abaf..13cb646fb98f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -146,6 +146,7 @@
#include "net-sysfs.h"
#define MAX_GRO_SKBS 8
+#define MAX_NEST_DEV 8
/* This should be increased if a protocol with a bigger head is added. */
#define GRO_MAX_HEAD (MAX_HEADER + 128)
@@ -6644,6 +6645,21 @@ struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
}
EXPORT_SYMBOL(netdev_upper_get_next_dev_rcu);
+static struct net_device *netdev_next_upper_dev(struct net_device *dev,
+ struct list_head **iter)
+{
+ struct netdev_adjacent *upper;
+
+ upper = list_entry((*iter)->next, struct netdev_adjacent, list);
+
+ if (&upper->list == &dev->adj_list.upper)
+ return NULL;
+
+ *iter = &upper->list;
+
+ return upper->dev;
+}
+
static struct net_device *netdev_next_upper_dev_rcu(struct net_device *dev,
struct list_head **iter)
{
@@ -6661,31 +6677,103 @@ static struct net_device *netdev_next_upper_dev_rcu(struct net_device *dev,
return upper->dev;
}
+int netdev_walk_all_upper_dev(struct net_device *dev,
+ int (*fn)(struct net_device *dev,
+ void *data),
+ void *data)
+{
+ struct net_device *udev, *next, *now, *dev_stack[MAX_NEST_DEV + 1];
+ struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1];
+ int ret, cur = 0;
+
+ now = dev;
+ iter = &dev->adj_list.upper;
+
+ while (1) {
+ if (now != dev) {
+ ret = fn(now, data);
+ if (ret)
+ return ret;
+ }
+
+ next = NULL;
+ while (1) {
+ udev = netdev_next_upper_dev(now, &iter);
+ if (!udev)
+ break;
+
+ if (!next) {
+ next = udev;
+ niter = &udev->adj_list.upper;
+ } else {
+ dev_stack[cur] = udev;
+ iter_stack[cur++] = &udev->adj_list.upper;
+ break;
+ }
+ }
+
+ if (!next) {
+ if (!cur)
+ return 0;
+ next = dev_stack[--cur];
+ niter = iter_stack[cur];
+ }
+
+ now = next;
+ iter = niter;
+ }
+
+ return 0;
+}
+
int netdev_walk_all_upper_dev_rcu(struct net_device *dev,
int (*fn)(struct net_device *dev,
void *data),
void *data)
{
- struct net_device *udev;
- struct list_head *iter;
- int ret;
+ struct net_device *udev, *next, *now, *dev_stack[MAX_NEST_DEV + 1];
+ struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1];
+ int ret, cur = 0;
- for (iter = &dev->adj_list.upper,
- udev = netdev_next_upper_dev_rcu(dev, &iter);
- udev;
- udev = netdev_next_upper_dev_rcu(dev, &iter)) {
- /* first is the upper device itself */
- ret = fn(udev, data);
- if (ret)
- return ret;
+ now = dev;
+ iter = &dev->adj_list.upper;
- /* then look at all of its upper devices */
- ret = netdev_walk_all_upper_dev_rcu(udev, fn, data);
- if (ret)
- return ret;
+ while (1) {
+ if (now != dev) {
+ ret = fn(now, data);
+ if (ret)
+ return ret;
+ }
+
+ next = NULL;
+ while (1) {
+ udev = netdev_next_upper_dev_rcu(now, &iter);
+ if (!udev)
+ break;
+
+ if (!next) {
+ next = udev;
+ niter = &udev->adj_list.upper;
+ } else {
+ dev_stack[cur] = udev;
+ iter_stack[cur++] = &udev->adj_list.upper;
+ break;
+ }
+ }
+
+ if (!next) {
+ if (!cur)
+ return 0;
+ next = dev_stack[--cur];
+ niter = iter_stack[cur];
+ }
+
+ now = next;
+ iter = niter;
}
return 0;
+
}
EXPORT_SYMBOL_GPL(netdev_walk_all_upper_dev_rcu);
@@ -6790,23 +6878,45 @@ int netdev_walk_all_lower_dev(struct net_device *dev,
void *data),
void *data)
{
- struct net_device *ldev;
- struct list_head *iter;
- int ret;
+ struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1];
+ struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1];
+ int ret, cur = 0;
- for (iter = &dev->adj_list.lower,
- ldev = netdev_next_lower_dev(dev, &iter);
- ldev;
- ldev = netdev_next_lower_dev(dev, &iter)) {
- /* first is the lower device itself */
- ret = fn(ldev, data);
- if (ret)
- return ret;
+ now = dev;
+ iter = &dev->adj_list.lower;
- /* then look at all of its lower devices */
- ret = netdev_walk_all_lower_dev(ldev, fn, data);
- if (ret)
- return ret;
+ while (1) {
+ if (now != dev) {
+ ret = fn(now, data);
+ if (ret)
+ return ret;
+ }
+
+ next = NULL;
+ while (1) {
+ ldev = netdev_next_lower_dev(now, &iter);
+ if (!ldev)
+ break;
+
+ if (!next) {
+ next = ldev;
+ niter = &ldev->adj_list.lower;
+ } else {
+ dev_stack[cur] = ldev;
+ iter_stack[cur++] = &ldev->adj_list.lower;
+ break;
+ }
+ }
+
+ if (!next) {
+ if (!cur)
+ return 0;
+ next = dev_stack[--cur];
+ niter = iter_stack[cur];
+ }
+
+ now = next;
+ iter = niter;
}
return 0;
@@ -6827,31 +6937,100 @@ static struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev,
return lower->dev;
}
-int netdev_walk_all_lower_dev_rcu(struct net_device *dev,
- int (*fn)(struct net_device *dev,
- void *data),
- void *data)
+static u8 __netdev_upper_depth(struct net_device *dev)
+{
+ struct net_device *udev;
+ struct list_head *iter;
+ u8 max_depth = 0;
+
+ for (iter = &dev->adj_list.upper,
+ udev = netdev_next_upper_dev(dev, &iter);
+ udev;
+ udev = netdev_next_upper_dev(dev, &iter)) {
+ if (max_depth < udev->upper_level)
+ max_depth = udev->upper_level;
+ }
+
+ return max_depth;
+}
+
+static u8 __netdev_lower_depth(struct net_device *dev)
{
struct net_device *ldev;
struct list_head *iter;
- int ret;
+ u8 max_depth = 0;
for (iter = &dev->adj_list.lower,
- ldev = netdev_next_lower_dev_rcu(dev, &iter);
+ ldev = netdev_next_lower_dev(dev, &iter);
ldev;
- ldev = netdev_next_lower_dev_rcu(dev, &iter)) {
- /* first is the lower device itself */
- ret = fn(ldev, data);
- if (ret)
- return ret;
+ ldev = netdev_next_lower_dev(dev, &iter)) {
+ if (max_depth < ldev->lower_level)
+ max_depth = ldev->lower_level;
+ }
- /* then look at all of its lower devices */
- ret = netdev_walk_all_lower_dev_rcu(ldev, fn, data);
- if (ret)
- return ret;
+ return max_depth;
+}
+
+static int __netdev_update_upper_level(struct net_device *dev, void *data)
+{
+ dev->upper_level = __netdev_upper_depth(dev) + 1;
+ return 0;
+}
+
+static int __netdev_update_lower_level(struct net_device *dev, void *data)
+{
+ dev->lower_level = __netdev_lower_depth(dev) + 1;
+ return 0;
+}
+
+int netdev_walk_all_lower_dev_rcu(struct net_device *dev,
+ int (*fn)(struct net_device *dev,
+ void *data),
+ void *data)
+{
+ struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1];
+ struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1];
+ int ret, cur = 0;
+
+ now = dev;
+ iter = &dev->adj_list.lower;
+
+ while (1) {
+ if (now != dev) {
+ ret = fn(now, data);
+ if (ret)
+ return ret;
+ }
+
+ next = NULL;
+ while (1) {
+ ldev = netdev_next_lower_dev_rcu(now, &iter);
+ if (!ldev)
+ break;
+
+ if (!next) {
+ next = ldev;
+ niter = &ldev->adj_list.lower;
+ } else {
+ dev_stack[cur] = ldev;
+ iter_stack[cur++] = &ldev->adj_list.lower;
+ break;
+ }
+ }
+
+ if (!next) {
+ if (!cur)
+ return 0;
+ next = dev_stack[--cur];
+ niter = iter_stack[cur];
+ }
+
+ now = next;
+ iter = niter;
}
return 0;
+
}
EXPORT_SYMBOL_GPL(netdev_walk_all_lower_dev_rcu);
@@ -7105,6 +7284,9 @@ static int __netdev_upper_dev_link(struct net_device *dev,
if (netdev_has_upper_dev(upper_dev, dev))
return -EBUSY;
+ if ((dev->lower_level + upper_dev->upper_level) > MAX_NEST_DEV)
+ return -EMLINK;
+
if (!master) {
if (netdev_has_upper_dev(dev, upper_dev))
return -EEXIST;
@@ -7131,6 +7313,12 @@ static int __netdev_upper_dev_link(struct net_device *dev,
if (ret)
goto rollback;
+ __netdev_update_upper_level(dev, NULL);
+ netdev_walk_all_lower_dev(dev, __netdev_update_upper_level, NULL);
+
+ __netdev_update_lower_level(upper_dev, NULL);
+ netdev_walk_all_upper_dev(upper_dev, __netdev_update_lower_level, NULL);
+
return 0;
rollback:
@@ -7213,6 +7401,12 @@ void netdev_upper_dev_unlink(struct net_device *dev,
call_netdevice_notifiers_info(NETDEV_CHANGEUPPER,
&changeupper_info.info);
+
+ __netdev_update_upper_level(dev, NULL);
+ netdev_walk_all_lower_dev(dev, __netdev_update_upper_level, NULL);
+
+ __netdev_update_lower_level(upper_dev, NULL);
+ netdev_walk_all_upper_dev(upper_dev, __netdev_update_lower_level, NULL);
}
EXPORT_SYMBOL(netdev_upper_dev_unlink);
@@ -9212,6 +9406,8 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
dev->gso_max_size = GSO_MAX_SIZE;
dev->gso_max_segs = GSO_MAX_SEGS;
+ dev->upper_level = 1;
+ dev->lower_level = 1;
INIT_LIST_HEAD(&dev->napi_list);
INIT_LIST_HEAD(&dev->unreg_list);
--
2.17.1
^ permalink raw reply related
* [PATCH net v4 02/12] vlan: use dynamic lockdep key instead of subclass
From: Taehee Yoo @ 2019-09-28 16:48 UTC (permalink / raw)
To: davem, netdev, linux-wireless, jakub.kicinski, johannes,
j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm, manishc,
rahulv, kys, haiyangz, stephen, sashal, hare, varun, ubraun,
kgraul, jay.vosburgh, schuffelen, bjorn
Cc: ap420073
In-Reply-To: <20190928164843.31800-1-ap420073@gmail.com>
All VLAN device has same lockdep key and subclass is initialized with
nest_level.
But actual nest_level value can be changed when a lower device is attached.
And at this moment, the subclass should be updated but it seems to be
unsafe.
So this patch makes VLAN use dynamic lockdep key instead of the subclass.
Test commands:
ip link add dummy0 type dummy
ip link set dummy0 up
ip link add bond0 type bond
ip link add vlan_dummy1 link dummy0 type vlan id 1
ip link add vlan_bond1 link bond0 type vlan id 2
ip link set vlan_dummy1 master bond0
ip link set bond0 up
ip link set vlan_dummy1 up
ip link set vlan_bond1 up
Both vlan_dummy1 and vlan_bond1 have the same subclass and it makes
unnecessary deadlock warning message.
Splat looks like:
[ 75.879233] WARNING: possible recursive locking detected
[ 75.879881] 5.3.0+ #3 Not tainted
[ 75.880285] --------------------------------------------
[ 75.880933] ip/634 is trying to acquire lock:
[ 75.881463] ffff8880673c2558 (&vlan_netdev_addr_lock_key/1){+...}, at: dev_uc_sync_multiple+0xfa/0x1a0
[ 75.882714]
[ 75.882714] but task is already holding lock:
[ 75.883502] ffff8880645193f8 (&vlan_netdev_addr_lock_key/1){+...}, at: dev_set_rx_mode+0x19/0x30
[ 75.884707]
[ 75.884707] other info that might help us debug this:
[ 75.885742] Possible unsafe locking scenario:
[ 75.885742]
[ 75.887013] CPU0
[ 75.887415] ----
[ 75.887723] lock(&vlan_netdev_addr_lock_key/1);
[ 75.888280] lock(&vlan_netdev_addr_lock_key/1);
[ 75.888852]
[ 75.888852] *** DEADLOCK ***
[ 75.888852]
[ 75.889569] May be due to missing lock nesting notation
[ 75.889569]
[ 75.890453] 4 locks held by ip/634:
[ 75.890992] #0: ffffffff96ec7a30 (rtnl_mutex){+.+.}, at: rtnetlink_rcv_msg+0x466/0x8a0
[ 75.892021] #1: ffff8880645193f8 (&vlan_netdev_addr_lock_key/1){+...}, at: dev_set_rx_mode+0x19/0x30
[ 75.893387] #2: ffff8880694c4558 (&dev_addr_list_lock_key/3){+...}, at: dev_mc_sync+0xfa/0x1a0
[ 75.894545] #3: ffffffff96b22780 (rcu_read_lock){....}, at: bond_set_rx_mode+0x5/0x3c0 [bonding]
[ 75.895558]
[ 75.895558] stack backtrace:
[ 75.896003] CPU: 0 PID: 634 Comm: ip Not tainted 5.3.0+ #3
[ 75.896566] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[ 75.897549] Call Trace:
[ 75.897916] dump_stack+0x7c/0xbb
[ 75.898287] __lock_acquire+0x26a9/0x3df0
[ 75.898664] ? register_lock_class+0x14d0/0x14d0
[ 75.899255] lock_acquire+0x164/0x3b0
[ 75.899718] ? dev_uc_sync_multiple+0xfa/0x1a0
[ 75.900245] ? rcu_read_lock_held+0x90/0xa0
[ 75.900707] _raw_spin_lock_nested+0x2e/0x60
[ 75.901149] ? dev_uc_sync_multiple+0xfa/0x1a0
[ 75.901629] dev_uc_sync_multiple+0xfa/0x1a0
[ 75.902116] bond_set_rx_mode+0x269/0x3c0 [bonding]
[ 75.903135] ? bond_init+0x6f0/0x6f0 [bonding]
[ 75.903696] dev_mc_sync+0x15a/0x1a0
[ ... ]
Fixes: 0fe1e567d0b4 ("[VLAN]: nested VLAN: fix lockdep's recursive locking warning")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v1 -> v4 :
- This patch is not changed
include/linux/if_vlan.h | 3 +++
net/8021q/vlan_dev.c | 28 +++++++++++++++-------------
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 244278d5c222..1aed9f613e90 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -183,6 +183,9 @@ struct vlan_dev_priv {
struct netpoll *netpoll;
#endif
unsigned int nest_level;
+
+ struct lock_class_key xmit_lock_key;
+ struct lock_class_key addr_lock_key;
};
static inline struct vlan_dev_priv *vlan_dev_priv(const struct net_device *dev)
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 93eadf179123..12bc80650087 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -494,24 +494,24 @@ static void vlan_dev_set_rx_mode(struct net_device *vlan_dev)
* "super class" of normal network devices; split their locks off into a
* separate class since they always nest.
*/
-static struct lock_class_key vlan_netdev_xmit_lock_key;
-static struct lock_class_key vlan_netdev_addr_lock_key;
-
static void vlan_dev_set_lockdep_one(struct net_device *dev,
struct netdev_queue *txq,
- void *_subclass)
+ void *_unused)
{
- lockdep_set_class_and_subclass(&txq->_xmit_lock,
- &vlan_netdev_xmit_lock_key,
- *(int *)_subclass);
+ struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
+
+ lockdep_set_class(&txq->_xmit_lock, &vlan->xmit_lock_key);
}
-static void vlan_dev_set_lockdep_class(struct net_device *dev, int subclass)
+static void vlan_dev_set_lockdep_class(struct net_device *dev)
{
- lockdep_set_class_and_subclass(&dev->addr_list_lock,
- &vlan_netdev_addr_lock_key,
- subclass);
- netdev_for_each_tx_queue(dev, vlan_dev_set_lockdep_one, &subclass);
+ struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
+
+ lockdep_register_key(&vlan->addr_lock_key);
+ lockdep_set_class(&dev->addr_list_lock, &vlan->addr_lock_key);
+
+ lockdep_register_key(&vlan->xmit_lock_key);
+ netdev_for_each_tx_queue(dev, vlan_dev_set_lockdep_one, NULL);
}
static int vlan_dev_get_lock_subclass(struct net_device *dev)
@@ -609,7 +609,7 @@ static int vlan_dev_init(struct net_device *dev)
SET_NETDEV_DEVTYPE(dev, &vlan_type);
- vlan_dev_set_lockdep_class(dev, vlan_dev_get_lock_subclass(dev));
+ vlan_dev_set_lockdep_class(dev);
vlan->vlan_pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);
if (!vlan->vlan_pcpu_stats)
@@ -630,6 +630,8 @@ static void vlan_dev_uninit(struct net_device *dev)
kfree(pm);
}
}
+ lockdep_unregister_key(&vlan->addr_lock_key);
+ lockdep_unregister_key(&vlan->xmit_lock_key);
}
static netdev_features_t vlan_dev_fix_features(struct net_device *dev,
--
2.17.1
^ permalink raw reply related
* [PATCH net v4 00/12] net: fix nested device bugs
From: Taehee Yoo @ 2019-09-28 16:48 UTC (permalink / raw)
To: davem, netdev, linux-wireless, jakub.kicinski, johannes,
j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm, manishc,
rahulv, kys, haiyangz, stephen, sashal, hare, varun, ubraun,
kgraul, jay.vosburgh, schuffelen, bjorn
Cc: ap420073
This patchset fixes several bugs that are related to nesting
device infrastructure.
Current nesting infrastructure code doesn't limit the depth level of
devices. nested devices could be handled recursively. at that moment,
it needs huge memory and stack overflow could occur.
Below devices type have same bug.
VLAN, BONDING, TEAM, MACSEC, MACVLAN, IPVLAN, VIRT_WIFI and VXLAN.
But I couldn't test all interface types so there could be more device
types which have similar problems.
Maybe qmi_wwan.c code could have same problem.
So, I would appreciate if someone test qmi_wwan.c and other modules.
Test commands:
ip link add dummy0 type dummy
ip link add vlan1 link dummy0 type vlan id 1
for i in {2..100}
do
let A=$i-1
ip link add name vlan$i link vlan$A type vlan id $i
done
ip link del dummy0
1st patch actually fixes the root cause.
It adds new common variables {upper/lower}_level that represent
depth level. upper_level variable is depth of upper devices.
lower_level variable is depth of lower devices.
[U][L] [U][L]
vlan1 1 5 vlan4 1 4
vlan2 2 4 vlan5 2 3
vlan3 3 3 |
| |
+------------+
|
vlan6 4 2
dummy0 5 1
After this patch, the nesting infrastructure code uses this variable to
check the depth level.
2, 4, 5, 6, 7 patches fix lockdep related problem.
Before this patch, devices use static lockdep map.
So, if devices that are same type is nested, lockdep will warn about
recursive situation.
These patches make these devices use dynamic lockdep key instead of
static lock or subclass.
3rd patch fixes unexpected IFF_BONDING bit unset.
8th patch fixes a refcnt leak in the macsec module.
9th patch adds ignore flag to an adjacent structure.
In order to exchange an adjacent node safely, ignore flag is needed.
10th patch makes vxlan add an adjacent link to limit depth level.
11th patch removes unnecessary variables and callback.
12th patch fix refcnt leaks in the virt_wifi module
v3 -> v4 :
- Add new 12th patch to fix refcnt leaks in the virt_wifi module
- Fix wrong usage netdev_upper_dev_link() in the vxlan.c
- Preserve reverse christmas tree variable ordering in the vxlan.c
- Add missing static keyword in the dev.c
- Expose netdev_adjacent_change_{prepare/commit/abort} instead of
netdev_adjacent_dev_{enable/disable}
v2 -> v3 :
- Modify nesting infrastructure code to use iterator instead of recursive.
v1 -> v2 :
- Make the 3rd patch do not add a new priv_flag.
Taehee Yoo (12):
net: core: limit nested device depth
vlan: use dynamic lockdep key instead of subclass
bonding: fix unexpected IFF_BONDING bit unset
bonding: use dynamic lockdep key instead of subclass
team: use dynamic lockdep key instead of static key
macsec: use dynamic lockdep key instead of subclass
macvlan: use dynamic lockdep key instead of subclass
macsec: fix refcnt leak in module exit routine
net: core: add ignore flag to netdev_adjacent structure
vxlan: add adjacent link to limit depth level
net: remove unnecessary variables and callback
virt_wifi: fix refcnt leak in module exit routine
drivers/net/bonding/bond_alb.c | 2 +-
drivers/net/bonding/bond_main.c | 81 ++-
.../net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +-
drivers/net/macsec.c | 50 +-
drivers/net/macvlan.c | 36 +-
drivers/net/team/team.c | 61 ++-
drivers/net/vxlan.c | 52 +-
drivers/net/wireless/virt_wifi.c | 51 +-
include/linux/if_macvlan.h | 3 +-
include/linux/if_team.h | 5 +
include/linux/if_vlan.h | 13 +-
include/linux/netdevice.h | 26 +-
include/net/bonding.h | 4 +-
include/net/vxlan.h | 1 +
net/8021q/vlan.c | 1 -
net/8021q/vlan_dev.c | 32 +-
net/core/dev.c | 508 +++++++++++++++---
net/core/dev_addr_lists.c | 12 +-
net/smc/smc_core.c | 2 +-
net/smc/smc_pnet.c | 2 +-
20 files changed, 752 insertions(+), 192 deletions(-)
--
2.17.1
^ permalink raw reply
* Re: [PATCH bpf] libbpf: count present CPUs, not theoretically possible
From: Andrii Nakryiko @ 2019-09-28 16:31 UTC (permalink / raw)
To: Alan Maguire
Cc: Andrii Nakryiko, bpf, Networking, Alexei Starovoitov,
Daniel Borkmann, Kernel Team
In-Reply-To: <alpine.LRH.2.20.1909281202530.5332@dhcp-10-175-218-65.vpn.oracle.com>
On Sat, Sep 28, 2019 at 4:20 AM Alan Maguire <alan.maguire@oracle.com> wrote:
>
> On Fri, 27 Sep 2019, Andrii Nakryiko wrote:
>
> > This patch switches libbpf_num_possible_cpus() from using possible CPU
> > set to present CPU set. This fixes issues with incorrect auto-sizing of
> > PERF_EVENT_ARRAY map on HOTPLUG-enabled systems.
> >
> > On HOTPLUG enabled systems, /sys/devices/system/cpu/possible is going to
> > be a set of any representable (i.e., potentially possible) CPU, which is
> > normally way higher than real amount of CPUs (e.g., 0-127 on VM I've
> > tested on, while there were just two CPU cores actually present).
> > /sys/devices/system/cpu/present, on the other hand, will only contain
> > CPUs that are physically present in the system (even if not online yet),
> > which is what we really want, especially when creating per-CPU maps or
> > perf events.
> >
> > On systems with HOTPLUG disabled, present and possible are identical, so
> > there is no change of behavior there.
> >
>
> Just curious - is there a reason for not adding a new libbpf_num_present_cpus()
> function to cover this case, and switching to using that in various places?
The reason is that libbpf_num_possible_cpus() is useless on HOTPLUG
systems and never worked as intended. If you rely on this function to
create perf_buffer and/or PERF_EVENT_ARRAY, it will simply fail due to
specifying more CPUs than are present. I didn't want to keep adding
new APIs for no good reason, while also leaving useless ones, so I
fixed the existing API to behave as expected. It's unfortunate that
name doesn't match sysfs file we are reading it from, of course, but
having people to choose between libbpf_num_possible_cpus() vs
libbpf_num_present_cpus() seems like even bigger problem, as
differences are non-obvious.
The good thing, it won't break all the non-HOTPLUG systems for sure,
which seems to be the only cases that are used right now (otherwise
someone would already complain about broken
libbpf_num_possible_cpus()).
>
> Looking at the places libbpf_num_possible_cpus() is called in libbpf
>
> - __perf_buffer__new(): this could just change to use the number of
> present CPUs, since perf_buffer__new_raw() with a cpu_cnt in struct
> perf_buffer_raw_ops
>
> - bpf_object__create_maps(), which is called via bpf_oject__load_xattr().
> In this case it seems like switching to num present makes sense, though
> it might make sense to add a field to struct bpf_object_load_attr * to
> allow users to explicitly set another max value.
I believe more knobs is not always better for API. Plus, adding any
field to those xxx_xattr structs is an ABI breakage and requires
adding new APIs, so I don't think this is good enough reason to add
new flag. See discussion in another thread about this whole API design
w/ current attributes and ABI consequences of adding anything new to
them.
>
> This would give the desired default behaviour, while still giving users
> a way of specifying the possible number. What do you think? Thanks!
BTW, if user wants to override the size of maps, they can do it easily
either in map definition or programmatically after bpf_object__open,
but before bpf_object__load, so there is no need for flags, it's all
easily achievable with existing API.
>
> Alan
>
> > Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> > ---
> > tools/lib/bpf/libbpf.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> > index e0276520171b..45351c074e45 100644
> > --- a/tools/lib/bpf/libbpf.c
> > +++ b/tools/lib/bpf/libbpf.c
> > @@ -5899,7 +5899,7 @@ void bpf_program__bpil_offs_to_addr(struct bpf_prog_info_linear *info_linear)
> >
> > int libbpf_num_possible_cpus(void)
> > {
> > - static const char *fcpu = "/sys/devices/system/cpu/possible";
> > + static const char *fcpu = "/sys/devices/system/cpu/present";
> > int len = 0, n = 0, il = 0, ir = 0;
> > unsigned int start = 0, end = 0;
> > int tmp_cpus = 0;
> > --
> > 2.17.1
> >
> >
^ permalink raw reply
* Re: [PATCH iproute2 net-next 1/2] bridge: fdb get support
From: Stephen Hemminger @ 2019-09-28 15:46 UTC (permalink / raw)
To: Roopa Prabhu; +Cc: dsahern, netdev, nikolay
In-Reply-To: <1569646104-358-2-git-send-email-roopa@cumulusnetworks.com>
On Fri, 27 Sep 2019 21:48:23 -0700
Roopa Prabhu <roopa@cumulusnetworks.com> wrote:
Overall, looks good.
> + if (print_fdb(answer, (void *)stdout) < 0) {
Cast to void is not necessary in C (it is in C++)
^ permalink raw reply
* Re: DSA driver kernel extension for dsa mv88e6190 switch
From: Andrew Lunn @ 2019-09-28 15:20 UTC (permalink / raw)
To: Zoran Stojsavljevic; +Cc: netdev
In-Reply-To: <CAGAf8LxAbDK7AUueCv-2kcEG8NZApNjQ+WQ1XO89+5C-SLAbPw@mail.gmail.com>
On Sat, Sep 28, 2019 at 01:00:43AM +0200, Zoran Stojsavljevic wrote:
> Hello Andrew,
>
> > You should not need any kernel patches for switch side RGMII
> > delays. rgmii-id in the DT for the switch CPU port should be enough.
> > Some of the vf610-zii platforms use it.
>
> It should, but it does NOT work. IT is clearly stated in port.c, in f-n:
> static int mv88e6xxx_port_set_rgmii_delay(struct mv88e6xxx_chip *chip, int port,
> phy_interface_t mode)
>
> The logic analyser shows MDIO write to register 0x01, which is 0x6003.
> Seems the correct value.
>
> But, at the very end, ethtool shows that this clock skew is NOT
> inserted.
How do you see this with ethtool?
> I see on RX side CRC errors. Every ethernet frame while
> pinging.
But TX works? Maybe the FEC is doing some sort of delay, even if it
has a hardware bug.
> I see another interesting fact, the dmesg, which you could see here:
> https://pastebin.com/igXS6eXe
>
> [ 1.182273] DEBUG INFO! <- addr: 0x00 reg: 0x03 val: 0x1901
> [ 1.187888] mv88e6085 2188000.ethernet-1:00: switch 0x1900
> detected: Marvell 88E6190, revision 1
> [ 1.219804] random: fast init done
> [ 1.225334] libphy: mv88e6xxx SMI: probed
> [ 1.232709] fec 2188000.ethernet eth0: registered PHC device 0
>
> [ 1.547946] DEBUG INFO! <- addr: 0x00 reg: 0x03 val: 0x1901
> [ 1.553542] mv88e6085 2188000.ethernet-1:00: switch 0x1900
> detected: Marvell 88E6190, revision 1
> [ 1.555432] mmcblk1: p1
> [ 1.598106] libphy: mv88e6xxx SMI: probed
> [ 1.740362] DSA: tree 0 setup
>
> There are two distinct accesses while driver configures the switch. Why???
This happens when the driver is missing a resource during probe. It
returns the error -EPROBE_DEFER, and the linux driver core will try
the probe again later. Probably the second time all the resources it
needs will be present and the probe will be successful.
I will probably have a some patches during the next kernel merge cycle
to make this a bit more efficient.
> I was not able to explain this to me... Or find explanation using google?!
>
> > gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>; is wrong. It probably
> > should be reset-gpios. The rest looks O.K.
>
> I will follow the advise, but I do not think this is an obstacle.
No, it is not an obstacle, but it is still wrong.
>
> > Please show me the configuration steps you are doing? How are you
> > configuring the FEC and the switch interfaces?
>
> Forgive me for my ignorance, but I have no idea what you have asked me for?
ip link set eth0 up
ip link set lan0 up
ip link set lan1 up
ip link name br0 type bridge
ip link set br0 up
ip link lan0 master br0
ip link lan1 master br0
Andrew
^ permalink raw reply
* [PATCH] bpf: use flexible array members, not zero-length
From: Stephen Kitt @ 2019-09-28 14:48 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song
Cc: linux-doc, netdev, bpf, Gustavo A . R . Silva, Stephen Kitt
This switches zero-length arrays in variable-length structs to C99
flexible array members. GCC will then ensure that the arrays are
always the last element in the struct.
Coccinelle:
@@
identifier S, fld;
type T;
@@
struct S {
...
- T fld[0];
+ T fld[];
...
};
Signed-off-by: Stephen Kitt <steve@sk2.org>
---
Documentation/bpf/btf.rst | 2 +-
tools/lib/bpf/libbpf.c | 2 +-
tools/lib/bpf/libbpf_internal.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/bpf/btf.rst b/Documentation/bpf/btf.rst
index 4d565d202ce3..24ce50fc1fc1 100644
--- a/Documentation/bpf/btf.rst
+++ b/Documentation/bpf/btf.rst
@@ -670,7 +670,7 @@ func_info for each specific ELF section.::
__u32 sec_name_off; /* offset to section name */
__u32 num_info;
/* Followed by num_info * record_size number of bytes */
- __u8 data[0];
+ __u8 data[];
};
Here, num_info must be greater than 0.
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index e0276520171b..c02ea0e1a588 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -5577,7 +5577,7 @@ static struct perf_buffer *__perf_buffer__new(int map_fd, size_t page_cnt,
struct perf_sample_raw {
struct perf_event_header header;
uint32_t size;
- char data[0];
+ char data[];
};
struct perf_sample_lost {
diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h
index 2e83a34f8c79..26eaa3f594aa 100644
--- a/tools/lib/bpf/libbpf_internal.h
+++ b/tools/lib/bpf/libbpf_internal.h
@@ -86,7 +86,7 @@ struct btf_ext_info_sec {
__u32 sec_name_off;
__u32 num_info;
/* Followed by num_info * record_size number of bytes */
- __u8 data[0];
+ __u8 data[];
};
/* The minimum bpf_func_info checked by the loader */
--
2.20.1
^ permalink raw reply related
* [PATCH] can: dev: add missing of_node_put after calling of_get_child_by_name
From: Wen Yang @ 2019-09-28 14:29 UTC (permalink / raw)
To: Wolfgang Grandegger, Marc Kleine-Budde
Cc: xlpang, Wen Yang, David S. Miller, Franklin S Cooper Jr,
linux-can, netdev, linux-kernel
of_node_put needs to be called when the device node which is got
from of_get_child_by_name finished using.
fixes: 2290aefa2e90 ("can: dev: Add support for limiting configured bitrate")
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Franklin S Cooper Jr <fcooper@ti.com>
Cc: linux-can@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
drivers/net/can/dev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index ac86be5..1c88c36 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -848,6 +848,7 @@ void of_can_transceiver(struct net_device *dev)
return;
ret = of_property_read_u32(dn, "max-bitrate", &priv->bitrate_max);
+ of_node_put(dn);
if ((ret && ret != -EINVAL) || (!ret && !priv->bitrate_max))
netdev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit.\n");
}
--
1.8.3.1
^ permalink raw reply related
* [GIT] Networking
From: David Miller @ 2019-09-28 13:49 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
1) Sanity check URB networking device parameters to avoid divide by zero,
from Oliver Neukum.
2) Disable global multicast filter in NCSI, otherwise LLDP and IPV6
don't work properly. Longer term this needs a better fix tho. From
Vijay Khemka.
3) Small fixes to selftests (use ping when ping6 is not present, etc.)
from David Ahern.
4) Bring back rt_uses_gateway member of struct rtable, it's semantics were
not well understood and trying to remove it broke things. From David
Ahern.
5) Move usbnet snaity checking, ignore endpoints with invalid wMaxPacketSize.
From Bjørn Mork.
6) Missing Kconfig deps for sja1105 driver, from Mao Wenan.
7) Various small fixes to the mlx5 DR steering code, from Alaa Hleihel,
Alex Vesker, and Yevgeny Kliteynik
8) Missing CAP_NET_RAW checks in various places, from Ori Nimron.
9) Fix crash when removing sch_cbs entry while offloading is enabled,
from Vinicius Costa Gomes.
10) Signedness bug fixes, generally in looking at the result given by
of_get_phy_mode() and friends. From Dan Crapenter.
11) Disable preemption around BPF_PROG_RUN() calls, from Eric Dumazet.
12) Don't create VRF ipv6 rules if ipv6 is disabled, from David Ahern.
13) Fix quantization code in tcp_bbr, from Kevin Yang.
Please pull, thanks a lot!
The following changes since commit b41dae061bbd722b9d7fa828f35d22035b218e18:
Merge tag 'xfs-5.4-merge-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux (2019-09-18 18:32:43 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
for you to fetch changes up to faeacb6ddb13b7a020b50b9246fe098653cfbd6e:
net: tap: clean up an indentation issue (2019-09-27 20:58:35 +0200)
----------------------------------------------------------------
Alaa Hleihel (1):
net/mlx5: DR, Allow matching on vport based on vhca_id
Alex Vesker (2):
net/mlx5: DR, Remove redundant vport number from action
net/mlx5: DR, Fix getting incorrect prev node in ste_free
Alexandru Ardelean (2):
dt-bindings: net: dwmac: fix 'mac-mode' type
dt-bindings: net: remove un-implemented property
Alexei Starovoitov (2):
bpf: fix BTF verification of enums
bpf: fix BTF limits
Allan Zhang (1):
bpf: Fix bpf_event_output re-entry issue
Andrew Lunn (1):
net: dsa: qca8k: Fix port enable for CPU port
Andrii Nakryiko (4):
libbpf: fix false uninitialized variable warning
selftests/bpf: delete unused variables in test_sysctl
selftests/bpf: adjust strobemeta loop to satisfy latest clang
libbpf: Teach btf_dumper to emit stand-alone anonymous enum definitions
Arnd Bergmann (2):
net: remove netx ethernet driver
net: stmmac: selftest: avoid large stack usage
Biju Das (1):
dt-bindings: net: ravb: Add support for r8a774b1 SoC
Bjorn Andersson (1):
net: qrtr: Stop rx_worker before freeing node
Björn Töpel (1):
xsk: relax UMEM headroom alignment
Bjørn Mork (2):
cdc_ncm: fix divide-by-zero caused by invalid wMaxPacketSize
usbnet: ignore endpoints with invalid wMaxPacketSize
Bodong Wang (1):
net/mlx5: Add device ID of upcoming BlueField-2
Christophe JAILLET (1):
qede: qede_fp: simplify a bit 'qede_rx_build_skb()'
Colin Ian King (5):
atm: he: clean up an indentation issue
bpf: Clean up indentation issue in BTF kflag processing
NFC: st95hf: clean up indentation issue
net: ena: clean up indentation issue
net: tap: clean up an indentation issue
Cong Wang (2):
net_sched: add max len check for TCA_KIND
net_sched: add policy validation for action attributes
Dan Carpenter (14):
ionic: Fix an error code in ionic_lif_alloc()
wil6210: use after free in wil_netif_rx_any()
net: aquantia: Fix aq_vec_isr_legacy() return value
cxgb4: Signedness bug in init_one()
net: hisilicon: Fix signedness bug in hix5hd2_dev_probe()
net: broadcom/bcmsysport: Fix signedness in bcm_sysport_probe()
net: netsec: Fix signedness bug in netsec_probe()
enetc: Fix a signedness bug in enetc_of_get_phy()
net: socionext: Fix a signedness bug in ave_probe()
net: stmmac: dwmac-meson8b: Fix signedness bug in probe
net: axienet: fix a signedness bug in probe
of: mdio: Fix a signedness bug in of_phy_get_and_connect()
net: nixge: Fix a signedness bug in nixge_probe()
net: ethernet: stmmac: Fix signedness bug in ipq806x_gmac_of_parse()
Danielle Ratson (1):
mlxsw: spectrum_flower: Fail in case user specifies multiple mirror actions
David Ahern (4):
selftests: Update fib_tests to handle missing ping6
selftests: Update fib_nexthop_multiprefix to handle missing ping6
ipv4: Revert removal of rt_uses_gateway
vrf: Do not attempt to create IPv6 mcast rule if IPv6 is disabled
David S. Miller (9):
Merge branch 'check-CAP_NEW_RAW'
Merge branch 'ibmvnic-serialization-fixes'
Merge tag 'mlx5-fixes-2019-09-24' of git://git.kernel.org/.../saeed/linux
Merge tag 'wireless-drivers-for-davem-2019-09-26' of https://git.kernel.org/.../kvalo/wireless-drivers
Merge branch 'SO_PRIORITY'
Merge branch 'qdisc-destroy'
Merge git://git.kernel.org/.../bpf/bpf
Merge git://git.kernel.org/.../pablo/nf
Merge branch 'mlxsw-Various-fixes'
Davide Caratti (1):
net/sched: act_sample: don't push mac header on ip6gre ingress
Dmytro Linkin (1):
net/mlx5e: Fix matching on tunnel addresses type
Donald Sharp (1):
selftests: Add test cases for `ip nexthop flush proto XX`
Eric Dumazet (9):
sch_netem: fix a divide by zero in tabledist()
ipv6: fix a typo in fib6_rule_lookup()
net: sched: fix possible crash in tcf_action_destroy()
kcm: disable preemption in kcm_parse_func_strparser()
sch_netem: fix rcu splat in netem_enqueue()
ipv6: add priority parameter to ip6_xmit()
ipv6: tcp: provide sk->sk_priority to ctl packets
tcp: honor SO_PRIORITY in TIME_WAIT state
tcp: better handle TCP_USER_TIMEOUT in SYN_SENT state
Florian Westphal (2):
netfilter: nf_tables: allow lookups in dynamic sets
sk_buff: drop all skb extensions on free and skb scrubbing
Geert Uytterhoeven (1):
zd1211rw: zd_usb: Use "%zu" to format size_t
Hans Andersson (1):
net: phy: micrel: add Asym Pause workaround for KSZ9021
Ido Schimmel (2):
mlxsw: spectrum: Clear VLAN filters during port initialization
Documentation: Clarify trap's description
Jacob Keller (1):
ptp: correctly disable flags on old ioctls
James Byrne (1):
dt-bindings: net: Correct the documentation of KSZ9021 skew values
Jason A. Donenfeld (2):
net: print proper warning on dst underflow
ipv6: do not free rt if FIB_LOOKUP_NOREF is set on suppress rule
Johannes Berg (1):
iwlwifi: mvm: fix build w/o CONFIG_THERMAL
Jonathan Lemon (1):
bpf/xskmap: Return ERR_PTR for failure case instead of NULL.
Jose Abreu (1):
net: stmmac: selftests: Flow Control test can also run with ASYM Pause
Juliet Kim (2):
net/ibmvnic: unlock rtnl_lock in reset so linkwatch_event can run
net/ibmvnic: prevent more than one thread from running in reset
Ka-Cheong Poon (1):
net/rds: Check laddr_check before calling it
Kevin(Yudong) Yang (1):
tcp_bbr: fix quantization code to not raise cwnd if not probing bandwidth
Krzysztof Kozlowski (2):
net: Fix Kconfig indentation
drivers: net: Fix Kconfig indentation
Kunihiko Hayashi (1):
net: socionext: ave: Avoid using netdev_err() before calling register_netdev()
Laura Garcia Liebana (1):
netfilter: nf_tables: bogus EBUSY when deleting flowtable after flush
Li RongQing (1):
openvswitch: change type of UPCALL_PID attribute to NLA_UNSPEC
Lorenzo Bianconi (1):
mt76: mt7615: fix mt7615 firmware path definitions
Luca Coelho (1):
iwlwifi: fw: don't send GEO_TX_POWER_LIMIT command to FW version 36
Mao Wenan (2):
net: dsa: sja1105: Add dependency for NET_DSA_SJA1105_TAS
net: ena: Select DIMLIB for ENA_ETHERNET
Marek Vasut (1):
net: dsa: microchip: Always set regmap stride to 1
Masahiro Yamada (1):
netfilter: ebtables: use __u8 instead of uint8_t in uapi header
Murilo Fossa Vicentini (1):
ibmvnic: Warn unknown speed message only when carrier is present
Nathan Chancellor (1):
ionic: Remove unnecessary ternary operator in ionic_debugfs_add_ident
Navid Emamdoost (3):
nfp: flower: prevent memory leak in nfp_flower_spawn_phy_reprs
nfp: flower: fix memory leak in nfp_flower_spawn_vnic_reprs
nfp: abm: fix memory leak in nfp_abm_u32_knode_replace
Nishad Kamdar (2):
net: dsa: b53: Use the correct style for SPDX License Identifier
net: dsa: Use the correct style for SPDX License Identifier
Oliver Neukum (1):
usbnet: sanity checking of packet sizes and device mtu
Ori Nimron (5):
mISDN: enforce CAP_NET_RAW for raw sockets
appletalk: enforce CAP_NET_RAW for raw sockets
ax25: enforce CAP_NET_RAW for raw sockets
ieee802154: enforce CAP_NET_RAW for raw sockets
nfc: enforce CAP_NET_RAW for raw sockets
Pablo Neira Ayuso (2):
netfilter: nf_tables: add NFT_CHAIN_POLICY_UNSET and use it
netfilter: nf_tables_offload: fix always true policy is unset check
Paul Blakey (1):
net/sched: Set default of CONFIG_NET_TC_SKB_EXT to N
Peter Mamonov (1):
net/phy: fix DP83865 10 Mbps HDX loopback disable function
Rain River (1):
MAINTAINERS: add Yanjun to FORCEDETH maintainers list
Randy Dunlap (1):
lib: dimlib: fix help text typos
Saeed Mahameed (1):
net/mlx5e: Fix traffic duplication in ethtool steering
Shubhrajyoti Datta (1):
net: macb: Remove dead code
Stanislav Fomichev (1):
selftests/bpf: test_progs: fix client/server race in tcp_rtt
Stephen Hemminger (1):
skge: fix checksum byte order
Takeshi Misawa (1):
ppp: Fix memory leak in ppp_write
Thierry Reding (1):
net: stmmac: Fix page pool size
Toke Høiland-Jørgensen (1):
libbpf: Remove getsockopt() check for XDP_OPTIONS
Uwe Kleine-König (2):
arcnet: provide a buffer big enough to actually receive packets
dimlib: make DIMLIB a hidden symbol
Vijay Khemka (1):
net/ncsi: Disable global multicast filter
Vinicius Costa Gomes (1):
net/sched: cbs: Fix not adding cbs instance to list
Vlad Buslov (3):
net: sched: sch_htb: don't call qdisc_put() while holding tree lock
net: sched: multiq: don't call qdisc_put() while holding tree lock
net: sched: sch_sfb: don't call qdisc_put() while holding tree lock
Xin Long (1):
macsec: drop skb sk before calling gro_cells_receive
Yan-Hsuan Chuang (3):
rtw88: pci: extract skbs free routine for trx rings
rtw88: pci: release tx skbs DMAed when stop
rtw88: configure firmware after HCI started
Yevgeny Kliteynik (1):
net/mlx5: DR, Fix SW steering HW bits and definitions
YueHaibing (1):
gianfar: Make reset_gfar static
Documentation/devicetree/bindings/net/adi,adin.yaml | 7 --
Documentation/devicetree/bindings/net/micrel-ksz90x1.txt | 32 +++++++-
Documentation/devicetree/bindings/net/renesas,ravb.txt | 1 +
Documentation/devicetree/bindings/net/snps,dwmac.yaml | 2 +-
Documentation/networking/devlink-trap.rst | 3 +-
MAINTAINERS | 1 +
drivers/atm/he.c | 2 +-
drivers/infiniband/core/addr.c | 2 +-
drivers/isdn/mISDN/socket.c | 2 +
drivers/net/Kconfig | 2 +-
drivers/net/arcnet/Kconfig | 26 +++----
drivers/net/arcnet/arcnet.c | 31 ++++----
drivers/net/can/usb/Kconfig | 8 +-
drivers/net/dsa/b53/b53_serdes.h | 4 +-
drivers/net/dsa/lantiq_pce.h | 2 +-
drivers/net/dsa/microchip/ksz_common.h | 2 +-
drivers/net/dsa/qca8k.c | 3 +
drivers/net/dsa/sja1105/Kconfig | 1 +
drivers/net/ethernet/Kconfig | 11 ---
drivers/net/ethernet/Makefile | 1 -
drivers/net/ethernet/allwinner/Kconfig | 10 +--
drivers/net/ethernet/amazon/Kconfig | 1 +
drivers/net/ethernet/amazon/ena/ena_eth_com.c | 4 +-
drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 15 ++--
drivers/net/ethernet/broadcom/bcmsysport.c | 2 +-
drivers/net/ethernet/cadence/macb_main.c | 5 +-
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 +-
drivers/net/ethernet/emulex/benet/Kconfig | 2 +-
drivers/net/ethernet/freescale/enetc/enetc_pf.c | 2 +-
drivers/net/ethernet/freescale/gianfar.c | 2 +-
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 2 +-
drivers/net/ethernet/ibm/ibmvnic.c | 269 ++++++++++++++++++++++++++++++++++++++++++++++++--------------------
drivers/net/ethernet/ibm/ibmvnic.h | 6 +-
drivers/net/ethernet/marvell/skge.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 36 ++++-----
drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c | 4 +-
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 89 ++++++++++++++---------
drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 +
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c | 4 +-
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c | 13 ++--
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c | 50 +++++++++----
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h | 7 +-
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 9 +++
drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c | 6 ++
drivers/net/ethernet/netronome/nfp/abm/cls.c | 14 +++-
drivers/net/ethernet/netronome/nfp/flower/main.c | 7 ++
drivers/net/ethernet/netx-eth.c | 497 -----------------------------------------------------------------------------------------------------------------------------
drivers/net/ethernet/ni/nixge.c | 2 +-
drivers/net/ethernet/nxp/Kconfig | 8 +-
drivers/net/ethernet/pensando/Kconfig | 4 +-
drivers/net/ethernet/pensando/ionic/ionic_debugfs.c | 2 +-
drivers/net/ethernet/pensando/ionic/ionic_lif.c | 1 +
drivers/net/ethernet/qlogic/qede/qede_fp.c | 3 +-
drivers/net/ethernet/socionext/netsec.c | 2 +-
drivers/net/ethernet/socionext/sni_ave.c | 8 +-
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 5 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 16 ++--
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
drivers/net/macsec.c | 1 +
drivers/net/phy/Kconfig | 6 +-
drivers/net/phy/micrel.c | 3 +
drivers/net/phy/national.c | 9 ++-
drivers/net/ppp/ppp_generic.c | 2 +
drivers/net/tap.c | 2 +-
drivers/net/usb/cdc_ncm.c | 6 +-
drivers/net/usb/usbnet.c | 8 ++
drivers/net/vrf.c | 3 +-
drivers/net/wireless/ath/Kconfig | 2 +-
drivers/net/wireless/ath/ar5523/Kconfig | 4 +-
drivers/net/wireless/ath/ath6kl/Kconfig | 2 +-
drivers/net/wireless/ath/ath9k/Kconfig | 2 +-
drivers/net/wireless/ath/carl9170/Kconfig | 6 +-
drivers/net/wireless/ath/wil6210/txrx.c | 2 +-
drivers/net/wireless/atmel/Kconfig | 32 ++++----
drivers/net/wireless/intel/ipw2x00/Kconfig | 116 ++++++++++++++---------------
drivers/net/wireless/intel/iwlegacy/Kconfig | 6 +-
drivers/net/wireless/intel/iwlwifi/Kconfig | 6 +-
drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 8 +-
drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 9 ++-
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 11 +--
drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h | 6 +-
drivers/net/wireless/ralink/rt2x00/Kconfig | 24 +++---
drivers/net/wireless/realtek/rtw88/mac.c | 3 -
drivers/net/wireless/realtek/rtw88/main.c | 4 +
drivers/net/wireless/realtek/rtw88/pci.c | 48 +++++++++---
drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 2 +-
drivers/nfc/st95hf/core.c | 2 +-
drivers/of/of_mdio.c | 2 +-
drivers/ptp/ptp_chardev.c | 4 +-
include/linux/mlx5/mlx5_ifc.h | 28 +++----
include/linux/platform_data/eth-netx.h | 13 ----
include/linux/skbuff.h | 9 +++
include/net/inet_timewait_sock.h | 1 +
include/net/ipv6.h | 2 +-
include/net/netfilter/nf_tables.h | 6 ++
include/net/route.h | 3 +-
include/net/sch_generic.h | 5 ++
include/uapi/linux/btf.h | 4 +-
include/uapi/linux/netfilter_bridge/ebtables.h | 6 +-
include/uapi/linux/ptp_clock.h | 22 ++++++
kernel/bpf/btf.c | 7 +-
kernel/bpf/xskmap.c | 2 +-
kernel/trace/bpf_trace.c | 26 +++++--
lib/Kconfig | 5 +-
net/appletalk/ddp.c | 5 ++
net/ax25/af_ax25.c | 2 +
net/batman-adv/Kconfig | 10 +--
net/core/dev.c | 4 +-
net/core/dst.c | 4 +-
net/core/skbuff.c | 2 +-
net/dccp/ipv6.c | 5 +-
net/ieee802154/socket.c | 3 +
net/ife/Kconfig | 2 +-
net/ipv4/Kconfig | 4 +-
net/ipv4/inet_connection_sock.c | 4 +-
net/ipv4/ip_forward.c | 2 +-
net/ipv4/ip_output.c | 3 +-
net/ipv4/route.c | 36 +++++----
net/ipv4/tcp_bbr.c | 8 +-
net/ipv4/tcp_ipv4.c | 4 +
net/ipv4/tcp_minisocks.c | 1 +
net/ipv4/tcp_timer.c | 5 +-
net/ipv4/xfrm4_policy.c | 1 +
net/ipv6/fib6_rules.c | 3 +-
net/ipv6/inet6_connection_sock.c | 2 +-
net/ipv6/ip6_fib.c | 2 +-
net/ipv6/ip6_output.c | 4 +-
net/ipv6/netfilter/Kconfig | 16 ++--
net/ipv6/tcp_ipv6.c | 24 +++---
net/kcm/kcmsock.c | 6 +-
net/ncsi/internal.h | 7 +-
net/ncsi/ncsi-manage.c | 98 +++----------------------
net/netfilter/Kconfig | 2 +-
net/netfilter/ipvs/Kconfig | 6 +-
net/netfilter/nf_tables_api.c | 25 ++++++-
net/netfilter/nf_tables_offload.c | 2 +-
net/netfilter/nft_flow_offload.c | 19 +++++
net/netfilter/nft_lookup.c | 3 -
net/nfc/llcp_sock.c | 7 +-
net/openvswitch/datapath.c | 2 +-
net/qrtr/qrtr.c | 1 +
net/rds/Kconfig | 4 +-
net/rds/bind.c | 5 +-
net/sched/Kconfig | 145 ++++++++++++++++++-------------------
net/sched/act_api.c | 34 +++++----
net/sched/act_sample.c | 1 +
net/sched/cls_api.c | 6 +-
net/sched/sch_api.c | 3 +-
net/sched/sch_cbs.c | 30 ++++----
net/sched/sch_htb.c | 4 +-
net/sched/sch_multiq.c | 23 ++++--
net/sched/sch_netem.c | 4 +-
net/sched/sch_sfb.c | 7 +-
net/sctp/ipv6.c | 2 +-
net/xdp/xdp_umem.c | 2 -
tools/lib/bpf/btf_dump.c | 94 ++++++++++++++++++++++--
tools/lib/bpf/xsk.c | 11 ---
tools/testing/selftests/bpf/prog_tests/tcp_rtt.c | 21 +++++-
tools/testing/selftests/bpf/progs/strobemeta.h | 5 +-
tools/testing/selftests/bpf/test_sysctl.c | 1 -
tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l2_drops.sh | 7 --
tools/testing/selftests/net/fib_nexthop_multiprefix.sh | 6 +-
tools/testing/selftests/net/fib_nexthops.sh | 14 ++++
tools/testing/selftests/net/fib_tests.sh | 21 +++++-
usr/include/Makefile | 1 -
169 files changed, 1225 insertions(+), 1307 deletions(-)
delete mode 100644 drivers/net/ethernet/netx-eth.c
delete mode 100644 include/linux/platform_data/eth-netx.h
^ permalink raw reply
* [PATCH] docs: networking: Add title caret and missing doc
From: Adam Zerella @ 2019-09-28 12:39 UTC (permalink / raw)
Cc: davem, netdev, linux-doc, adam.zerella
Resolving a couple of Sphinx documentation warnings
that are generated in the networking section.
- WARNING: document isn't included in any toctree
- WARNING: Title underline too short.
Signed-off-by: Adam Zerella <adam.zerella@gmail.com>
---
Documentation/networking/device_drivers/index.rst | 1 +
Documentation/networking/j1939.rst | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/Documentation/networking/device_drivers/index.rst b/Documentation/networking/device_drivers/index.rst
index f51f92571e39..1f4a629e7caa 100644
--- a/Documentation/networking/device_drivers/index.rst
+++ b/Documentation/networking/device_drivers/index.rst
@@ -24,6 +24,7 @@ Contents:
google/gve
mellanox/mlx5
pensando/ionic
+ netronome/nfp
.. only:: subproject and html
diff --git a/Documentation/networking/j1939.rst b/Documentation/networking/j1939.rst
index ce7e7a044e08..dc60b13fcd09 100644
--- a/Documentation/networking/j1939.rst
+++ b/Documentation/networking/j1939.rst
@@ -272,7 +272,7 @@ supported flags are:
* MSG_DONTWAIT, i.e. non-blocking operation.
recvmsg(2)
-^^^^^^^^^
+^^^^^^^^^^
In most cases recvmsg(2) is needed if you want to extract more information than
recvfrom(2) can provide. For example package priority and timestamp. The
--
2.20.1
^ permalink raw reply related
* Re: [PATCH bpf] libbpf: count present CPUs, not theoretically possible
From: Alan Maguire @ 2019-09-28 11:20 UTC (permalink / raw)
To: Andrii Nakryiko; +Cc: bpf, netdev, ast, daniel, andrii.nakryiko, kernel-team
In-Reply-To: <20190928063033.1674094-1-andriin@fb.com>
On Fri, 27 Sep 2019, Andrii Nakryiko wrote:
> This patch switches libbpf_num_possible_cpus() from using possible CPU
> set to present CPU set. This fixes issues with incorrect auto-sizing of
> PERF_EVENT_ARRAY map on HOTPLUG-enabled systems.
>
> On HOTPLUG enabled systems, /sys/devices/system/cpu/possible is going to
> be a set of any representable (i.e., potentially possible) CPU, which is
> normally way higher than real amount of CPUs (e.g., 0-127 on VM I've
> tested on, while there were just two CPU cores actually present).
> /sys/devices/system/cpu/present, on the other hand, will only contain
> CPUs that are physically present in the system (even if not online yet),
> which is what we really want, especially when creating per-CPU maps or
> perf events.
>
> On systems with HOTPLUG disabled, present and possible are identical, so
> there is no change of behavior there.
>
Just curious - is there a reason for not adding a new libbpf_num_present_cpus()
function to cover this case, and switching to using that in various places?
Looking at the places libbpf_num_possible_cpus() is called in libbpf
- __perf_buffer__new(): this could just change to use the number of
present CPUs, since perf_buffer__new_raw() with a cpu_cnt in struct
perf_buffer_raw_ops
- bpf_object__create_maps(), which is called via bpf_oject__load_xattr().
In this case it seems like switching to num present makes sense, though
it might make sense to add a field to struct bpf_object_load_attr * to
allow users to explicitly set another max value.
This would give the desired default behaviour, while still giving users
a way of specifying the possible number. What do you think? Thanks!
Alan
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> ---
> tools/lib/bpf/libbpf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index e0276520171b..45351c074e45 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -5899,7 +5899,7 @@ void bpf_program__bpil_offs_to_addr(struct bpf_prog_info_linear *info_linear)
>
> int libbpf_num_possible_cpus(void)
> {
> - static const char *fcpu = "/sys/devices/system/cpu/possible";
> + static const char *fcpu = "/sys/devices/system/cpu/present";
> int len = 0, n = 0, il = 0, ir = 0;
> unsigned int start = 0, end = 0;
> int tmp_cpus = 0;
> --
> 2.17.1
>
>
^ permalink raw reply
* RE: [PATCH net 0/8] net: stmmac: Fixes for -net
From: Jose Abreu @ 2019-09-28 9:01 UTC (permalink / raw)
To: Jose Abreu, netdev@vger.kernel.org
Cc: Joao Pinto, Giuseppe Cavallaro, Alexandre Torgue, David S. Miller,
Maxime Coquelin, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
In-Reply-To: <cover.1569569778.git.Jose.Abreu@synopsys.com>
From: Jose Abreu <Jose.Abreu@synopsys.com>
Date: Sep/27/2019, 08:48:48 (UTC+00:00)
> Misc fixes for -net tree. More info in commit logs.
David, please do not apply these. I forgot to rebase my tree against
-net and this was based on -next. I'll resend. Sorry for the mess :(
---
Thanks,
Jose Miguel Abreu
^ permalink raw reply
* pull-request: ieee802154 for net 2019-09-28
From: Stefan Schmidt @ 2019-09-28 7:57 UTC (permalink / raw)
To: davem; +Cc: linux-wpan, alex.aring, netdev
Hello Dave.
An update from ieee802154 for your *net* tree.
Three driver fixes. Navid Emamdoost fixed a memory leak on an error
path in the ca8210 driver, Johan Hovold fixed a use-after-free found
by syzbot in the atusb driver and Christophe JAILLET makes sure
__skb_put_data is used instead of memcpy in the mcr20a driver
I switched from branches to tags here to be pulled from. So far not
annotated and not signed. Once I fixed my scripts it should contain
this messages as annotations. If you want it signed as well just tell
me. If there are any problems let me know.
regards
Stefan Schmidt
The following changes since commit f53a7ad189594a112167efaf17ea8d0242b5ac00:
r8152: Set memory to all 0xFFs on failed reg reads (2019-08-25 19:52:59 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan.git tags/ieee802154-for-davem-2019-09-28
for you to fetch changes up to 6402939ec86eaf226c8b8ae00ed983936b164908:
ieee802154: ca8210: prevent memory leak (2019-09-27 21:57:42 +0200)
----------------------------------------------------------------
Christophe JAILLET (1):
ieee802154: mcr20a: simplify a bit 'mcr20a_handle_rx_read_buf_complete()'
Johan Hovold (1):
ieee802154: atusb: fix use-after-free at disconnect
Navid Emamdoost (1):
ieee802154: ca8210: prevent memory leak
drivers/net/ieee802154/atusb.c | 3 ++-
drivers/net/ieee802154/ca8210.c | 2 +-
drivers/net/ieee802154/mcr20a.c | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
^ permalink raw reply
* [PATCH bpf] libbpf: count present CPUs, not theoretically possible
From: Andrii Nakryiko @ 2019-09-28 6:30 UTC (permalink / raw)
To: bpf, netdev, ast, daniel; +Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko
This patch switches libbpf_num_possible_cpus() from using possible CPU
set to present CPU set. This fixes issues with incorrect auto-sizing of
PERF_EVENT_ARRAY map on HOTPLUG-enabled systems.
On HOTPLUG enabled systems, /sys/devices/system/cpu/possible is going to
be a set of any representable (i.e., potentially possible) CPU, which is
normally way higher than real amount of CPUs (e.g., 0-127 on VM I've
tested on, while there were just two CPU cores actually present).
/sys/devices/system/cpu/present, on the other hand, will only contain
CPUs that are physically present in the system (even if not online yet),
which is what we really want, especially when creating per-CPU maps or
perf events.
On systems with HOTPLUG disabled, present and possible are identical, so
there is no change of behavior there.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
tools/lib/bpf/libbpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index e0276520171b..45351c074e45 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -5899,7 +5899,7 @@ void bpf_program__bpil_offs_to_addr(struct bpf_prog_info_linear *info_linear)
int libbpf_num_possible_cpus(void)
{
- static const char *fcpu = "/sys/devices/system/cpu/possible";
+ static const char *fcpu = "/sys/devices/system/cpu/present";
int len = 0, n = 0, il = 0, ir = 0;
unsigned int start = 0, end = 0;
int tmp_cpus = 0;
--
2.17.1
^ permalink raw reply related
* Re: [PATCH] net/mlx5: fix memory leak in mlx5_fw_fatal_reporter_dump
From: Leon Romanovsky @ 2019-09-28 6:07 UTC (permalink / raw)
To: Navid Emamdoost
Cc: emamd001, kjlu, smccaman, Saeed Mahameed, David S. Miller, netdev,
linux-rdma, linux-kernel
In-Reply-To: <20190927223729.18043-1-navid.emamdoost@gmail.com>
On Fri, Sep 27, 2019 at 05:37:28PM -0500, Navid Emamdoost wrote:
> In mlx5_fw_fatal_reporter_dump if mlx5_crdump_collect fails the
> allocated memory for cr_data must be released otherwise there will be
> memory leak. To fix this, this commit changes the return instruction
> into goto error handling.
>
> Fixes: 9b1f29823605 ("net/mlx5: Add support for FW fatal reporter dump")
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/health.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
General note, if you don't write "To:" in your emails, most probably
your emails will be missed by relevant people.
I assume that Saeed will pick this patch and fix extra line between
Fixes and SOB.
Thanks, for fixing it.
^ permalink raw reply
* Re: [RFC 12/20] RDMA/irdma: Implement device supported verb APIs
From: Leon Romanovsky @ 2019-09-28 6:00 UTC (permalink / raw)
To: Saleem, Shiraz
Cc: Kirsher, Jeffrey T, dledford@redhat.com, jgg@mellanox.com,
gregkh@linuxfoundation.org, Ismail, Mustafa,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org
In-Reply-To: <9DD61F30A802C4429A01CA4200E302A7AC70468F@fmsmsx123.amr.corp.intel.com>
On Fri, Sep 27, 2019 at 02:28:41PM +0000, Saleem, Shiraz wrote:
> > Subject: Re: [RFC 12/20] RDMA/irdma: Implement device supported verb APIs
> >
> > On Thu, Sep 26, 2019 at 07:49:52PM +0000, Saleem, Shiraz wrote:
> > > > Subject: Re: [RFC 12/20] RDMA/irdma: Implement device supported verb
> > > > APIs
> > > >
> > > > On Thu, Sep 26, 2019 at 09:45:11AM -0700, Jeff Kirsher wrote:
> > > > > From: Mustafa Ismail <mustafa.ismail@intel.com>
> > > > >
> > > > > Implement device supported verb APIs. The supported APIs vary
> > > > > based on the underlying transport the ibdev is registered as (i.e.
> > > > > iWARP or RoCEv2).
> > > > >
> > > > > Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
> > > > > Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
> > > > > ---
> > > > > drivers/infiniband/hw/irdma/verbs.c | 4346 ++++++++++++++++++++++
> > > > > drivers/infiniband/hw/irdma/verbs.h | 199 +
> > > > > include/uapi/rdma/rdma_user_ioctl_cmds.h | 1 +
> > > > > 3 files changed, 4546 insertions(+) create mode 100644
> > > > > drivers/infiniband/hw/irdma/verbs.c
> > > > > create mode 100644 drivers/infiniband/hw/irdma/verbs.h
> > > > >
> > > > > diff --git a/drivers/infiniband/hw/irdma/verbs.c
> > > > > b/drivers/infiniband/hw/irdma/verbs.c
> > > > > new file mode 100644
> > > > > index 000000000000..025c21c722e2
> > > > > --- /dev/null
> > > > > +++ b/drivers/infiniband/hw/irdma/verbs.c
> > > > > @@ -0,0 +1,4346 @@
> > > > > +// SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB
> > > > > +/* Copyright (c) 2019, Intel Corporation. */
> > > >
> > > > <...>
> > > >
> > > > > +
> > > > > + size = sqdepth * sizeof(struct irdma_sq_uk_wr_trk_info) +
> > > > > + (rqdepth << 3);
> > > > > + iwqp->kqp.wrid_mem = kzalloc(size, GFP_KERNEL);
> > > > > + if (!iwqp->kqp.wrid_mem)
> > > > > + return -ENOMEM;
> > > > > +
> > > > > + ukinfo->sq_wrtrk_array = (struct irdma_sq_uk_wr_trk_info *)
> > > > > + iwqp->kqp.wrid_mem;
> > > > > + if (!ukinfo->sq_wrtrk_array)
> > > > > + return -ENOMEM;
> > > >
> > > > You are leaking resources here, forgot to do proper error unwinding.
> > > >
> > >
> > > irdma_free_qp_rsrc() will free up that memory in case of an error.
> >
> > I'm talking about kqp.wrid_mem you allocated a couple of lines above and didn't
> > free in case of sq_wrtrk_array allocation failed.
> >
> Yes, I am referring to kqp.wrid_mem as well
> In case of err, all memory resources setup for
> the QP is freed in the common utility irdma_free_qp_rsrc()
> including the kqp.wrid_mem.
I see it as an anti-pattern, you have function to setup and it shouldn't
return half initialized state and rely on some other function to clean
the mess.
Current code is written in a way that makes very hard to check for
unwinding errors.
Thanks
^ permalink raw reply
* Re: nfp: abm: fix memory leak in nfp_abm_u32_knode_replace
From: Markus Elfring @ 2019-09-28 5:55 UTC (permalink / raw)
To: Jakub Kicinski, Navid Emamdoost, netdev, oss-drivers
Cc: Navid Emamdoost, Kangjie Lu, Stephen A McCamant, Colin Ian King,
David S. Miller, John Hurley, Pablo Neira, linux-kernel,
kernel-janitors
In-Reply-To: <20190927144242.7e0d8fde@cakuba.netronome.com>
>> Can such a change variant be a bit nicer?
>
> Definitely not.
>
> Looks good as is, thanks Navid!
I find it interesting how the software development opinions are different
also in this use case for the implementation of correct and efficient
exception handling.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=f1f2f614d535564992f32e720739cb53cf03489f#n450
Regards,
Markus
^ permalink raw reply
* Re: [RFC 20/20] RDMA/i40iw: Mark i40iw as deprecated
From: Leon Romanovsky @ 2019-09-28 5:55 UTC (permalink / raw)
To: Doug Ledford
Cc: gregkh@linuxfoundation.org, Saleem, Shiraz, Kirsher, Jeffrey T,
jgg@mellanox.com, netdev@vger.kernel.org,
linux-rdma@vger.kernel.org
In-Reply-To: <bc18503dcace47150d5f45e8669d7978e18a38f9.camel@redhat.com>
On Fri, Sep 27, 2019 at 04:17:15PM -0400, Doug Ledford wrote:
> On Thu, 2019-09-26 at 21:55 +0200, gregkh@linuxfoundation.org wrote:
> > On Thu, Sep 26, 2019 at 07:49:44PM +0000, Saleem, Shiraz wrote:
> > > > Subject: Re: [RFC 20/20] RDMA/i40iw: Mark i40iw as deprecated
> > > >
> > > > On Thu, Sep 26, 2019 at 09:45:19AM -0700, Jeff Kirsher wrote:
> > > > > From: Shiraz Saleem <shiraz.saleem@intel.com>
> > > > >
> > > > > Mark i40iw as deprecated/obsolete.
> > > > >
> > > > > irdma is the replacement driver that supports X722.
> > > >
> > > > Can you simply delete old one and add MODULE_ALIAS() in new
> > > > driver?
> > > >
> > >
> > > Yes, but we thought typically driver has to be deprecated for a few
> > > cycles before removing it.
> >
> > If you completely replace it with something that works the same, why
> > keep the old one around at all?
> >
> > Unless you don't trust your new code? :)
>
> I have yet to see, in over 20 years of kernel experience, a new driver
> replace an old driver and not initially be more buggy and troublesome
> than the old driver. It takes time and real world usage for the final
> issues to get sorted out. During that time, the fallback is often
> necessary for those real world users.
How many real users exist in RDMA world who run pure upstream kernel?
Thanks
>
> --
> Doug Ledford <dledford@redhat.com>
> GPG KeyID: B826A3330E572FDD
> Fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
^ permalink raw reply
* Re: [RFC 15/20] RDMA/irdma: Add miscellaneous utility definitions
From: Leon Romanovsky @ 2019-09-28 5:53 UTC (permalink / raw)
To: gregkh@linuxfoundation.org
Cc: Saleem, Shiraz, Kirsher, Jeffrey T, dledford@redhat.com,
jgg@mellanox.com, Ismail, Mustafa, netdev@vger.kernel.org,
linux-rdma@vger.kernel.org
In-Reply-To: <20190927182346.GE1804168@kroah.com>
On Fri, Sep 27, 2019 at 08:23:46PM +0200, gregkh@linuxfoundation.org wrote:
> On Fri, Sep 27, 2019 at 02:28:20PM +0000, Saleem, Shiraz wrote:
> > > Subject: Re: [RFC 15/20] RDMA/irdma: Add miscellaneous utility definitions
> > >
> > > On Thu, Sep 26, 2019 at 07:49:33PM +0000, Saleem, Shiraz wrote:
> > > > > Subject: Re: [RFC 15/20] RDMA/irdma: Add miscellaneous utility
> > > > > definitions
> > > > >
> > > > > On Thu, Sep 26, 2019 at 09:45:14AM -0700, Jeff Kirsher wrote:
> > > > > > From: Mustafa Ismail <mustafa.ismail@intel.com>
> > > > > >
> > > > > > Add miscellaneous utility functions and headers.
> > > > > >
> > > > > > Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
> > > > > > Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
> > > > > > ---
> > > > > > drivers/infiniband/hw/irdma/osdep.h | 108 ++
> > > > > > drivers/infiniband/hw/irdma/protos.h | 96 ++
> > > > > > drivers/infiniband/hw/irdma/status.h | 70 +
> > > > > > drivers/infiniband/hw/irdma/utils.c | 2333
> > > > > > ++++++++++++++++++++++++++
> > > > > > 4 files changed, 2607 insertions(+) create mode 100644
> > > > > > drivers/infiniband/hw/irdma/osdep.h
> > > > > > create mode 100644 drivers/infiniband/hw/irdma/protos.h
> > > > > > create mode 100644 drivers/infiniband/hw/irdma/status.h
> > > > > > create mode 100644 drivers/infiniband/hw/irdma/utils.c
> > > > > >
> > > > > > diff --git a/drivers/infiniband/hw/irdma/osdep.h
> > > > > > b/drivers/infiniband/hw/irdma/osdep.h
> > > > > > new file mode 100644
> > > > > > index 000000000000..5885b6fa413d
> > > > > > --- /dev/null
> > > > > > +++ b/drivers/infiniband/hw/irdma/osdep.h
> > > > > > @@ -0,0 +1,108 @@
> > > > > > +/* SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB */
> > > > > > +/* Copyright (c) 2019, Intel Corporation. */
> > > > > > +
> > > > > > +#ifndef IRDMA_OSDEP_H
> > > > > > +#define IRDMA_OSDEP_H
> > > > > > +
> > > > > > +#include <linux/version.h>
> > > > > > +#include <linux/kernel.h>
> > > > > > +#include <linux/vmalloc.h>
> > > > > > +#include <linux/string.h>
> > > > > > +#include <linux/bitops.h>
> > > > > > +#include <linux/pci.h>
> > > > > > +#include <net/tcp.h>
> > > > > > +#include <crypto/hash.h>
> > > > > > +/* get readq/writeq support for 32 bit kernels, use the low-first
> > > > > > +version */ #include <linux/io-64-nonatomic-lo-hi.h>
> > > > > > +
> > > > > > +#define MAKEMASK(m, s) ((m) << (s))
> > > > >
> > > > > It is a little bit over-macro.
> > > > >
> > > >
> > > > Why is this a problem?
> > > > We are not translating any basic kernel construct here.
> > >
> > > See BIT() definition.
> > >
> > OK. And?
>
> And you just re-created GENMASK(). Please use in-kernel definitions
> instead of creating your own.
More on that, they also redefined so basic C-operation that it looks
embarrassing. I tried to find any advantages of doing that and failed.
* Does it save typing (less to type) significantly ? - No
* Is it different between compilers/archs? - No
* Is it so tricky that average developer needs helper? - No
Thanks
>
> thanks,
>
> greg k-h
^ permalink raw reply
* [PATCH iproute2 net-next 2/2] ipneigh: neigh get support
From: Roopa Prabhu @ 2019-09-28 4:48 UTC (permalink / raw)
To: dsahern; +Cc: netdev, nikolay, stephen
In-Reply-To: <1569646104-358-1-git-send-email-roopa@cumulusnetworks.com>
From: Roopa Prabhu <roopa@cumulusnetworks.com>
This patch adds support to lookup a neigh entry
using recently added support in the kernel using RTM_GETNEIGH
example:
$ip neigh get 10.0.2.4 dev test-dummy0
10.0.2.4 dev test-dummy0 lladdr de:ad:be:ef:13:37 PERMANENT
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
ip/ipneigh.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++---
man/man8/ip-neighbour.8 | 29 +++++++++++++++++
2 files changed, 109 insertions(+), 4 deletions(-)
diff --git a/ip/ipneigh.c b/ip/ipneigh.c
index a3869c8..c88c346 100644
--- a/ip/ipneigh.c
+++ b/ip/ipneigh.c
@@ -55,6 +55,7 @@ static void usage(void)
"\n"
" ip neigh { show | flush } [ proxy ] [ to PREFIX ] [ dev DEV ] [ nud STATE ]\n"
" [ vrf NAME ]\n"
+ " ip neigh get { ADDR | proxy ADDR } dev DEV\n"
"\n"
"STATE := { permanent | noarp | stale | reachable | none |\n"
" incomplete | delay | probe | failed }\n");
@@ -599,6 +600,83 @@ static int do_show_or_flush(int argc, char **argv, int flush)
return 0;
}
+static int ipneigh_get(int argc, char **argv)
+{
+ struct {
+ struct nlmsghdr n;
+ struct ndmsg ndm;
+ char buf[1024];
+ } req = {
+ .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)),
+ .n.nlmsg_flags = NLM_F_REQUEST,
+ .n.nlmsg_type = RTM_GETNEIGH,
+ .ndm.ndm_family = preferred_family,
+ };
+ struct nlmsghdr *answer;
+ char *d = NULL;
+ int dst_ok = 0;
+ int dev_ok = 0;
+ inet_prefix dst;
+
+ while (argc > 0) {
+ if (strcmp(*argv, "dev") == 0) {
+ NEXT_ARG();
+ d = *argv;
+ dev_ok = 1;
+ } else if (matches(*argv, "proxy") == 0) {
+ NEXT_ARG();
+ if (matches(*argv, "help") == 0)
+ usage();
+ if (dst_ok)
+ duparg("address", *argv);
+ get_addr(&dst, *argv, preferred_family);
+ dst_ok = 1;
+ dev_ok = 1;
+ req.ndm.ndm_flags |= NTF_PROXY;
+ } else {
+ if (strcmp(*argv, "to") == 0)
+ NEXT_ARG();
+
+ if (matches(*argv, "help") == 0)
+ usage();
+ if (dst_ok)
+ duparg2("to", *argv);
+ get_addr(&dst, *argv, preferred_family);
+ dst_ok = 1;
+ }
+ argc--; argv++;
+ }
+
+ if (!dev_ok || !dst_ok || dst.family == AF_UNSPEC) {
+ fprintf(stderr, "Device and address are required arguments.\n");
+ return -1;
+ }
+
+ req.ndm.ndm_family = dst.family;
+ if (addattr_l(&req.n, sizeof(req), NDA_DST, &dst.data, dst.bytelen) < 0)
+ return -1;
+
+ if (d) {
+ ll_init_map(&rth);
+ req.ndm.ndm_ifindex = ll_name_to_index(d);
+ if (!req.ndm.ndm_ifindex) {
+ fprintf(stderr, "Cannot find device \"%s\"\n", d);
+ return -1;
+ }
+ }
+
+ if (rtnl_talk(&rth, &req.n, &answer) < 0)
+ return -2;
+
+ ipneigh_reset_filter(0);
+ if (print_neigh(answer, (void *)stdout) < 0) {
+ fprintf(stderr, "An error :-)\n");
+ return -1;
+ }
+
+ return 0;
+}
+
int do_ipneigh(int argc, char **argv)
{
if (argc > 0) {
@@ -611,10 +689,8 @@ int do_ipneigh(int argc, char **argv)
return ipneigh_modify(RTM_NEWNEIGH, NLM_F_CREATE|NLM_F_REPLACE, argc-1, argv+1);
if (matches(*argv, "delete") == 0)
return ipneigh_modify(RTM_DELNEIGH, 0, argc-1, argv+1);
- if (matches(*argv, "get") == 0) {
- fprintf(stderr, "Sorry, \"neigh get\" is not implemented :-(\n");
- return -1;
- }
+ if (matches(*argv, "get") == 0)
+ return ipneigh_get(argc-1, argv+1);
if (matches(*argv, "show") == 0 ||
matches(*argv, "lst") == 0 ||
matches(*argv, "list") == 0)
diff --git a/man/man8/ip-neighbour.8 b/man/man8/ip-neighbour.8
index 4a672bb..bc77b43 100644
--- a/man/man8/ip-neighbour.8
+++ b/man/man8/ip-neighbour.8
@@ -38,6 +38,12 @@ ip-neighbour \- neighbour/arp tables management.
.IR NAME " ] "
.ti -8
+.B ip neigh get
+.IR ADDR
+.B dev
+.IR DEV
+
+.ti -8
.IR STATE " := {"
.BR permanent " | " noarp " | " stale " | " reachable " | " none " |"
.BR incomplete " | " delay " | " probe " | " failed " }"
@@ -231,6 +237,23 @@ twice,
also dumps all the deleted neighbours.
.RE
+.TP
+ip neigh get
+lookup a neighbour entry to a destination given a device
+.RS
+
+.TP
+.BI proxy
+indicates whether we should lookup a proxy neigbour entry
+
+.TP
+.BI to " ADDRESS " (default)
+the prefix selecting the neighbour to query.
+
+.TP
+.BI dev " NAME"
+get neighbour entry attached to this device.
+
.SH EXAMPLES
.PP
ip neighbour
@@ -242,6 +265,12 @@ ip neigh flush dev eth0
.RS
Removes entries in the neighbour table on device eth0.
.RE
+.PP
+ip neigh get 10.0.1.10 dev eth0
+.RS
+Performs a neighbour lookup in the kernel and returns
+a neighbour entry.
+.RE
.SH SEE ALSO
.br
--
2.1.4
^ permalink raw reply related
* [PATCH iproute2 net-next 1/2] bridge: fdb get support
From: Roopa Prabhu @ 2019-09-28 4:48 UTC (permalink / raw)
To: dsahern; +Cc: netdev, nikolay, stephen
In-Reply-To: <1569646104-358-1-git-send-email-roopa@cumulusnetworks.com>
From: Roopa Prabhu <roopa@cumulusnetworks.com>
This patch adds support to lookup a bridge fdb entry
using recently added support in the kernel using RTM_GETNEIGH
(and AF_BRIDGE family).
example:
$bridge fdb get 02:02:00:00:00:03 dev test-dummy0 vlan 1002
02:02:00:00:00:03 dev test-dummy0 vlan 1002 master bridge
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
bridge/fdb.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
man/man8/bridge.8 | 40 +++++++++++++++++++
2 files changed, 152 insertions(+), 1 deletion(-)
diff --git a/bridge/fdb.c b/bridge/fdb.c
index 941ce2d..a0229cd 100644
--- a/bridge/fdb.c
+++ b/bridge/fdb.c
@@ -40,7 +40,9 @@ static void usage(void)
" [ sticky ] [ local | static | dynamic ] [ dst IPADDR ]\n"
" [ vlan VID ] [ port PORT] [ vni VNI ] [ via DEV ]\n"
" [ src_vni VNI ]\n"
- " bridge fdb [ show [ br BRDEV ] [ brport DEV ] [ vlan VID ] [ state STATE ] ]\n");
+ " bridge fdb [ show [ br BRDEV ] [ brport DEV ] [ vlan VID ] [ state STATE ] ]\n"
+ " bridge fdb get ADDR [ br BRDEV ] { brport |dev } DEV [ vlan VID ]\n"
+ " [ vni VNI ]\n");
exit(-1);
}
@@ -518,6 +520,113 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv)
return 0;
}
+static int fdb_get(int argc, char **argv)
+{
+ struct {
+ struct nlmsghdr n;
+ struct ndmsg ndm;
+ char buf[1024];
+ } req = {
+ .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)),
+ .n.nlmsg_flags = NLM_F_REQUEST,
+ .n.nlmsg_type = RTM_GETNEIGH,
+ .ndm.ndm_family = AF_BRIDGE,
+ };
+ struct nlmsghdr *answer;
+ char *addr = NULL;
+ char *d = NULL, *br = NULL;
+ char abuf[ETH_ALEN];
+ unsigned long vni = ~0;
+ int br_ifindex = 0;
+ char *endptr;
+ short vlan = -1;
+
+ while (argc > 0) {
+ if ((strcmp(*argv, "brport") == 0) || strcmp(*argv, "dev") == 0) {
+ NEXT_ARG();
+ d = *argv;
+ } else if (strcmp(*argv, "br") == 0) {
+ NEXT_ARG();
+ br = *argv;
+ } else if (strcmp(*argv, "dev") == 0) {
+ NEXT_ARG();
+ d = *argv;
+ } else if (strcmp(*argv, "vni") == 0) {
+ NEXT_ARG();
+ vni = strtoul(*argv, &endptr, 0);
+ if ((endptr && *endptr) ||
+ (vni >> 24) || vni == ULONG_MAX)
+ invarg("invalid VNI\n", *argv);
+ } else if (strcmp(*argv, "self") == 0) {
+ req.ndm.ndm_flags |= NTF_SELF;
+ } else if (matches(*argv, "master") == 0) {
+ req.ndm.ndm_flags |= NTF_MASTER;
+ } else if (matches(*argv, "vlan") == 0) {
+ if (vlan >= 0)
+ duparg2("vlan", *argv);
+ NEXT_ARG();
+ vlan = atoi(*argv);
+ } else {
+ if (strcmp(*argv, "to") == 0)
+ NEXT_ARG();
+
+ if (matches(*argv, "help") == 0)
+ usage();
+ if (addr)
+ duparg2("to", *argv);
+ addr = *argv;
+ }
+ argc--; argv++;
+ }
+
+ if ((d == NULL && br == NULL) || addr == NULL) {
+ fprintf(stderr, "Device or master and address are required arguments.\n");
+ return -1;
+ }
+
+ if (sscanf(addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
+ abuf, abuf+1, abuf+2,
+ abuf+3, abuf+4, abuf+5) != 6) {
+ fprintf(stderr, "Invalid mac address %s\n", addr);
+ return -1;
+ }
+
+ addattr_l(&req.n, sizeof(req), NDA_LLADDR, abuf, ETH_ALEN);
+
+ if (vlan >= 0)
+ addattr16(&req.n, sizeof(req), NDA_VLAN, vlan);
+
+ if (vni != ~0)
+ addattr32(&req.n, sizeof(req), NDA_VNI, vni);
+
+ if (d) {
+ req.ndm.ndm_ifindex = ll_name_to_index(d);
+ if (!req.ndm.ndm_ifindex) {
+ fprintf(stderr, "Cannot find device \"%s\"\n", d);
+ return -1;
+ }
+ }
+
+ if (br) {
+ br_ifindex = ll_name_to_index(br);
+ if (!br_ifindex) {
+ fprintf(stderr, "Cannot find bridge device \"%s\"\n", br);
+ return -1;
+ }
+ addattr32(&req.n, sizeof(req), NDA_MASTER, br_ifindex);
+ }
+
+ if (rtnl_talk(&rth, &req.n, &answer) < 0)
+ return -2;
+
+ if (print_fdb(answer, (void *)stdout) < 0) {
+ fprintf(stderr, "An error :-)\n");
+ return -1;
+ }
+
+ return 0;
+}
+
int do_fdb(int argc, char **argv)
{
ll_init_map(&rth);
@@ -531,6 +640,8 @@ int do_fdb(int argc, char **argv)
return fdb_modify(RTM_NEWNEIGH, NLM_F_CREATE|NLM_F_REPLACE, argc-1, argv+1);
if (matches(*argv, "delete") == 0)
return fdb_modify(RTM_DELNEIGH, 0, argc-1, argv+1);
+ if (matches(*argv, "get") == 0)
+ return fdb_get(argc-1, argv+1);
if (matches(*argv, "show") == 0 ||
matches(*argv, "lst") == 0 ||
matches(*argv, "list") == 0)
diff --git a/man/man8/bridge.8 b/man/man8/bridge.8
index bb4fb52..10f6cf0 100644
--- a/man/man8/bridge.8
+++ b/man/man8/bridge.8
@@ -93,6 +93,17 @@ bridge \- show / manipulate bridge addresses and devices
.IR STATE " ]"
.ti -8
+.B bridge fdb get
+.I LLADDR " [ "
+.B dev
+.IR DEV " ] [ "
+.B br
+.IR BRDEV " ] [ "
+.B vlan
+.IR VID " ] ["
+.BR self " ] [ " master " ]"
+
+.ti -8
.BR "bridge mdb" " { " add " | " del " } "
.B dev
.IR DEV
@@ -550,6 +561,35 @@ With the
option, the command becomes verbose. It prints out the last updated
and last used time for each entry.
+.SS bridge fdb get - get bridge forwarding entry.
+
+lookup a bridge forwarding table entry.
+
+.TP
+.BI "LLADDR"
+the Ethernet MAC address.
+
+.TP
+.BI dev " DEV"
+the interface to which this address is associated.
+
+.TP
+.BI brport " DEV"
+the bridge port to which this address is associated. same as dev above.
+
+.TP
+.BI br " DEV"
+the bridge to which this address is associated.
+
+.TP
+.B self
+- the address is associated with the port drivers fdb. Usually hardware.
+
+.TP
+.B master
+- the address is associated with master devices fdb. Usually software (default).
+.sp
+
.SH bridge mdb - multicast group database management
.B mdb
--
2.1.4
^ permalink raw reply related
* [PATCH iproute2 net-next 0/2] support for bridge fdb and neigh get
From: Roopa Prabhu @ 2019-09-28 4:48 UTC (permalink / raw)
To: dsahern; +Cc: netdev, nikolay, stephen
From: Roopa Prabhu <roopa@cumulusnetworks.com>
This series adds iproute2 support to lookup a bridge fdb and
neigh entry.
example:
$bridge fdb get 02:02:00:00:00:03 dev test-dummy0 vlan 1002
02:02:00:00:00:03 dev test-dummy0 vlan 1002 master bridge
$ip neigh get 10.0.2.4 dev test-dummy0
10.0.2.4 dev test-dummy0 lladdr de:ad:be:ef:13:37 PERMANENT
Roopa Prabhu (2):
bridge: fdb get support
ipneigh: neigh get support
bridge/fdb.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++-
ip/ipneigh.c | 72 ++++++++++++++++++++++++++++--
man/man8/bridge.8 | 35 +++++++++++++++
man/man8/ip-neighbour.8 | 25 +++++++++++
4 files changed, 240 insertions(+), 5 deletions(-)
--
2.1.4
^ permalink raw reply
* Re: KASAN: slab-out-of-bounds Read in bpf_prog_create
From: Eric Biggers @ 2019-09-28 3:15 UTC (permalink / raw)
To: Arnd Bergmann, Al Viro
Cc: syzbot, ast, bpf, daniel, davem, hawk, jakub.kicinski,
john.fastabend, kafai, linux-fsdevel, linux-kernel, linux-ppp,
netdev, paulus, songliubraving, syzkaller-bugs, yhs
In-Reply-To: <000000000000cacc7e0592c42ce3@google.com>
Arnd and Al,
On Tue, Sep 17, 2019 at 11:49:06AM -0700, syzbot wrote:
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit: 2015a28f Add linux-next specific files for 20190915
> git tree: linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=11880d69600000
> kernel config: https://syzkaller.appspot.com/x/.config?x=110691c2286b679a
> dashboard link: https://syzkaller.appspot.com/bug?extid=eb853b51b10f1befa0b7
> compiler: gcc (GCC) 9.0.0 20181231 (experimental)
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=127c3481600000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1150a70d600000
>
> The bug was bisected to:
>
> commit 2f4fa2db75e26995709043c8d3de4632ebed5c4b
> Author: Al Viro <viro@zeniv.linux.org.uk>
> Date: Thu Apr 18 03:48:01 2019 +0000
>
> compat_ioctl: unify copy-in of ppp filters
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=145eee1d600000
> final crash: https://syzkaller.appspot.com/x/report.txt?x=165eee1d600000
> console output: https://syzkaller.appspot.com/x/log.txt?x=125eee1d600000
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+eb853b51b10f1befa0b7@syzkaller.appspotmail.com
> Fixes: 2f4fa2db75e2 ("compat_ioctl: unify copy-in of ppp filters")
>
> ==================================================================
> BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:404 [inline]
> BUG: KASAN: slab-out-of-bounds in bpf_prog_create+0xe9/0x250
> net/core/filter.c:1351
> Read of size 32768 at addr ffff88809cf74000 by task syz-executor183/8575
>
> CPU: 0 PID: 8575 Comm: syz-executor183 Not tainted 5.3.0-rc8-next-20190915
> #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
> __dump_stack lib/dump_stack.c:77 [inline]
> dump_stack+0x172/0x1f0 lib/dump_stack.c:113
> print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
> __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
> kasan_report+0x12/0x20 mm/kasan/common.c:634
> check_memory_region_inline mm/kasan/generic.c:185 [inline]
> check_memory_region+0x134/0x1a0 mm/kasan/generic.c:192
> memcpy+0x24/0x50 mm/kasan/common.c:122
> memcpy include/linux/string.h:404 [inline]
> bpf_prog_create+0xe9/0x250 net/core/filter.c:1351
> get_filter.isra.0+0x108/0x1a0 drivers/net/ppp/ppp_generic.c:572
> ppp_get_filter drivers/net/ppp/ppp_generic.c:584 [inline]
> ppp_ioctl+0x129d/0x2590 drivers/net/ppp/ppp_generic.c:801
This is a correct bisection. This commit needs:
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index 267fe2c58087..f55d7937d6c5 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -564,8 +564,9 @@ static struct bpf_prog *get_filter(struct sock_fprog *uprog)
return NULL;
/* uprog->len is unsigned short, so no overflow here */
- fprog.len = uprog->len * sizeof(struct sock_filter);
- fprog.filter = memdup_user(uprog->filter, fprog.len);
+ fprog.len = uprog->len;
+ fprog.filter = memdup_user(uprog->filter,
+ uprog->len * sizeof(struct sock_filter));
if (IS_ERR(fprog.filter))
return ERR_CAST(fprog.filter);
^ permalink raw reply related
* Re: [PATCH V2] net: dsa: microchip: Always set regmap stride to 1
From: Marek Vasut @ 2019-09-28 1:56 UTC (permalink / raw)
To: George McCollister
Cc: netdev, Andrew Lunn, David S . Miller, Florian Fainelli,
Tristram Ha, Vivien Didelot, Woojung Huh
In-Reply-To: <CAFSKS=PFBewpMiMXuPmJXqv=sbYhS8_9k=DrwAXjjPNi7xFwcA@mail.gmail.com>
On 9/26/19 3:52 PM, George McCollister wrote:
> On Wed, Sep 25, 2019 at 5:08 PM Marek Vasut wrote:
>>
>> The regmap stride is set to 1 for regmap describing 8bit registers already.
>> However, for 16/32/64bit registers, the stride is 2/4/8 respectively. This
>> is not correct, as the switch protocol supports unaligned register reads
>> and writes and the KSZ87xx even uses such unaligned register accesses to
>> read e.g. MIB counter.
>>
>> This patch fixes MIB counter access on KSZ87xx.
>
> After looking through a couple hundred pages of register documentation
> for KSZ9477 and KSZ9567 I find only registers that are aligned to
> their width. In my testing the KSZ9567 works fine with and without the
> patch. The only downside is that all of the unaligned registers
> needlessly show up in the debugfs regmap, this doesn't really matter
> though. As long as it fixes the issues on KSZ87xx this looks fine to
> me.
Right.
To avoid exposing all registers through regmap debugfs entries, we would
have to define the regmap constrains for
readable/writeable/volatile/precious registers, which we should
eventually do anyway, but that's way beyond the scope of this fix.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox