<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/net/sched, branch linux-4.8.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.8.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.8.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2016-12-10T18:09:39Z</updated>
<entry>
<title>net/sched: pedit: make sure that offset is valid</title>
<updated>2016-12-10T18:09:39Z</updated>
<author>
<name>Amir Vadai</name>
</author>
<published>2016-11-28T10:56:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=360d6a23e79d68c570a9346c1ad07854d1abb434'/>
<id>urn:sha1:360d6a23e79d68c570a9346c1ad07854d1abb434</id>
<content type='text'>
[ Upstream commit 95c2027bfeda21a28eb245121e6a249f38d0788e ]

Add a validation function to make sure offset is valid:
1. Not below skb head (could happen when offset is negative).
2. Validate both 'offset' and 'at'.

Signed-off-by: Amir Vadai &lt;amir@vadai.me&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>net, sched: respect rcu grace period on cls destruction</title>
<updated>2016-12-10T18:09:39Z</updated>
<author>
<name>Daniel Borkmann</name>
</author>
<published>2016-11-27T00:18:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9a747927394998cab12a8462dbd735e8b1f9670d'/>
<id>urn:sha1:9a747927394998cab12a8462dbd735e8b1f9670d</id>
<content type='text'>
[ Upstream commit d936377414fadbafb4d17148d222fe45ca5442d4 ]

Roi reported a crash in flower where tp-&gt;root was NULL in -&gt;classify()
callbacks. Reason is that in -&gt;destroy() tp-&gt;root is set to NULL via
RCU_INIT_POINTER(). It's problematic for some of the classifiers, because
this doesn't respect RCU grace period for them, and as a result, still
outstanding readers from tc_classify() will try to blindly dereference
a NULL tp-&gt;root.

