Re: [PATCH 2/2] net: mark slab's used by ss as UAPI
Hi Stephen, I love your patch! Perhaps something to improve: [auto build test WARNING on net/master] [also build test WARNING on v4.16-rc2 next-20180223] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Stephen-Hemminger/mark-some-slabs-as-visible-not-mergeable/20180225-084344 reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) include/linux/init.h:134:6: sparse: attribute 'indirect_branch': unknown attribute include/linux/init.h:135:5: sparse: attribute 'indirect_branch': unknown attribute include/linux/init.h:268:6: sparse: attribute 'indirect_branch': unknown attribute include/linux/init.h:269:6: sparse: attribute 'indirect_branch': unknown attribute include/linux/printk.h:200:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/mem_encrypt.h:32:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/mem_encrypt.h:34:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/mem_encrypt.h:37:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/mem_encrypt.h:38:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/mem_encrypt.h:40:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/mem_encrypt.h:42:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/mem_encrypt.h:43:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/mem_encrypt.h:45:5: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/mem_encrypt.h:46:5: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/mem_encrypt.h:49:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/qspinlock.h:53:32: sparse: attribute 'indirect_branch': unknown attribute include/linux/workqueue.h:646:5: sparse: attribute 'indirect_branch': unknown attribute include/linux/workqueue.h:647:5: sparse: attribute 'indirect_branch': unknown attribute include/linux/memory_hotplug.h:221:13: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/numa.h:34:12: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/numa.h:35:13: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/numa.h:62:13: sparse: attribute 'indirect_branch': unknown attribute include/linux/vmalloc.h:64:13: sparse: attribute 'indirect_branch': unknown attribute include/linux/vmalloc.h:173:8: sparse: attribute 'indirect_branch': unknown attribute include/linux/vmalloc.h:174:8: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/fixmap.h:174:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/fixmap.h:176:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/fixmap.h:178:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/fixmap.h:180:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/apic.h:254:13: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/apic.h:430:13: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/io_apic.h:184:13: sparse: attribute 'indirect_branch': unknown attribute include/linux/mmzone.h:1292:15: sparse: attribute 'indirect_branch': unknown attribute include/linux/smp.h:113:6: sparse: attribute 'indirect_branch': unknown attribute include/linux/smp.h:125:13: sparse: attribute 'indirect_branch': unknown attribute include/linux/smp.h:126:13: sparse: attribute 'indirect_branch': unknown attribute include/linux/percpu.h:110:33: sparse: attribute 'indirect_branch': unknown attribute include/linux/percpu.h:112:13: sparse: attribute 'indirect_branch': unknown attribute include/linux/percpu.h:114:12: sparse: attribute 'indirect_branch': unknown attribute include/linux/percpu.h:118:12: sparse: attribute 'indirect_branch': unknown attribute include/linux/percpu.h:126:12: sparse: attribute 'indirect_branch': unknown attribute include/linux/kmemleak.h:29:33: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/kasan.h:29:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/kasan.h:30:6: sparse: attribute 'indirect_branch': unknown attribute arch/x86/include/asm/pgtable.h:28:5: sparse: attribute 'indirect_branch': unknown attribute include/linux/slab.h:141:6: sparse: attribute 'indirect_branch': unknown attribute include/linux/slab.h:722:6: sparse: attribute 'indirect_branch': unknown attribute include/linux/hrtimer.h:497:13: sparse: attribute 'indi
[PATCH 2/2] net: mark slab's used by ss as UAPI
The iproute2 ss command reads /proc/slabinfo as way to get estimates for number of open sockets etc. This has been broken since slab merging went in 3.17. Mark those kmem caches's as non mergeable with new flag. The TCP caches's are already not mergeable because of the RCU flags, but someone might change that and cause surprise later. Reported-by: Igor Komyagin Signed-off-by: Stephen Hemminger --- net/ipv4/tcp.c | 3 ++- net/ipv4/tcp_ipv4.c | 2 +- net/ipv6/tcp_ipv6.c | 2 +- net/socket.c| 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 48636aee23c3..8c0d4cdc601d 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3617,7 +3617,8 @@ void __init tcp_init(void) tcp_hashinfo.bind_bucket_cachep = kmem_cache_create("tcp_bind_bucket", sizeof(struct inet_bind_bucket), 0, - SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); + SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_VISIBLE_UAPI, + NULL); /* Size and allocate the main established and bind bucket * hash tables. diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index f8ad397e285e..4442f91fab93 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -2434,7 +2434,7 @@ struct proto tcp_prot = { .sysctl_rmem_offset = offsetof(struct net, ipv4.sysctl_tcp_rmem), .max_header = MAX_TCP_HEADER, .obj_size = sizeof(struct tcp_sock), - .slab_flags = SLAB_TYPESAFE_BY_RCU, + .slab_flags = SLAB_TYPESAFE_BY_RCU | SLAB_VISIBLE_UAPI, .twsk_prot = &tcp_timewait_sock_ops, .rsk_prot = &tcp_request_sock_ops, .h.hashinfo = &tcp_hashinfo, diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 412139f4eccd..d6df3b3f401c 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -1944,7 +1944,7 @@ struct proto tcpv6_prot = { .sysctl_rmem_offset = offsetof(struct net, ipv4.sysctl_tcp_rmem), .max_header = MAX_TCP_HEADER, .obj_size = sizeof(struct tcp6_sock), - .slab_flags = SLAB_TYPESAFE_BY_RCU, + .slab_flags = SLAB_TYPESAFE_BY_RCU | SLAB_VISIBLE_UAPI, .twsk_prot = &tcp6_timewait_sock_ops, .rsk_prot = &tcp6_request_sock_ops, .h.hashinfo = &tcp_hashinfo, diff --git a/net/socket.c b/net/socket.c index a93c99b518ca..f76ae11af8c7 100644 --- a/net/socket.c +++ b/net/socket.c @@ -286,9 +286,9 @@ static void init_inodecache(void) sock_inode_cachep = kmem_cache_create("sock_inode_cache", sizeof(struct socket_alloc), 0, - (SLAB_HWCACHE_ALIGN | - SLAB_RECLAIM_ACCOUNT | - SLAB_MEM_SPREAD | SLAB_ACCOUNT), + SLAB_HWCACHE_ALIGN | SLAB_VISIBLE_UAPI | + SLAB_RECLAIM_ACCOUNT | + SLAB_MEM_SPREAD | SLAB_ACCOUNT, init_once); BUG_ON(sock_inode_cachep == NULL); } -- 2.16.1