summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorsirlucjan2016-12-06 14:07:33 +0100
committersirlucjan2016-12-06 14:07:33 +0100
commitc3ef7008d49063228c69cb12eab592d87c8b8f02 (patch)
treefb53da8f6a7adb50988eeeb7c958b4fbd796d4e1
parent5aebbc28d3cd9a0828bf19fffc38be0043f93e4d (diff)
downloadaur-c3ef7008d49063228c69cb12eab592d87c8b8f02.tar.gz
Bump to 4.8.11-rt7-2
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD11
-rw-r--r--fix_race_condition_in_packet_set_ring.diff84
3 files changed, 97 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index bdb0393f5133..94ada5e572aa 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,8 +1,8 @@
# Generated by mksrcinfo v8
-# Thu Dec 1 19:35:02 UTC 2016
+# Tue Dec 6 13:07:19 UTC 2016
pkgbase = linux-rt-bfq
pkgver = 4.8.11_rt7
- pkgrel = 1
+ pkgrel = 2
url = http://algo.ing.unimo.it
arch = i686
arch = x86_64
@@ -28,6 +28,7 @@ pkgbase = linux-rt-bfq
source = config.x86_64
source = 99-linux.hook
source = linux.preset
+ source = fix_race_condition_in_packet_set_ring.diff
source = 0005-BFQ-Fix.patch
source = 0006-BFQ-Fix.patch
sha512sums = a48a065f21e1c7c4de4cf8ca47b8b8d9a70f86b64e7cfa6e01be490f78895745b9c8790734b1d22182cf1f930fb87eaaa84e62ec8cc1f64ac4be9b949e7c0358
@@ -47,6 +48,7 @@ pkgbase = linux-rt-bfq
sha512sums = a6200ad0c8bc44b97233c0cbd4c419c37727f06e735f2c6b60a28e94bfdc6d31d7f26d24f9f898c62fceefe08dfd3bdbd5d71acf2b5fcedbda8ea3881d284daa
sha512sums = d6faa67f3ef40052152254ae43fee031365d0b1524aa0718b659eb75afc21a3f79ea8d62d66ea311a800109bed545bc8f79e8752319cd378eef2cbd3a09aba22
sha512sums = 2dc6b0ba8f7dbf19d2446c5c5f1823587de89f4e28e9595937dd51a87755099656f2acec50e3e2546ea633ad1bfd1c722e0c2b91eef1d609103d8abdc0a7cbaf
+ sha512sums = fd5800dcc1b9e7825892dfaedf78d9b64f354695992c9a1b0014e66664c6f0f4c80989439df360c994aab03dc4aa1f4e3481f153a6b4383c9e39da93c8d235d0
sha512sums = 3889679e288d51f6fecc7ed6581ccde34acbf1e4861f5c9ca237a1ad13158502757d3fc457d7b6caf1c8c99c9dba842265004154a71cffb8ec14e1030e49e312
sha512sums = 3c3f3b6407d9a1a63cd91c2b5c35e6c932afa5bf33f1b2e8a530dbd9eacda8c8f956616c4cc9228657624da58e354ba5714252237d84ff3386fd65cf44f06ddc
diff --git a/PKGBUILD b/PKGBUILD
index 0bb80f6eefab..da1f5b25fd16 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -54,7 +54,7 @@ _srcname=linux-4.8
_pkgver=4.8.11
_rtpatchver=rt7
pkgver=${_pkgver}_${_rtpatchver}
-pkgrel=1
+pkgrel=2
arch=('i686' 'x86_64')
url="http://algo.ing.unimo.it"
license=('GPL2')
@@ -85,6 +85,7 @@ source=("http://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.xz"
'99-linux.hook'
# standard config files for mkinitcpio ramdisk
'linux.preset'
+ 'fix_race_condition_in_packet_set_ring.diff'
# patches from https://github.com/linusw/linux-bfq/commits/bfq-v8
'0005-BFQ-Fix.patch'
'0006-BFQ-Fix.patch')
@@ -111,7 +112,12 @@ prepare() {
# remove this when a Kconfig knob is made available by upstream
# (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
msg "Patching set DEFAULT_CONSOLE_LOGLEVEL to 4"
- patch -p1 -i "${srcdir}/change-default-console-loglevel.patch"
+ patch -p1 -i "${srcdir}/change-default-console-loglevel.patch"
+
+ ### fix a race condition that allows to gain root
+ # https://marc.info/?l=linux-netdev&m=148054660230570&w=2
+ msg "Fix a race condition that allows to gain root"
+ patch -p1 -i "${srcdir}/fix_race_condition_in_packet_set_ring.diff"
### Patch source with BFQ
msg "Patching source with BFQ patches"
@@ -472,6 +478,7 @@ sha512sums=('a48a065f21e1c7c4de4cf8ca47b8b8d9a70f86b64e7cfa6e01be490f78895745b9c
'a6200ad0c8bc44b97233c0cbd4c419c37727f06e735f2c6b60a28e94bfdc6d31d7f26d24f9f898c62fceefe08dfd3bdbd5d71acf2b5fcedbda8ea3881d284daa'
'd6faa67f3ef40052152254ae43fee031365d0b1524aa0718b659eb75afc21a3f79ea8d62d66ea311a800109bed545bc8f79e8752319cd378eef2cbd3a09aba22'
'2dc6b0ba8f7dbf19d2446c5c5f1823587de89f4e28e9595937dd51a87755099656f2acec50e3e2546ea633ad1bfd1c722e0c2b91eef1d609103d8abdc0a7cbaf'
+ 'fd5800dcc1b9e7825892dfaedf78d9b64f354695992c9a1b0014e66664c6f0f4c80989439df360c994aab03dc4aa1f4e3481f153a6b4383c9e39da93c8d235d0'
'3889679e288d51f6fecc7ed6581ccde34acbf1e4861f5c9ca237a1ad13158502757d3fc457d7b6caf1c8c99c9dba842265004154a71cffb8ec14e1030e49e312'
'3c3f3b6407d9a1a63cd91c2b5c35e6c932afa5bf33f1b2e8a530dbd9eacda8c8f956616c4cc9228657624da58e354ba5714252237d84ff3386fd65cf44f06ddc')
diff --git a/fix_race_condition_in_packet_set_ring.diff b/fix_race_condition_in_packet_set_ring.diff
new file mode 100644
index 000000000000..12048f611d1a
--- /dev/null
+++ b/fix_race_condition_in_packet_set_ring.diff
@@ -0,0 +1,84 @@
+From: Philip Pettersson <philip.pettersson@gmail.com>
+
+When packet_set_ring creates a ring buffer it will initialize a
+struct timer_list if the packet version is TPACKET_V3. This value
+can then be raced by a different thread calling setsockopt to
+set the version to TPACKET_V1 before packet_set_ring has finished.
+
+This leads to a use-after-free on a function pointer in the
+struct timer_list when the socket is closed as the previously
+initialized timer will not be deleted.
+
+The bug is fixed by taking lock_sock(sk) in packet_setsockopt when
+changing the packet version while also taking the lock at the start
+of packet_set_ring.
+
+Fixes: f6fb8f100b80 ("af-packet: TPACKET_V3 flexible buffer implementation.")
+Signed-off-by: Philip Pettersson <philip.pettersson@gmail.com>
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+---
+ net/packet/af_packet.c | 18 ++++++++++++------
+ 1 file changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
+index d2238b204691b8e4f2e3acb9bc167b553ba32d50..dd2332390c45bbff7c3fc5d259453f2e1ca352bf 100644
+--- a/net/packet/af_packet.c
++++ b/net/packet/af_packet.c
+@@ -3648,19 +3648,25 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
+
+ if (optlen != sizeof(val))
+ return -EINVAL;
+- if (po->rx_ring.pg_vec || po->tx_ring.pg_vec)
+- return -EBUSY;
+ if (copy_from_user(&val, optval, sizeof(val)))
+ return -EFAULT;
+ switch (val) {
+ case TPACKET_V1:
+ case TPACKET_V2:
+ case TPACKET_V3:
+- po->tp_version = val;
+- return 0;
++ break;
+ default:
+ return -EINVAL;
+ }
++ lock_sock(sk);
++ if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) {
++ ret = -EBUSY;
++ } else {
++ po->tp_version = val;
++ ret = 0;
++ }
++ release_sock(sk);
++ return ret;
+ }
+ case PACKET_RESERVE:
+ {
+@@ -4164,6 +4170,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
+ /* Added to avoid minimal code churn */
+ struct tpacket_req *req = &req_u->req;
+
++ lock_sock(sk);
+ /* Opening a Tx-ring is NOT supported in TPACKET_V3 */
+ if (!closing && tx_ring && (po->tp_version > TPACKET_V2)) {
+ net_warn_ratelimited("Tx-ring is not supported.\n");
+@@ -4245,7 +4252,6 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
+ goto out;
+ }
+
+- lock_sock(sk);
+
+ /* Detach socket from network */
+ spin_lock(&po->bind_lock);
+@@ -4294,11 +4300,11 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
+ if (!tx_ring)
+ prb_shutdown_retire_blk_timer(po, rb_queue);
+ }
+- release_sock(sk);
+
+ if (pg_vec)
+ free_pg_vec(pg_vec, order, req->tp_block_nr);
+ out:
++ release_sock(sk);
+ return err;
+ }