Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net-next] net: ethernet: ti: cpdma: correct error handling for chan create
From: David Miller @ 2017-12-06 21:38 UTC (permalink / raw)
  To: ivan.khoronzhuk; +Cc: grygorii.strashko, netdev, linux-omap, linux-kernel
In-Reply-To: <1512572050-13442-1-git-send-email-ivan.khoronzhuk@linaro.org>

From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Date: Wed,  6 Dec 2017 16:54:09 +0200

> @@ -3065,10 +3065,16 @@ static int cpsw_probe(struct platform_device *pdev)
>  	}
>  
>  	cpsw->txv[0].ch = cpdma_chan_create(cpsw->dma, 0, cpsw_tx_handler, 0);
> +	if (WARN_ON(IS_ERR(cpsw->txv[0].ch))) {
> +		dev_err(priv->dev, "error initializing tx dma channel\n");
> +		ret = PTR_ERR(cpsw->txv[0].ch);
> +		goto clean_dma_ret;
> +	}
> +

You're already emitting a proper dev_err() message, therefore WARN_ON()
is a duplicate notification to the logs and therefore not appropriate.

^ permalink raw reply

* Re: [PATCH net-next] net: ethernet: ti: cpdma: rate is not changed - correct case
From: David Miller @ 2017-12-06 21:35 UTC (permalink / raw)
  To: ivan.khoronzhuk; +Cc: grygorii.strashko, netdev, linux-omap, linux-kernel
In-Reply-To: <1512571278-13196-1-git-send-email-ivan.khoronzhuk@linaro.org>

From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Date: Wed,  6 Dec 2017 16:41:18 +0200

> If rate is the same as set it's correct case.
> 
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
> ---
> Based on net-next/master
> 
>  drivers/net/ethernet/ti/davinci_cpdma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
> index e4d6edf..dbe9167 100644
> --- a/drivers/net/ethernet/ti/davinci_cpdma.c
> +++ b/drivers/net/ethernet/ti/davinci_cpdma.c
> @@ -841,7 +841,7 @@ int cpdma_chan_set_rate(struct cpdma_chan *ch, u32 rate)
>  		return -EINVAL;
>  
>  	if (ch->rate == rate)
> -		return rate;
> +		return 0;

Looking at the one and only caller of this function, cpsw_ndo_set_tx_maxrate, it
makes sure this can never, ever, happen.

So I would instead remove this check completely since it can never trigger.

^ permalink raw reply

* [PATCH 3/3] net: dst: make dst->obsolete 8-bit
From: Alexey Dobriyan @ 2017-12-06 21:35 UTC (permalink / raw)
  To: davem; +Cc: netdev, Alexey Dobriyan
In-Reply-To: <20171206213505.17018-1-adobriyan@gmail.com>

All values are small integers.

Space savings on x86_64:

	add/remove: 0/0 grow/shrink: 1/34 up/down: 1/-60 (-59)
	Function                                     old     new   delta
	dst_alloc                                    124     125      +1
	xfrm_negative_advice                          23      22      -1
	xfrm_dst_check                                27      26      -1
	udp_v6_early_demux                           845     844      -1
				...
	xfrm_resolve_and_create_bundle              2816    2812      -4
	dst_dev_put                                  104      99      -5
	xfrm_lookup                                 2027    2021      -6
	update_or_create_fnhe                       1339    1329     -10

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
 include/net/dst.h | 8 ++++----
 net/core/dst.c    | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/net/dst.h b/include/net/dst.h
index 25decfa4e14a..77143ee9139c 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -55,7 +55,6 @@ struct dst_entry {
 #define DST_XFRM_TUNNEL		((dst_flags_t __force)0x20)
 #define DST_XFRM_QUEUE		((dst_flags_t __force)0x40)
 #define DST_METADATA		((dst_flags_t __force)0x80)
-	u8			__pad2;
 
 	/* A non-zero value of dst->obsolete forces by-hand validation
 	 * of the route entry.  Positive values are set by the generic
@@ -65,11 +64,12 @@ struct dst_entry {
 	 * Negative values are used by the implementation layer code to
 	 * force invocation of the dst_ops->check() method.
 	 */
-	short			obsolete;
+	s8			obsolete;
 #define DST_OBSOLETE_NONE	0
 #define DST_OBSOLETE_DEAD	2
 #define DST_OBSOLETE_FORCE_CHK	-1
 #define DST_OBSOLETE_KILL	-2
+	u16			__pad2;
 	unsigned short		header_len;	/* more space at head required */
 	unsigned short		trailer_len;	/* space to reserve at tail */
 
@@ -390,9 +390,9 @@ static inline int dst_discard(struct sk_buff *skb)
 	return dst_discard_out(&init_net, skb->sk, skb);
 }
 void *dst_alloc(struct dst_ops *ops, struct net_device *dev, int initial_ref,
-		int initial_obsolete, dst_flags_t flags);
+		s8 initial_obsolete, dst_flags_t flags);
 void dst_init(struct dst_entry *dst, struct dst_ops *ops,
-	      struct net_device *dev, int initial_ref, int initial_obsolete,
+	      struct net_device *dev, int initial_ref, s8 initial_obsolete,
 	      dst_flags_t flags);
 struct dst_entry *dst_destroy(struct dst_entry *dst);
 void dst_dev_put(struct dst_entry *dst);