The tp-&gt;root object is strictly private to the classifier implementation
and holds internal data the core such as tc_ctl_tfilter() doesn't know
about. Within some classifiers, such as cls_bpf, cls_basic, etc, tp-&gt;root
is only checked for NULL in -&gt;get() callback, but nowhere else. This is
misleading and seemed to be copied from old classifier code that was not
cleaned up properly. For example, d3fa76ee6b4a ("[NET_SCHED]: cls_basic:
fix NULL pointer dereference") moved tp-&gt;root initialization into -&gt;init()
routine, where before it was part of -&gt;change(), so -&gt;get() had to deal
with tp-&gt;root being NULL back then, so that was indeed a valid case, after
d3fa76ee6b4a, not really anymore. We used to set tp-&gt;root to NULL long
ago in -&gt;destroy(), see 47a1a1d4be29 ("pkt_sched: remove unnecessary xchg()
in packet classifiers"); but the NULLifying was reintroduced with the
RCUification, but it's not correct for every classifier implementation.

In the cases that are fixed here with one exception of cls_cgroup, tp-&gt;root
object is allocated and initialized inside -&gt;init() callback, which is always
performed at a point in time after we allocate a new tp, which means tp and
thus tp-&gt;root was not globally visible in the tp chain yet (see tc_ctl_tfilter()).
Also, on destruction tp-&gt;root is strictly kfree_rcu()'ed in -&gt;destroy()
handler, same for the tp which is kfree_rcu()'ed right when we return
from -&gt;destroy() in tcf_destroy(). This means, the head object's lifetime
for such classifiers is always tied to the tp lifetime. The RCU callback
invocation for the two kfree_rcu() could be out of order, but that's fine
since both are independent.

Dropping the RCU_INIT_POINTER(tp-&gt;root, NULL) for these classifiers here
means that 1) we don't need a useless NULL check in fast-path and, 2) that
outstanding readers of that tp in tc_classify() can still execute under
respect with RCU grace period as it is actually expected.

Things that haven't been touched here: cls_fw and cls_route. They each
handle tp-&gt;root being NULL in -&gt;classify() path for historic reasons, so
their -&gt;destroy() implementation can stay as is. If someone actually
cares, they could get cleaned up at some point to avoid the test in fast
path. cls_u32 doesn't set tp-&gt;root to NULL. For cls_rsvp, I just added a
!head should anyone actually be using/testing it, so it at least aligns with
cls_fw and cls_route. For cls_flower we additionally need to defer rhashtable
destruction (to a sleepable context) after RCU grace period as concurrent
readers might still access it. (Note that in this case we need to hold module
reference to keep work callback address intact, since we only wait on module
unload for all call_rcu()s to finish.)

This fixes one race to bring RCU grace period guarantees back. Next step
as worked on by Cong however is to fix 1e052be69d04 ("net_sched: destroy
proto tp when all filters are gone") to get the order of unlinking the tp
in tc_ctl_tfilter() for the RTM_DELTFILTER case right by moving
RCU_INIT_POINTER() before tcf_destroy() and let the notification for
removal be done through the prior -&gt;delete() callback. Both are independant
issues. Once we have that right, we can then clean tp-&gt;root up for a number
of classifiers by not making them RCU pointers, which requires a new callback
(-&gt;uninit) that is triggered from tp's RCU callback, where we just kfree()
tp-&gt;root from there.

Fixes: 1f947bf151e9 ("net: sched: rcu'ify cls_bpf")
Fixes: 9888faefe132 ("net: sched: cls_basic use RCU")
Fixes: 70da9f0bf999 ("net: sched: cls_flow use RCU")
Fixes: 77b9900ef53a ("tc: introduce Flower classifier")
Fixes: bf3994d2ed31 ("net/sched: introduce Match-all classifier")
Fixes: 952313bd6258 ("net: sched: cls_cgroup use RCU")
Reported-by: Roi Dayan &lt;roid@mellanox.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Cc: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Cc: John Fastabend &lt;john.fastabend@gmail.com&gt;
Cc: Roi Dayan &lt;roid@mellanox.com&gt;
Cc: Jiri Pirko &lt;jiri@mellanox.com&gt;
Acked-by: John Fastabend &lt;john.r.fastabend@intel.com&gt;
Acked-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>net sched filters: fix notification of filter delete with proper handle</title>
<updated>2016-11-15T06:48:53Z</updated>
<author>
<name>Jamal Hadi Salim</name>
</author>
<published>2016-10-25T00:18:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5a37dce1b67926646dc3ad1b509f174c271e400f'/>
<id>urn:sha1:5a37dce1b67926646dc3ad1b509f174c271e400f</id>
<content type='text'>
[ Upstream commit 9ee7837449b3d6f0fcf9132c6b5e5aaa58cc67d4 ]

Daniel says:

While trying out [1][2], I noticed that tc monitor doesn't show the
correct handle on delete:

$ tc monitor
qdisc clsact ffff: dev eno1 parent ffff:fff1
filter dev eno1 ingress protocol all pref 49152 bpf handle 0x2a [...]
deleted filter dev eno1 ingress protocol all pref 49152 bpf handle 0xf3be0c80

some context to explain the above:
The user identity of any tc filter is represented by a 32-bit
identifier encoded in tcm-&gt;tcm_handle. Example 0x2a in the bpf filter
above. A user wishing to delete, get or even modify a specific filter
uses this handle to reference it.
Every classifier is free to provide its own semantics for the 32 bit handle.
Example: classifiers like u32 use schemes like 800:1:801 to describe
the semantics of their filters represented as hash table, bucket and
node ids etc.
Classifiers also have internal per-filter representation which is different
from this externally visible identity. Most classifiers set this
internal representation to be a pointer address (which allows fast retrieval
of said filters in their implementations). This internal representation
is referenced with the "fh" variable in the kernel control code.

When a user successfuly deletes a specific filter, by specifying the correct
tcm-&gt;tcm_handle, an event is generated to user space which indicates
which specific filter was deleted.

Before this patch, the "fh" value was sent to user space as the identity.
As an example what is shown in the sample bpf filter delete event above
is 0xf3be0c80. This is infact a 32-bit truncation of 0xffff8807f3be0c80
which happens to be a 64-bit memory address of the internal filter
representation (address of the corresponding filter's struct cls_bpf_prog);

After this patch the appropriate user identifiable handle as encoded
in the originating request tcm-&gt;tcm_handle is generated in the event.
One of the cardinal rules of netlink rules is to be able to take an
event (such as a delete in this case) and reflect it back to the
kernel and successfully delete the filter. This patch achieves that.

Note, this issue has existed since the original TC action
infrastructure code patch back in 2004 as found in:
https://git.kernel.org/cgit/linux/kernel/git/history/history.git/commit/

[1] http://patchwork.ozlabs.org/patch/682828/
[2] http://patchwork.ozlabs.org/patch/682829/

Fixes: 4e54c4816bfe ("[NET]: Add tc extensions infrastructure.")
Reported-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Signed-off-by: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>net_sched: reorder pernet ops and act ops registrations</title>
<updated>2016-11-15T06:48:51Z</updated>
<author>
<name>WANG Cong</name>
</author>
<published>2016-10-11T17:56:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=50b43ad1dce67ac96e3955b57d370461ac34d6c1'/>
<id>urn:sha1:50b43ad1dce67ac96e3955b57d370461ac34d6c1</id>
<content type='text'>
[ Upstream commit ab102b80cef28c20b3ef7794806c3a982c6444fc ]

Krister reported a kernel NULL pointer dereference after
tcf_action_init_1() invokes a_o-&gt;init(), it is a race condition
where one thread calling tcf_register_action() to initialize
the netns data after putting act ops in the global list and
the other thread searching the list and then calling
a_o-&gt;init(net, ...).

Fix this by moving the pernet ops registration before making
the action ops visible. This is fine because: a) we don't
rely on act_base in pernet ops-&gt;init(), b) in the worst case we
have a fully initialized netns but ops is still not ready so
new actions still can't be created.

Reported-by: Krister Johansen &lt;kjlx@templeofstupid.com&gt;
Tested-by: Krister Johansen &lt;kjlx@templeofstupid.com&gt;
Cc: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Signed-off-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Acked-by: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>net/sched: act_vlan: Push skb-&gt;data to mac_header prior calling skb_vlan_*() functions</title>
<updated>2016-11-15T06:48:51Z</updated>
<author>
<name>Shmulik Ladkani</name>
</author>
<published>2016-09-29T09:10:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9caee42c800e21aa0510aaca894c59bf4b306258'/>
<id>urn:sha1:9caee42c800e21aa0510aaca894c59bf4b306258</id>
<content type='text'>
[ Upstream commit f39acc84aad10710e89835c60d3b6694c43a8dd9 ]

Generic skb_vlan_push/skb_vlan_pop functions don't properly handle the
case where the input skb data pointer does not point at the mac header:

- They're doing push/pop, but fail to properly unwind data back to its
  original location.
  For example, in the skb_vlan_push case, any subsequent
  'skb_push(skb, skb-&gt;mac_len)' calls make the skb-&gt;data point 4 bytes
  BEFORE start of frame, leading to bogus frames that may be transmitted.

- They update rcsum per the added/removed 4 bytes tag.
  Alas if data is originally after the vlan/eth headers, then these
  bytes were already pulled out of the csum.

OTOH calling skb_vlan_push/skb_vlan_pop with skb-&gt;data at mac_header
present no issues.

act_vlan is the only caller to skb_vlan_*() that has skb-&gt;data pointing
at network header (upon ingress).
Other calles (ovs, bpf) already adjust skb-&gt;data at mac_header.

This patch fixes act_vlan to point to the mac_header prior calling
skb_vlan_*() functions, as other callers do.

Signed-off-by: Shmulik Ladkani &lt;shmulik.ladkani@gmail.com&gt;
Cc: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Cc: Pravin Shelar &lt;pshelar@ovn.org&gt;
Cc: Jiri Pirko &lt;jiri@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>act_ife: Fix false encoding</title>
<updated>2016-09-27T13:53:17Z</updated>
<author>
<name>Yotam Gigi</name>
</author>
<published>2016-09-26T10:45:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c006da0be033b6ddcd27ee603d0ee01491236642'/>
<id>urn:sha1:c006da0be033b6ddcd27ee603d0ee01491236642</id>
<content type='text'>
On ife encode side, the action stores the different tlvs inside the ife
header, where each tlv length field should refer to the length of the
whole tlv (without additional padding) and not just the data length.

On ife decode side, the action iterates over the tlvs in the ife header
and parses them one by one, where in each iteration the current pointer is
advanced according to the tlv size.

Before, the encoding encoded only the data length inside the tlv, which led
to false parsing of ife the header. In addition, due to the fact that the
loop counter was unsigned, it could lead to infinite parsing loop.

This fix changes the loop counter to be signed and fixes the encoding to
take into account the tlv type and size.

Fixes: 28a10c426e81 ("net sched: fix encoding to use real length")
Acked-by: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Signed-off-by: Yotam Gigi &lt;yotamg@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>act_ife: Fix external mac header on encode</title>
<updated>2016-09-27T13:53:16Z</updated>
<author>
<name>Yotam Gigi</name>
</author>
<published>2016-09-26T10:45:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4b1d488a285a446329825d5fe91f987b7880e6e5'/>
<id>urn:sha1:4b1d488a285a446329825d5fe91f987b7880e6e5</id>
<content type='text'>
On ife encode side, external mac header is copied from the original packet
and may be overridden if the user requests. Before, the mac header copy
was done from memory region that might not be accessible anymore, as
skb_cow_head might free it and copy the packet. This led to random values
in the external mac header once the values were not set by user.

This fix takes the internal mac header from the packet, after the call to
skb_cow_head.

Fixes: ef6980b6becb ("net sched: introduce IFE action")
Acked-by: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Signed-off-by: Yotam Gigi &lt;yotamg@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sch_sfb: keep backlog updated with qlen</title>
<updated>2016-09-23T10:52:31Z</updated>
<author>
<name>WANG Cong</name>
</author>
<published>2016-09-18T23:22:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3d4357fba82b3cf19ebf0a04d1c9cb086af15d02'/>
<id>urn:sha1:3d4357fba82b3cf19ebf0a04d1c9cb086af15d02</id>
<content type='text'>
Fixes: 2ccccf5fb43f ("net_sched: update hierarchical backlog too")
Cc: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Signed-off-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Acked-by: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sch_qfq: keep backlog updated with qlen</title>
<updated>2016-09-23T10:52:31Z</updated>
<author>
<name>WANG Cong</name>
</author>
<published>2016-09-18T23:22:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2ed5c3f09627f72a2e0e407a86b2ac05494190f9'/>
<id>urn:sha1:2ed5c3f09627f72a2e0e407a86b2ac05494190f9</id>
<content type='text'>
Reported-by: Stas Nichiporovich &lt;stasn77@gmail.com&gt;
Fixes: 2ccccf5fb43f ("net_sched: update hierarchical backlog too")
Cc: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Signed-off-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Acked-by: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>qdisc: fix a module refcount leak in qdisc_create_dflt()</title>
<updated>2016-08-25T23:44:20Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2016-08-24T16:39:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=166ee5b87866de07a3e56c1b757f2b5cabba72a5'/>
<id>urn:sha1:166ee5b87866de07a3e56c1b757f2b5cabba72a5</id>
<content type='text'>
Should qdisc_alloc() fail, we must release the module refcount
we got right before.

Fixes: 6da7c8fcbcbd ("qdisc: allow setting default queuing discipline")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Acked-by: John Fastabend &lt;john.r.fastabend@intel.com&gt;
Acked-by: John Fastabend &lt;john.r.fastabend@intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
