60 lines
1.8 KiB
Diff
60 lines
1.8 KiB
Diff
From: Salvatore Bonaccorso <carnil@debian.org>
|
|
Date: Fri, 2 Feb 2018 13:33:53 +0100
|
|
Subject: Revert "bpf: avoid false sharing of map refcount with max_entries"
|
|
Origin: https://git.kernel.org/linus/d5b555516e042378f54c1640ba61265e76a8b6e9
|
|
|
|
This reverts commit 3ea4247ec1b7efc423cf4f75450ebf5cffab9ed8 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 | 21 +++++----------------
|
|
1 file changed, 5 insertions(+), 16 deletions(-)
|
|
|
|
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
|
|
index 5c5be80ce802..0bcf803f20de 100644
|
|
--- a/include/linux/bpf.h
|
|
+++ b/include/linux/bpf.h
|
|
@@ -42,14 +42,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;
|
|
- struct bpf_map *inner_map_meta;
|
|
-#ifdef CONFIG_SECURITY
|
|
- void *security;
|
|
-#endif
|
|
+ atomic_t refcnt;
|
|
enum bpf_map_type map_type;
|
|
u32 key_size;
|
|
u32 value_size;
|
|
@@ -59,15 +52,11 @@ struct bpf_map {
|
|
u32 id;
|
|
int numa_node;
|
|
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 *inner_map_meta;
|
|
};
|
|
|
|
/* function argument constraints */
|
|
--
|
|
2.11.0
|
|
|