diff --git a/net/core/dst.c b/net/core/dst.c
index d7cce39c3552..dba03bf26da7 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -60,7 +60,7 @@ const struct dst_metrics dst_default_metrics = {
 };
 
 void dst_init(struct dst_entry *dst, struct dst_ops *ops,
-	      struct net_device *dev, int initial_ref, int initial_obsolete,
+	      struct net_device *dev, int initial_ref, s8 initial_obsolete,
 	      dst_flags_t flags)
 {
 	dst->dev = dev;
@@ -92,7 +92,7 @@ void dst_init(struct dst_entry *dst, struct dst_ops *ops,
 EXPORT_SYMBOL(dst_init);
 
 void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
-		int initial_ref, int initial_obsolete, dst_flags_t flags)
+		int initial_ref, s8 initial_obsolete, dst_flags_t flags)
 {
 	struct dst_entry *dst;
 
-- 
2.13.6

^ permalink raw reply related

* [PATCH 2/3] net: dst: switch to 8-bit dst->flags
From: Alexey Dobriyan @ 2017-12-06 21:35 UTC (permalink / raw)
  To: davem; +Cc: netdev, Alexey Dobriyan
In-Reply-To: <20171206213505.17018-1-adobriyan@gmail.com>

None of the flags is 16-bit currently.

Space savings on x86_64:

	add/remove: 0/0 grow/shrink: 2/16 up/down: 7/-29 (-22)
	Function                                     old     new   delta
	netdev_frame_hook                            464     470      +6
	gre_fill_metadata_dst                        257     258      +1
	xfrm_resolve_and_create_bundle              2817    2816      -1
	ipv6_add_addr                               1724    1723      -1
	ip6_rt_cache_alloc                           472     471      -1
	ip6_route_info_create                       2955    2954      -1
	icmp6_dst_alloc                              569     568      -1
	dst_init                                     166     165      -1
	dev_fill_metadata_dst                        395     394      -1
	bnxt_start_xmit                             3119    3118      -1
	arp_process                                 2524    2523      -1
	addrconf_dst_alloc                           442     441      -1
	xfrm_lookup                                 2029    2027      -2
	ip6_tnl_xmit                                2965    2963      -2
	rt_dst_alloc                                 200     197      -3
	do_execute_actions                          2799    2796      -3
	addrconf_disable_policy_idev                 449     445      -4
	br_netfilter_rtable_init                      66      61      -5

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
 include/net/dst.h | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/net/dst.h b/include/net/dst.h
index 0f0905bda423..25decfa4e14a 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -31,7 +31,7 @@
  */
 
 struct sk_buff;
-typedef unsigned short __bitwise dst_flags_t;
+typedef u8 __bitwise dst_flags_t;
 
 struct dst_entry {
 	struct net_device       *dev;
@@ -47,14 +47,15 @@ struct dst_entry {
 	int			(*output)(struct net *net, struct sock *sk, struct sk_buff *skb);
 
 	dst_flags_t		flags;
-#define DST_HOST		((dst_flags_t __force)0x0001)
-#define DST_NOXFRM		((dst_flags_t __force)0x0002)
-#define DST_NOPOLICY		((dst_flags_t __force)0x0004)
-#define DST_NOCOUNT		((dst_flags_t __force)0x0008)
-#define DST_FAKE_RTABLE		((dst_flags_t __force)0x0010)
-#define DST_XFRM_TUNNEL		((dst_flags_t __force)0x0020)
-#define DST_XFRM_QUEUE		((dst_flags_t __force)0x0040)
-#define DST_METADATA		((dst_flags_t __force)0x0080)
+#define DST_HOST		((dst_flags_t __force)0x01)
+#define DST_NOXFRM		((dst_flags_t __force)0x02)
+#define DST_NOPOLICY		((dst_flags_t __force)0x04)
+#define DST_NOCOUNT		((dst_flags_t __force)0x08)
+#define DST_FAKE_RTABLE		((dst_flags_t __force)0x10)
+#define DST_XFRM_TUNNEL		((dst_flags_t __force)0x20)
+#define DST_XFRM_QUEUE		((dst_flags_t __force)0x40)
+#define DST_METADATA		((dst_flags_t __force)0x80)
+	u8			__pad2;
 
 	/* A non-zero value of dst->obsolete forces by-hand validation
 	 * of the route entry.  Positive values are set by the generic
-- 
2.13.6

^ permalink raw reply related

* [PATCH 1/3] net: dst: add and use dst_flags_t
From: Alexey Dobriyan @ 2017-12-06 21:35 UTC (permalink / raw)
  To: davem; +Cc: netdev, Alexey Dobriyan

Typedef dst->flags for checking with sparse.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
 drivers/net/vrf.c       |  2 +-
 include/net/dst.h       | 23 ++++++++++++-----------
 include/net/ip6_route.h |  2 +-
 net/core/dst.c          |  4 ++--
 net/ipv6/route.c        |  4 ++--
 5 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index feb1b2e15c2e..f6a5df216fec 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -493,7 +493,7 @@ static void vrf_rt6_release(struct net_device *dev, struct net_vrf *vrf)
 
 static int vrf_rt6_create(struct net_device *dev)
 {
-	int flags = DST_HOST | DST_NOPOLICY | DST_NOXFRM;
+	dst_flags_t flags = DST_HOST | DST_NOPOLICY | DST_NOXFRM;
 	struct net_vrf *vrf = netdev_priv(dev);
 	struct net *net = dev_net(dev);
 	struct fib6_table *rt6i_table;
diff --git a/include/net/dst.h b/include/net/dst.h
index 33d2a5433924..0f0905bda423 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -31,6 +31,7 @@
  */
 
 struct sk_buff;
+typedef unsigned short __bitwise dst_flags_t;
 
 struct dst_entry {
 	struct net_device       *dev;
@@ -45,15 +46,15 @@ struct dst_entry {
 	int			(*input)(struct sk_buff *);
 	int			(*output)(struct net *net, struct sock *sk, struct sk_buff *skb);
 
-	unsigned short		flags;
-#define DST_HOST		0x0001
-#define DST_NOXFRM		0x0002
-#define DST_NOPOLICY		0x0004
-#define DST_NOCOUNT		0x0008
-#define DST_FAKE_RTABLE		0x0010
-#define DST_XFRM_TUNNEL		0x0020
-#define DST_XFRM_QUEUE		0x0040
-#define DST_METADATA		0x0080
+	dst_flags_t		flags;
+#define DST_HOST		((dst_flags_t __force)0x0001)
+#define DST_NOXFRM		((dst_flags_t __force)0x0002)
+#define DST_NOPOLICY		((dst_flags_t __force)0x0004)
+#define DST_NOCOUNT		((dst_flags_t __force)0x0008)
+#define DST_FAKE_RTABLE		((dst_flags_t __force)0x0010)
+#define DST_XFRM_TUNNEL		((dst_flags_t __force)0x0020)
+#define DST_XFRM_QUEUE		((dst_flags_t __force)0x0040)
+#define DST_METADATA		((dst_flags_t __force)0x0080)
 
 	/* A non-zero value of dst->obsolete forces by-hand validation
 	 * of the route entry.  Positive values are set by the generic
@@ -388,10 +389,10 @@ static inline int dst_discard(struct sk_buff *skb)
 	return dst_discard_out(&init_net, skb->sk, skb);
 }
 void *dst_alloc(struct dst_ops *ops, struct net_device *dev, int initial_ref,
-		int initial_obsolete, unsigned short flags);
+		int initial_obsolete, dst_flags_t flags);
 void dst_init(struct dst_entry *dst, struct dst_ops *ops,
 	      struct net_device *dev, int initial_ref, int initial_obsolete,
-	      unsigned short flags);
+	      dst_flags_t flags);
 struct dst_entry *dst_destroy(struct dst_entry *dst);
 void dst_dev_put(struct dst_entry *dst);
 
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 18e442ea93d8..eec7e7ac564b 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -131,7 +131,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
 				    const struct in6_addr *addr, bool anycast);
 
 struct rt6_info *ip6_dst_alloc(struct net *net, struct net_device *dev,
-			       int flags);
+			       dst_flags_t flags);
 
 /*
  *	support functions for ND
diff --git a/net/core/dst.c b/net/core/dst.c
index 007aa0b08291..d7cce39c3552 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -61,7 +61,7 @@ const struct dst_metrics dst_default_metrics = {
 
 void dst_init(struct dst_entry *dst, struct dst_ops *ops,
 	      struct net_device *dev, int initial_ref, int initial_obsolete,
-	      unsigned short flags)
+	      dst_flags_t flags)
 {
 	dst->dev = dev;
 	if (dev)
@@ -92,7 +92,7 @@ void dst_init(struct dst_entry *dst, struct dst_ops *ops,
 EXPORT_SYMBOL(dst_init);
 
 void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
-		int initial_ref, int initial_obsolete, unsigned short flags)
+		int initial_ref, int initial_obsolete, dst_flags_t flags)
 {
 	struct dst_entry *dst;
 
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index b3f4d19b3ca5..1d6d53a5d951 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -356,7 +356,7 @@ static void rt6_info_init(struct rt6_info *rt)
 /* allocate dst with ip6_dst_ops */
 static struct rt6_info *__ip6_dst_alloc(struct net *net,
 					struct net_device *dev,
-					int flags)
+					dst_flags_t flags)
 {
 	struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev,
 					1, DST_OBSOLETE_FORCE_CHK, flags);
@@ -371,7 +371,7 @@ static struct rt6_info *__ip6_dst_alloc(struct net *net,
 
 struct rt6_info *ip6_dst_alloc(struct net *net,
 			       struct net_device *dev,
-			       int flags)
+			       dst_flags_t flags)
 {
 	struct rt6_info *rt = __ip6_dst_alloc(net, dev, flags);
 
-- 
2.13.6

^ permalink raw reply related

* Re: add "net: fec: Allow reception of frames bigger than 1522 bytes" to stable
From: David Miller @ 2017-12-06 21:29 UTC (permalink / raw)
  To: u.kleine-koenig; +Cc: netdev, andrew, kernel
In-Reply-To: <20171206212450.nhimhjwusmmxe7na@pengutronix.de>

From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date: Wed, 6 Dec 2017 22:24:50 +0100

> Hello,
> 
> on an 4.9.x kernel using the freescale/fec driver "behind" a switch I
> had problems with packet reception.
> 
> Commit fbbeefdd2104 ("net: fec: Allow reception of frames bigger than
> 1522 bytes") fixed it for me and so I suggest to queue that one for
> stable. It can be cherry-picked to 4.9.x without conflict and IMHO
> should be applied to all stable branches before v4.14.

Ok, queued up.

^ permalink raw reply

* add "net: fec: Allow reception of frames bigger than 1522 bytes" to stable
From: Uwe Kleine-König @ 2017-12-06 21:24 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Andrew Lunn, kernel

Hello,

on an 4.9.x kernel using the freescale/fec driver "behind" a switch I
had problems with packet reception.

Commit fbbeefdd2104 ("net: fec: Allow reception of frames bigger than
1522 bytes") fixed it for me and so I suggest to queue that one for
stable. It can be cherry-picked to 4.9.x without conflict and IMHO
should be applied to all stable branches before v4.14.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply

* Re: [PATCH net-next 2/4] bnxt_en: Use NETIF_F_GRO_HW.
From: Michael Chan @ 2017-12-06 21:04 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner
  Cc: Eric Dumazet, Or Gerlitz, David Miller, Linux Netdev List
In-Reply-To: <20171205181052.GD3327@localhost.localdomain>

On Tue, Dec 5, 2017 at 10:10 AM, Marcelo Ricardo Leitner
<marcelo.leitner@gmail.com> wrote:
> On Mon, Dec 04, 2017 at 04:07:15PM -0800, Michael Chan wrote:
>> As already pointed out, GRO_HW is a subset of GRO.  Packets that
>> cannot be aggregated in hardware (due to hardware resource limitations
>> or protocol types that it doesn't handle) can just be passed to the
>> stack for GRO aggregation.
>
> How would the parameters/limits work in this case? I mean, currently
> we have the default weight of 64 packets per napi poll cycle, the
> budget of 300 per cycle and also the time constrain,
> net.core.netdev_budget_usecs.

Good point.  Currently, it is no different than LRO.  Each aggregated
packet is counted as 1.  With LRO, you don't necessarily know many
packets were merged.  With GRO_HW, we know and it's possible to count
the original packets towards the NAPI budget.

>
> With GRO_HW, this 64 limit may be exceeded. I'm looking at qede code
> and it works by couting each completion as 1 rcv_pkts
> (qede_fp.c:1318). So if it now gets 64 packets, it's up to 64*MTU
> aprox, GRO'ed or not. But with GRO_HW, seems it may be much more than
> that and which may not be fair with other interfaces in the system.
> Drivers supporting GRO_HW probably should account for this.

Right.  We can make this adjustment for GRO_HW in a future patchset.

>
> And how can one control how much time a packet may spend on NIC queue
> waiting to be GRO'ed? Does it use the coalescing parameters for that?
>

The GRO_HW timer is currently not exposed.  It's different from
interrupt coalescing.  It's possible to make this a tunable parameter
in the future.

^ permalink raw reply

* Re: [PATCH V2] netlink: Add netns check on taps
From: David Miller @ 2017-12-06 20:57 UTC (permalink / raw)
  To: cernekee; +Cc: johannes.berg, netdev, linux-kernel, daniel, dsahern
In-Reply-To: <1512591147-29618-1-git-send-email-cernekee@chromium.org>

From: Kevin Cernekee <cernekee@chromium.org>
Date: Wed,  6 Dec 2017 12:12:27 -0800

> Currently, a nlmon link inside a child namespace can observe systemwide
> netlink activity.  Filter the traffic so that nlmon can only sniff
> netlink messages from its own netns.
> 
> Test case:
> 
>     vpnns -- bash -c "ip link add nlmon0 type nlmon; \
>                       ip link set nlmon0 up; \
>                       tcpdump -i nlmon0 -q -w /tmp/nlmon.pcap -U" &
>     sudo ip xfrm state add src 10.1.1.1 dst 10.1.1.2 proto esp \
>         spi 0x1 mode transport \
>         auth sha1 0x6162633132330000000000000000000000000000 \
>         enc aes 0x00000000000000000000000000000000
>     grep --binary abc123 /tmp/nlmon.pcap
> 
> Signed-off-by: Kevin Cernekee <cernekee@chromium.org>

Applied and queued up for -stable, thanks Kevin.

^ permalink raw reply

* Re: [PATCH] usbnet: fix alignment for frames with no ethernet header
From: David Miller @ 2017-12-06 20:56 UTC (permalink / raw)
  To: bjorn; +Cc: netdev, jay, linux-usb, oneukum
In-Reply-To: <20171206192124.21670-1-bjorn@mork.no>

From: Bjørn Mork <bjorn@mork.no>
Date: Wed,  6 Dec 2017 20:21:24 +0100

> The qmi_wwan minidriver support a 'raw-ip' mode where frames are
> received without any ethernet header. This causes alignment issues
> because the skbs allocated by usbnet are "IP aligned".
> 
> Fix by allowing minidrivers to disable the additional alignment
> offset. This is implemented using a per-device flag, since the same
> minidriver also supports 'ethernet' mode.
> 
> Fixes: 32f7adf633b9 ("net: qmi_wwan: support "raw IP" mode")
> Reported-and-tested-by: Jay Foster <jay@systech.com>
> Signed-off-by: Bjørn Mork <bjorn@mork.no>

Looks good, applied and queued up for -stable.

^ permalink raw reply

* Re: [PATCH net] tcp: use current time in tcp_rcv_space_adjust()
From: David Miller @ 2017-12-06 20:54 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, weiwan, ncardwell, ycheng
In-Reply-To: <1512587299.25033.11.camel@gmail.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 06 Dec 2017 11:08:19 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> When I switched rcv_rtt_est to high resolution timestamps, I forgot
> that tp->tcp_mstamp needed to be refreshed in tcp_rcv_space_adjust()
> 
> Using an old timestamp leads to autotuning lags.
> 
> Fixes: 645f4c6f2ebd ("tcp: switch rcv_rtt_est and rcvq_space to high resolution timestamps")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied and queued up for -stable, thanks Eric.

^ permalink raw reply

* Re: pull-request: bpf 2017-12-06
From: David Miller @ 2017-12-06 20:53 UTC (permalink / raw)
  To: daniel; +Cc: ast, netdev
In-Reply-To: <20171206185625.11907-1-daniel@iogearbox.net>

From: Daniel Borkmann <daniel@iogearbox.net>
Date: Wed,  6 Dec 2017 19:56:25 +0100

> Hi David,
> 
> The following pull-request contains BPF updates for your *net* tree.
> 
> The main changes are:
> 
> 1) Fixing broken uapi for BPF tracing programs for s390 and arm64
>    architectures due to pt_regs being in-kernel only, and not part
>    of uapi right now. A wrapper is added that exports pt_regs in
>    an asm-generic way. For arm64 this maps to existing user_pt_regs
>    structure and for s390 a user_pt_regs structure exporting the
>    beginning of pt_regs is added and uapi-exported, thus fixing the
>    BPF issues seen in perf (and BPF selftests), all from Hendrik.
> 
> Please consider pulling these changes from:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git

Pulled, thanks Daniel.

^ permalink raw reply

* Re: [PATCH] netlink: Add netns check on taps
From: Daniel Borkmann @ 2017-12-06 20:51 UTC (permalink / raw)
  To: David Miller, cernekee; +Cc: johannes.berg, netdev, linux-kernel
In-Reply-To: <20171206.144003.2119311447846512879.davem@davemloft.net>

On 12/06/2017 08:40 PM, David Miller wrote:
> From: Kevin Cernekee <cernekee@chromium.org>
> Date: Tue,  5 Dec 2017 14:46:22 -0800
> 
>> Currently, a nlmon link inside a child namespace can observe systemwide
>> netlink activity.  Filter the traffic so that in a non-init netns,
>> nlmon can only sniff netlink messages from its own netns.
>>
>> Test case:
>>
>>     vpnns -- bash -c "ip link add nlmon0 type nlmon; \
>>                       ip link set nlmon0 up; \
>>                       tcpdump -i nlmon0 -q -w /tmp/nlmon.pcap -U" &
>>     sudo ip xfrm state add src 10.1.1.1 dst 10.1.1.2 proto esp \
>>         spi 0x1 mode transport \
>>         auth sha1 0x6162633132330000000000000000000000000000 \
>>         enc aes 0x00000000000000000000000000000000
>>     grep abc123 /tmp/nlmon.pcap
>>
>> Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
> 
> Daniel, what behavior did you intend this to have?
> 
> Taps can see their own namespace only, or init_net is special
> and can see all netlink activity.
> 
> I think letting init_net see everything could be confusing,
> because there is no way to distinguish netlink events by
> namespace just by looking at the messages that arrive at
> the tap right?

Yeah, only snooping from own netns makes sense, lets limit
it to this.

^ permalink raw reply

* Re: [PATCH v4 6/6] bpf: add new test test_many_kprobe
From: Philippe Ombredanne @ 2017-12-06 20:51 UTC (permalink / raw)
  To: Song Liu
  Cc: peterz, Steven Rostedt, Ingo Molnar, David S. Miller, netdev,
	LKML, daniel, kernel-team
In-Reply-To: <20171205012729.358860-9-songliubraving@fb.com>

Song,

On Tue, Dec 5, 2017 at 2:27 AM, Song Liu <songliubraving@fb.com> wrote:
> The test compares old text based kprobe API with perf_kprobe.
>
> Here is a sample output of this test:
>
> Creating 1000 kprobes with text-based API takes 6.979683 seconds
> Cleaning 1000 kprobes with text-based API takes 84.897687 seconds
> Creating 1000 kprobes with perf_kprobe (function name) takes 5.077558 seconds
> Cleaning 1000 kprobes with perf_kprobe (function name) takes 81.241354 seconds
> Creating 1000 kprobes with perf_kprobe (function addr) takes 5.218255 seconds
> Cleaning 1000 kprobes with perf_kprobe (function addr) takes 80.010731 seconds
>
> Signed-off-by: Song Liu <songliubraving@fb.com>
> Reviewed-by: Josef Bacik <jbacik@fb.com>
> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
> ---
>  samples/bpf/Makefile                |   3 +
>  samples/bpf/bpf_load.c              |   5 +-
>  samples/bpf/bpf_load.h              |   4 +
>  samples/bpf/test_many_kprobe_user.c | 186 ++++++++++++++++++++++++++++++++++++
>  4 files changed, 195 insertions(+), 3 deletions(-)
>  create mode 100644 samples/bpf/test_many_kprobe_user.c
>
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index 9b4a66e..ec92f35 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -42,6 +42,7 @@ hostprogs-y += xdp_redirect
>  hostprogs-y += xdp_redirect_map
>  hostprogs-y += xdp_monitor
>  hostprogs-y += syscall_tp
> +hostprogs-y += test_many_kprobe
>
>  # Libbpf dependencies
>  LIBBPF := ../../tools/lib/bpf/bpf.o
> @@ -87,6 +88,7 @@ xdp_redirect-objs := bpf_load.o $(LIBBPF) xdp_redirect_user.o
>  xdp_redirect_map-objs := bpf_load.o $(LIBBPF) xdp_redirect_map_user.o
>  xdp_monitor-objs := bpf_load.o $(LIBBPF) xdp_monitor_user.o
>  syscall_tp-objs := bpf_load.o $(LIBBPF) syscall_tp_user.o
> +test_many_kprobe-objs := bpf_load.o $(LIBBPF) test_many_kprobe_user.o
>
>  # Tell kbuild to always build the programs
>  always := $(hostprogs-y)
> @@ -172,6 +174,7 @@ HOSTLOADLIBES_xdp_redirect += -lelf
>  HOSTLOADLIBES_xdp_redirect_map += -lelf
>  HOSTLOADLIBES_xdp_monitor += -lelf
>  HOSTLOADLIBES_syscall_tp += -lelf
> +HOSTLOADLIBES_test_many_kprobe += -lelf
>
>  # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline:
>  #  make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
> diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
> index b11c1c1..ffe2c49d 100644
> --- a/samples/bpf/bpf_load.c
> +++ b/samples/bpf/bpf_load.c
> @@ -664,9 +664,8 @@ void read_trace_pipe(void)
>         }
>  }
>
> -#define MAX_SYMS 300000
> -static struct ksym syms[MAX_SYMS];
> -static int sym_cnt;
> +struct ksym syms[MAX_SYMS];
> +int sym_cnt;
>
>  static int ksym_cmp(const void *p1, const void *p2)
>  {
> diff --git a/samples/bpf/bpf_load.h b/samples/bpf/bpf_load.h
> index 95d6be5..6c9d584 100644
> --- a/samples/bpf/bpf_load.h
> +++ b/samples/bpf/bpf_load.h
> @@ -69,6 +69,10 @@ static inline __u64 ptr_to_u64(const void *ptr)
>         return (__u64) (unsigned long) ptr;
>  }
>
> +#define MAX_SYMS 300000
> +extern struct ksym syms[MAX_SYMS];
> +extern int sym_cnt;
> +
>  int load_kallsyms(void);
>  struct ksym *ksym_search(long key);
>  int set_link_xdp_fd(int ifindex, int fd, __u32 flags);
> diff --git a/samples/bpf/test_many_kprobe_user.c b/samples/bpf/test_many_kprobe_user.c
> new file mode 100644
> index 0000000..6c111cf
> --- /dev/null
> +++ b/samples/bpf/test_many_kprobe_user.c
> @@ -0,0 +1,186 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright (c) 2017 Facebook
> +
> +#define _GNU_SOURCE
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <sys/types.h>
> +#include <sys/stat.h>
> +#include <fcntl.h>
> +#include <string.h>
> +#include <libelf.h>
> +#include <gelf.h>
> +#include <linux/version.h>
> +#include <errno.h>
> +#include <stdbool.h>
> +#include <time.h>
> +#include "libbpf.h"
> +#include "bpf_load.h"
> +#include "perf-sys.h"
> +
> +#define MAX_KPROBES 1000
> +
> +#define DEBUGFS "/sys/kernel/debug/tracing/"
> +
> +int kprobes[MAX_KPROBES] = {0};
> +int kprobe_count;
> +int perf_event_fds[MAX_KPROBES];
> +const char license[] = "GPL";
> +
> +static __u64 time_get_ns(void)
> +{
> +       struct timespec ts;
> +
> +       clock_gettime(CLOCK_MONOTONIC, &ts);
> +       return ts.tv_sec * 1000000000ull + ts.tv_nsec;
> +}
> +
> +static int kprobe_api(char *func, void *addr, bool use_new_api)
> +{
> +       int efd;
> +       struct perf_event_attr attr = {};
> +       char buf[256];
> +       int err, id;
> +
> +       attr.sample_type = PERF_SAMPLE_RAW;
> +       attr.sample_period = 1;
> +       attr.wakeup_events = 1;
> +
> +       if (use_new_api) {
> +               attr.type = perf_kprobe_type;
> +               if (func) {
> +                       attr.kprobe_func = ptr_to_u64(func);
> +                       attr.probe_offset = 0;
> +               } else {
> +                       attr.kprobe_func = 0;
> +                       attr.kprobe_addr = ptr_to_u64(addr);
> +               }
> +       } else {
> +               attr.type = PERF_TYPE_TRACEPOINT;
> +               snprintf(buf, sizeof(buf),
> +                        "echo 'p:%s %s' >> /sys/kernel/debug/tracing/kprobe_events",
> +                        func, func);
> +               err = system(buf);
> +               if (err < 0) {
> +                       printf("failed to create kprobe '%s' error '%s'\n",
> +                              func, strerror(errno));
> +                       return -1;
> +               }
> +
> +               strcpy(buf, DEBUGFS);
> +               strcat(buf, "events/kprobes/");
> +               strcat(buf, func);
> +               strcat(buf, "/id");
> +               efd = open(buf, O_RDONLY, 0);
> +               if (efd < 0) {
> +                       printf("failed to open event %s\n", func);
> +                       return -1;
> +               }
> +
> +               err = read(efd, buf, sizeof(buf));
> +               if (err < 0 || err >= sizeof(buf)) {
> +                       printf("read from '%s' failed '%s'\n", func,
> +                              strerror(errno));
> +                       return -1;
> +               }
> +
> +               close(efd);
> +               buf[err] = 0;
> +               id = atoi(buf);
> +               attr.config = id;
> +       }
> +
> +       attr.size = sizeof(attr);
> +       efd = sys_perf_event_open(&attr, -1/*pid*/, 0/*cpu*/,
> +                                 -1/*group_fd*/, 0);
> +
> +       return efd;
> +}
> +
> +static int select_kprobes(void)
> +{
> +       int fd;
> +       int i;
> +
> +       load_kallsyms();
> +
> +       kprobe_count = 0;
> +       for (i = 0; i < sym_cnt; i++) {
> +               if (strstr(syms[i].name, "."))
> +                       continue;
> +               fd = kprobe_api(syms[i].name, NULL, false);
> +               if (fd < 0)
> +                       continue;
> +               close(fd);
> +               kprobes[kprobe_count] = i;
> +               if (++kprobe_count >= MAX_KPROBES)
> +                       break;
> +       }
> +
> +       return 0;
> +}
> +
> +int main(int argc, char *argv[])
> +{
> +       int i;
> +       __u64 start_time;
> +
> +       select_kprobes();
> +
> +       /* clean all trace_kprobe */
> +       i = system("echo \"\" > /sys/kernel/debug/tracing/kprobe_events");
> +
> +       /* test text based API */
> +       start_time = time_get_ns();
> +       for (i = 0; i < kprobe_count; i++)
> +               perf_event_fds[i] = kprobe_api(syms[kprobes[i]].name,
> +                                              NULL, false);
> +       printf("Creating %d kprobes with text-based API takes %f seconds\n",
> +              kprobe_count, (time_get_ns() - start_time) / 1000000000.0);
> +
> +       start_time = time_get_ns();
> +       for (i = 0; i < kprobe_count; i++)
> +               if (perf_event_fds[i] > 0)
> +                       close(perf_event_fds[i]);
> +       i = system("echo \"\" > /sys/kernel/debug/tracing/kprobe_events");
> +       printf("Cleaning %d kprobes with text-based API takes %f seconds\n",
> +              kprobe_count, (time_get_ns() - start_time) / 1000000000.0);
> +
> +       get_perf_kprobe_type_id();
> +       if (perf_kprobe_type == -1) {
> +               printf("The kernel does support perf_kprobe.\n"
> +                      "Existing...\n");
> +               return 0;
> +       }
> +
> +       /* test perf_kprobe API, with function names */
> +       start_time = time_get_ns();
> +       for (i = 0; i < kprobe_count; i++)
> +               perf_event_fds[i] = kprobe_api(syms[kprobes[i]].name,
> +                                              NULL, true);
> +       printf("Creating %d kprobes with perf_kprobe (function name) takes %f seconds\n",
> +              kprobe_count, (time_get_ns() - start_time) / 1000000000.0);
> +
> +       start_time = time_get_ns();
> +       for (i = 0; i < kprobe_count; i++)
> +               if (perf_event_fds[i] > 0)
> +                       close(perf_event_fds[i]);
> +       printf("Cleaning %d kprobes with perf_kprobe (function name) takes %f seconds\n",
> +              kprobe_count, (time_get_ns() - start_time) / 1000000000.0);
> +
> +       /* test perf_kprobe API, with function address */
> +       start_time = time_get_ns();
> +       for (i = 0; i < kprobe_count; i++)
> +               perf_event_fds[i] = kprobe_api(
> +                       NULL, (void *)(syms[kprobes[i]].addr), true);
> +       printf("Creating %d kprobes with perf_kprobe (function addr) takes %f seconds\n",
> +              kprobe_count, (time_get_ns() - start_time) / 1000000000.0);
> +
> +       start_time = time_get_ns();
> +       for (i = 0; i < kprobe_count; i++)
> +               if (perf_event_fds[i] > 0)
> +                       close(perf_event_fds[i]);
> +       printf("Cleaning %d kprobes with perf_kprobe (function addr) takes %f seconds\n",
> +              kprobe_count, (time_get_ns() - start_time) / 1000000000.0);
> +       return 0;
> +}
> --
> 2.9.5
>

Ack, and thank you very much for the usage of the SDPX license id that
I reviewed.

-- 
Cordially
Philippe Ombredanne

^ permalink raw reply

* Re: [PATCH net] adding missing rcu_read_unlock in ipxip6_rcv
From: David Miller @ 2017-12-06 20:50 UTC (permalink / raw)
  To: tehnerd; +Cc: netdev, ast, vnuorval
In-Reply-To: <20171206181933.1054789-1-tehnerd@fb.com>

From: "Nikita V. Shirokov" <tehnerd@fb.com>
Date: Wed,  6 Dec 2017 10:19:33 -0800

> commit 8d79266bc48c ("ip6_tunnel: add collect_md mode to IPv6 tunnels")
> introduced new exit point in  ipxip6_rcv. however rcu_read_unlock is
> missing there. this diff is fixing this
> 
> Signed-off-by: Nikita V. Shirokov <tehnerd@fb.com>
 ...
> @@ -903,8 +903,10 @@ static int ipxip6_rcv(struct sk_buff *skb, u8 ipproto,
>  			goto drop;
>  		if (t->parms.collect_md) {
>  			tun_dst = ipv6_tun_rx_dst(skb, 0, 0, 0);
> -			if (!tun_dst)
> +			if (!tun_dst) {
> +				rcu_read_unlock();
>  				return 0;
> +			}
>  		}
>  		ret = __ip6_tnl_rcv(t, skb, tpi, tun_dst, dscp_ecn_decapsulate,
>  				    log_ecn_error);

Shouldn't it branch to 'drop' otherwise we leak the skb?

^ permalink raw reply

* Re: [PATCH 1/2] net: fec: don't ack masked interrupt events
From: David Miller @ 2017-12-06 20:47 UTC (permalink / raw)
  To: l.stach; +Cc: fugang.duan, netdev, patchwork-lst, kernel
In-Reply-To: <20171206172459.14059-1-l.stach@pengutronix.de>

From: Lucas Stach <l.stach@pengutronix.de>
Date: Wed,  6 Dec 2017 18:24:58 +0100

> The FEC doesn't have a real interrupt status register, that takes
> into account the mask status of the IRQ. The driver reads the raw
> interrupt event register, which also reports events for masked
> IRQs.
> 
> The driver needs to apply the current mask itself, to avoid acking
> IRQs that are currently masked, as NAPI relies on the masking to
> hide the IRQs. The current behavior of just acking all interrupts
> regardless of their mask status opens the driver up the "rotting
> packet" race-window, as described in the original NAPI-HOWTO, which
> has been observed in the wild.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/net/ethernet/freescale/fec_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 610573855213..0b70c07eb703 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1584,7 +1584,8 @@ fec_enet_interrupt(int irq, void *dev_id)
>  	uint int_events;
>  	irqreturn_t ret = IRQ_NONE;
>  
> -	int_events = readl(fep->hwp + FEC_IEVENT);
> +	int_events = readl_relaxed(fep->hwp + FEC_IEVENT) &
> +	             readl_relaxed(fep->hwp + FEC_IMASK);

Adding a full new MMIO register read to every interrupt is going to make
interrupts significantly more expensive.

You should cache this mask in software in order to avoid the expensive
MMIO read.

Thanks.

^ permalink raw reply

* Re: [PATCH] net: ethernet: arc: fix error handling in emac_rockchip_probe
From: David Miller @ 2017-12-06 20:46 UTC (permalink / raw)
  To: branislav; +Cc: heiko, netdev, linux-arm-kernel, linux-rockchip, linux-kernel
In-Reply-To: <20171206172433.3457-1-branislav@radocaj.org>

From: Branislav Radocaj <branislav@radocaj.org>
Date: Wed,  6 Dec 2017 18:24:33 +0100

>     If clk_set_rate() fails, we should disable clk
>     before return.
> 
>     Found by Linux Driver Verification project (linuxtesting.org).
> 
>     Signed-off-by: Branislav Radocaj <branislav@radocaj.org>

Please eliminate this indentation of your commit message and
resubmit.

Thank you.

^ permalink raw reply

* Re: [PATCH 13/45] drivers: net: dsa: remove duplicate includes
From: David Miller @ 2017-12-06 20:45 UTC (permalink / raw)
  To: pravin.shedge4linux
  Cc: netdev, f.fainelli, vivien.didelot, andrew, linux-kernel
In-Reply-To: <1512579520-5474-1-git-send-email-pravin.shedge4linux@gmail.com>

From: Pravin Shedge <pravin.shedge4linux@gmail.com>
Date: Wed,  6 Dec 2017 22:28:40 +0530

> These duplicate includes have been found with scripts/checkincludes.pl but
> they have been removed manually to avoid removing false positives.
> 
> Signed-off-by: Pravin Shedge <pravin.shedge4linux@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH net] rds: Fix NULL pointer dereference in __rds_rdma_map
From: David Miller @ 2017-12-06 20:45 UTC (permalink / raw)
  To: Haakon.Bugge-QHcLZuEGTsvQT0dZR+AlfA
  Cc: santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA,
	netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	rds-devel-N0ozoZBvEnrZJqsBc5GL+g,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20171206161828.8368-1-Haakon.Bugge-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

From: Håkon Bugge <Haakon.Bugge-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Date: Wed,  6 Dec 2017 17:18:28 +0100

> This is a fix for syzkaller719569, where memory registration was
> attempted without any underlying transport being loaded.
> 
> Analysis of the case reveals that it is the setsockopt() RDS_GET_MR
> (2) and RDS_GET_MR_FOR_DEST (7) that are vulnerable.
> 
> Here is an example stack trace when the bug is hit:
 ...
> The fix is to check the existence of an underlying transport in
> __rds_rdma_map().
> 
> Signed-off-by: Håkon Bugge <haakon.bugge-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Reported-by: syzbot <syzkaller-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>

Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH net-next 0/6] net: sched: sch: introduce extack support
From: David Miller @ 2017-12-06 20:40 UTC (permalink / raw)
  To: aring; +Cc: jhs, xiyou.wangcong, jiri, netdev, kernel, dsahern
In-Reply-To: <20171206160845.6646-1-aring@mojatatu.com>

From: Alexander Aring <aring@mojatatu.com>
Date: Wed,  6 Dec 2017 11:08:39 -0500

> this patch series basically add support for extack in common qdisc handling.
> Additional it adds extack pointer to common qdisc callback handling this
> offers per qdisc implementation to setting the extack message for each
> failure over netlink.
> 
> The extack message will be set deeper in qdisc functions but going not
> deeper as net core api. For qdisc module callback handling, the extack
> will not be set. This will be part of per qdisc extack handling.
> 
> I also want to prepare patches to handle extack per qdisc module...
> so there will come a lot of more patches, just cut them down to make
> it reviewable.
> 
> There are some above 80-chars width warnings, which I ignore because
> it looks more ugly otherwise.
> 
> This patch-series based on patches by David Ahren which gave me some
> hints how to deal with extack support.
> 
> Cc: David Ahern <dsahern@gmail.com>

Only add the plumbing when you have actual extack messages you are
adding as an example use case.

Thank you.

^ permalink raw reply

* Re: [PATCH] net_sched: use macvlan real dev trans_start in dev_trans_start()
From: David Miller @ 2017-12-06 20:34 UTC (permalink / raw)
  To: christopher.dion; +Cc: jhs, xiyou.wangcong, jiri, netdev, linux-kernel
In-Reply-To: <1512575428-16377-1-git-send-email-christopher.dion@dell.com>

From: Chris Dion <christopher.dion@dell.com>
Date: Wed,  6 Dec 2017 10:50:28 -0500

> Macvlan devices are similar to vlans and do not update their
> own trans_start. In order for arp monitoring to work for a bond device
> when the slaves are macvlans, obtain its real device.
> 
> Signed-off-by: Chris Dion <christopher.dion@dell.com>

Looks good, applied.

^ permalink raw reply

* Re: [PATCH v4 net-next] net/tcp: trace all TCP/IP state transition with tcp_set_state tracepoint
From: David Miller @ 2017-12-06 20:27 UTC (permalink / raw)
  To: laoar.shao
  Cc: songliubraving, marcelo.leitner, kuznet, yoshfuji, rostedt,
	bgregg, netdev, linux-kernel
In-Reply-To: <1512572489-1829-1-git-send-email-laoar.shao@gmail.com>

From: Yafang Shao <laoar.shao@gmail.com>
Date: Wed,  6 Dec 2017 15:01:29 +0000

> v3->v4: Do not trace DCCP socket

This is not sufficient.

Your test will match SCTP stream sockets.

^ permalink raw reply

* Re: [PATCH net-next] ipvlan: Eliminate duplicated codes with existing function
From: David Miller @ 2017-12-06 20:15 UTC (permalink / raw)
  To: gfree.wind; +Cc: netdev
In-Reply-To: <1512558266-83747-1-git-send-email-gfree.wind@vip.163.com>

From: gfree.wind@vip.163.com
Date: Wed,  6 Dec 2017 19:04:26 +0800

> From: Gao Feng <gfree.wind@vip.163.com>
> 
> The recv flow of ipvlan l2 mode performs as same as l3 mode for
> non-multicast packet, so use the existing func ipvlan_handle_mode_l3
> instead of these duplicated statements in non-multicast case.
> 
> Signed-off-by: Gao Feng <gfree.wind@vip.163.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH V2] selinux: Add SCTP support
From: David Miller @ 2017-12-06 20:13 UTC (permalink / raw)
  To: richard_c_haines
  Cc: selinux, netdev, linux-sctp, linux-security-module, paul,
	vyasevich, nhorman, sds, eparis, marcelo.leitner
In-Reply-To: <20171206101736.3217-1-richard_c_haines@btinternet.com>

From: Richard Haines <richard_c_haines@btinternet.com>
Date: Wed,  6 Dec 2017 10:17:36 +0000

> The SELinux SCTP implementation is explained in:
> Documentation/security/SELinux-sctp.rst
> 
> Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>

No general objections from the networking side, so:

Acked-by: David S. Miller <davem@davemloft.net>

from me.  But if I were you I'd wait for some review from the
SCTP maintainers and experts. :-)

^ permalink raw reply

* [PATCH V2] netlink: Add netns check on taps
From: Kevin Cernekee @ 2017-12-06 20:12 UTC (permalink / raw)
  To: davem; +Cc: johannes.berg, netdev, linux-kernel, daniel, dsahern

Currently, a nlmon link inside a child namespace can observe systemwide
netlink activity.  Filter the traffic so that nlmon can only sniff
netlink messages from its own netns.

Test case:

    vpnns -- bash -c "ip link add nlmon0 type nlmon; \
                      ip link set nlmon0 up; \
                      tcpdump -i nlmon0 -q -w /tmp/nlmon.pcap -U" &
    sudo ip xfrm state add src 10.1.1.1 dst 10.1.1.2 proto esp \
        spi 0x1 mode transport \
        auth sha1 0x6162633132330000000000000000000000000000 \
        enc aes 0x00000000000000000000000000000000
    grep --binary abc123 /tmp/nlmon.pcap

Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
---
 net/netlink/af_netlink.c | 3 +++
 1 file changed, 3 insertions(+)


V1->V2: Drop the special exception for init_net.
Compile-tested only, will retest later today.


diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index b9e0ee4..79cc1bf 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -253,6 +253,9 @@ static int __netlink_deliver_tap_skb(struct sk_buff *skb,
 	struct sock *sk = skb->sk;
 	int ret = -ENOMEM;
 
+	if (!net_eq(dev_net(dev), sock_net(sk)))
+		return 0;
+
 	dev_hold(dev);
 
 	if (is_vmalloc_addr(skb->head))
-- 
2.7.4

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox