Skip to content

Commit d3593b5

Browse files
edumazetdavem330
authored andcommitted
Revert "selinux: add a skb_owned_by() hook"
This reverts commit ca10b9e. No longer needed after commit eb8895d ("tcp: tcp_make_synack() should use sock_wmalloc") When under SYNFLOOD, we build lot of SYNACK and hit false sharing because of multiple modifications done on sk_listener->sk_wmem_alloc Since tcp_make_synack() uses sock_wmalloc(), there is no need to call skb_set_owner_w() again, as this adds two atomic operations. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f6877fc commit d3593b5

File tree

5 files changed

+0
-27
lines changed

5 files changed

+0
-27
lines changed

include/linux/security.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,6 @@ struct security_operations {
17161716
int (*tun_dev_attach_queue) (void *security);
17171717
int (*tun_dev_attach) (struct sock *sk, void *security);
17181718
int (*tun_dev_open) (void *security);
1719-
void (*skb_owned_by) (struct sk_buff *skb, struct sock *sk);
17201719
#endif /* CONFIG_SECURITY_NETWORK */
17211720

17221721
#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -2735,8 +2734,6 @@ int security_tun_dev_attach_queue(void *security);
27352734
int security_tun_dev_attach(struct sock *sk, void *security);
27362735
int security_tun_dev_open(void *security);
27372736

2738-
void security_skb_owned_by(struct sk_buff *skb, struct sock *sk);
2739-
27402737
#else /* CONFIG_SECURITY_NETWORK */
27412738
static inline int security_unix_stream_connect(struct sock *sock,
27422739
struct sock *other,
@@ -2928,11 +2925,6 @@ static inline int security_tun_dev_open(void *security)
29282925
{
29292926
return 0;
29302927
}
2931-
2932-
static inline void security_skb_owned_by(struct sk_buff *skb, struct sock *sk)
2933-
{
2934-
}
2935-
29362928
#endif /* CONFIG_SECURITY_NETWORK */
29372929

29382930
#ifdef CONFIG_SECURITY_NETWORK_XFRM

net/ipv4/tcp_output.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2926,7 +2926,6 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
29262926
skb_reserve(skb, MAX_TCP_HEADER);
29272927

29282928
skb_dst_set(skb, dst);
2929-
security_skb_owned_by(skb, sk);
29302929

29312930
mss = dst_metric_advmss(dst);
29322931
if (tp->rx_opt.user_mss && tp->rx_opt.user_mss < mss)

security/capability.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -776,11 +776,6 @@ static int cap_tun_dev_open(void *security)
776776
{
777777
return 0;
778778
}
779-
780-
static void cap_skb_owned_by(struct sk_buff *skb, struct sock *sk)
781-
{
782-
}
783-
784779
#endif /* CONFIG_SECURITY_NETWORK */
785780

786781
#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -1134,7 +1129,6 @@ void __init security_fixup_ops(struct security_operations *ops)
11341129
set_to_cap_if_null(ops, tun_dev_open);
11351130
set_to_cap_if_null(ops, tun_dev_attach_queue);
11361131
set_to_cap_if_null(ops, tun_dev_attach);
1137-
set_to_cap_if_null(ops, skb_owned_by);
11381132
#endif /* CONFIG_SECURITY_NETWORK */
11391133
#ifdef CONFIG_SECURITY_NETWORK_XFRM
11401134
set_to_cap_if_null(ops, xfrm_policy_alloc_security);

security/security.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,11 +1359,6 @@ int security_tun_dev_open(void *security)
13591359
}
13601360
EXPORT_SYMBOL(security_tun_dev_open);
13611361

1362-
void security_skb_owned_by(struct sk_buff *skb, struct sock *sk)
1363-
{
1364-
security_ops->skb_owned_by(skb, sk);
1365-
}
1366-
13671362
#endif /* CONFIG_SECURITY_NETWORK */
13681363

13691364
#ifdef CONFIG_SECURITY_NETWORK_XFRM

security/selinux/hooks.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
#include <linux/tty.h>
5252
#include <net/icmp.h>
5353
#include <net/ip.h> /* for local_port_range[] */
54-
#include <net/sock.h>
5554
#include <net/tcp.h> /* struct or_callable used in sock_rcv_skb */
5655
#include <net/inet_connection_sock.h>
5756
#include <net/net_namespace.h>
@@ -4652,11 +4651,6 @@ static void selinux_inet_conn_established(struct sock *sk, struct sk_buff *skb)
46524651
selinux_skb_peerlbl_sid(skb, family, &sksec->peer_sid);
46534652
}
46544653

4655-
static void selinux_skb_owned_by(struct sk_buff *skb, struct sock *sk)
4656-
{
4657-
skb_set_owner_w(skb, sk);
4658-
}
4659-
46604654
static int selinux_secmark_relabel_packet(u32 sid)
46614655
{
46624656
const struct task_security_struct *__tsec;
@@ -6041,7 +6035,6 @@ static struct security_operations selinux_ops = {
60416035
.tun_dev_attach_queue = selinux_tun_dev_attach_queue,
60426036
.tun_dev_attach = selinux_tun_dev_attach,
60436037
.tun_dev_open = selinux_tun_dev_open,
6044-
.skb_owned_by = selinux_skb_owned_by,
60456038

60466039
#ifdef CONFIG_SECURITY_NETWORK_XFRM
60476040
.xfrm_policy_alloc_security = selinux_xfrm_policy_alloc,

0 commit comments

Comments
 (0)