[linux] 10/11: revert struct bpf_map modifications in 4.9.79 to prevent ABI changes

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Fri Feb 2 15:17:08 UTC 2018


This is an automated email from the git hooks/post-receive script.

corsac pushed a commit to branch stretch
in repository linux.

commit 0d50f6576d86f5f3d63617263433337bd8e5d148
Author: Yves-Alexis Perez <corsac at debian.org>
Date:   Fri Feb 2 11:26:47 2018 +0100

    revert struct bpf_map modifications in 4.9.79 to prevent ABI changes
---
 debian/changelog                                   |  2 +-
 ...avoid-false-sharing-of-map-refcount-with-.patch | 56 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 604af63..93adf75 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -863,7 +863,7 @@ linux (4.9.79-1) UNRELEASED; urgency=medium
     - bugfix/all/netfilter-nfnetlink_cthelper-add-missing-permission-.patch
     - bugfix/all/netfilter-xt_osf-add-missing-permission-checks.patch
     - bugfix/all/nfsd-auth-Fix-gid-sorting-when-rootsquash-enabled.patch
-  * bpf: avoid ABI change in 4.9.77.
+  * bpf: avoid ABI changes in 4.9.77 and 4.9.79.
   * Ignore ABI change for cpu_tlbstate (symbol not exported _GPL anymore)
   * sched/rt: Avoid ABI change in 4.9.66.
   * Ignore ABI change for tcp_cong_avoid_ai and tcp_slow_start.
diff --git a/debian/patches/debian/revert-bpf-avoid-false-sharing-of-map-refcount-with-.patch b/debian/patches/debian/revert-bpf-avoid-false-sharing-of-map-refcount-with-.patch
new file mode 100644
index 0000000..8ee9c4a
--- /dev/null
+++ b/debian/patches/debian/revert-bpf-avoid-false-sharing-of-map-refcount-with-.patch
@@ -0,0 +1,56 @@
+From 50a81ed77e0b88330d0f85515022bf4d2c0aebeb Mon Sep 17 00:00:00 2001
+From: Yves-Alexis Perez <corsac at debian.org>
+Date: Fri, 2 Feb 2018 10:40:47 +0100
+Subject: [PATCH] Revert "bpf: avoid false sharing of map refcount with max_entries"
+Forwarded: not-needed
+
+This reverts commit 5cb917aa1f1e03df9a4c29b363e3900d73508fa8 which is commit
+be95a845cc4402272994ce290e3ad928aff06cb9 upstream. This commit heavily
+modifies the bpf_map structure to split it on two cachelines and prevent
+sharing reference counter with other, read-only fields in order to mitigate
+Spectre attacks. This modification changes the ABI, so revert the mitigation
+for now since the infrastructure is not yet complete for Spectre mitigation
+anyway.
+
+---
+ include/linux/bpf.h | 16 ++++------------
+ 1 file changed, 4 insertions(+), 12 deletions(-)
+
+diff --git a/include/linux/bpf.h b/include/linux/bpf.h
+index 7995940d4187..75ffd3b2149e 100644
+--- a/include/linux/bpf.h
++++ b/include/linux/bpf.h
+@@ -36,10 +36,7 @@ struct bpf_map_ops {
+ };
+ 
+ struct bpf_map {
+-	/* 1st cacheline with read-mostly members of which some
+-	 * are also accessed in fast-path (e.g. ops, max_entries).
+-	 */
+-	const struct bpf_map_ops *ops ____cacheline_aligned;
++	atomic_t refcnt;
+ 	enum bpf_map_type map_type;
+ 	u32 key_size;
+ 	u32 value_size;
+@@ -47,15 +44,10 @@ struct bpf_map {
+ 	u32 map_flags;
+ 	u32 pages;
+ 	bool unpriv_array;
+-	/* 7 bytes hole */
+-
+-	/* 2nd cacheline with misc members to avoid false sharing
+-	 * particularly with refcounting.
+-	 */
+-	struct user_struct *user ____cacheline_aligned;
+-	atomic_t refcnt;
+-	atomic_t usercnt;
++	struct user_struct *user;
++	const struct bpf_map_ops *ops;
+ 	struct work_struct work;
++	atomic_t usercnt;
+ };
+ 
+ struct bpf_map_type_list {
+-- 
+2.15.1
+
diff --git a/debian/patches/series b/debian/patches/series
index 5a283c8..71e7432 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -185,6 +185,7 @@ debian/revert-mm-hugetlbfs-introduce-split-to-vm_operations.patch
 debian/revert-dma-fence-Introduce-drm_fence_set_error-helpe.patch
 debian/revert-lib-genalloc.c-make-the-avail-variable-an-ato.patch
 debian/revert-tcp-invalidate-rate-samples-during-SACK-reneg.patch
+debian/revert-bpf-avoid-false-sharing-of-map-refcount-with-.patch
 debian/bpf-avoid-abi-change-in-4.9.77.patch
 debian/revert-sched-rt-Simplify-the-IPI-based-RT-balancing-.patch
 debian/revert-mm-fix-100-CPU-kswapd-busyloop-on-unreclaimab.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list