From 52f21e39ea693e238e226821228d700bc00aefe7 Mon Sep 17 00:00:00 2001 From: RISCi_ATOM Date: Fri, 19 Apr 2019 13:37:00 -0400 Subject: [PATCH] Bump Linux-libre kernel to 4.4.178 This commit bumps the linux-libre kernel to v4.4.178 and does contain some changes that may break some things. Some of these changes include: * generic/902-debloat_proc.patch was removed since it is now in the upstream kernel and is no longer needed. * Reworked generic/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch since parts of this patch are now in the upstream kernel. * fix up mac80211 : more fixes are needed... This was in response to vanilla kernel upstream commit : *-stable : 8e50b8b07f462ab4b91bc1491b1c91bd75e4ad40 --- include/kernel-version.mk | 5 +- .../900-remove_get_user_pages-tmp-fix.patch | 50 +++ ...kb_cow_head-to-deal-with-cloned-skbs.patch | 40 -- ...kb_cow_head-to-deal-with-cloned-skbs.patch | 38 -- ...kb_cow_head-to-deal-with-cloned-skbs.patch | 43 -- ...98-usb-dwc2-Remove-unnecessary-kfree.patch | 24 -- ...prevent-redefinition-of-struct-ethhd.patch | 68 +--- .../patches-4.4/902-debloat_proc.patch | 385 ------------------ 8 files changed, 72 insertions(+), 581 deletions(-) create mode 100644 package/kernel/mac80211/patches/900-remove_get_user_pages-tmp-fix.patch delete mode 100644 target/linux/generic/patches-4.4/030-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch delete mode 100644 target/linux/generic/patches-4.4/030-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch delete mode 100644 target/linux/generic/patches-4.4/030-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch delete mode 100644 target/linux/generic/patches-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch delete mode 100644 target/linux/generic/patches-4.4/902-debloat_proc.patch diff --git a/include/kernel-version.mk b/include/kernel-version.mk index d62245c0d2..55e444d974 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -2,9 +2,10 @@ LINUX_RELEASE?=1 -LINUX_VERSION-4.4 = .167 +LINUX_VERSION-4.4 = .178 + +LINUX_KERNEL_HASH-4.4.178 = f7cab098ad71765985b39d30d09222e5d8809d55e3d9b2b018cbb40acc69fad1 -LINUX_KERNEL_HASH-4.4.167 = 301feaaecbbe030a7a3ea05a272cca11b8958dc9ec619ec77f562eb1c75f0784 ifdef KERNEL_PATCHVER LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER))) diff --git a/package/kernel/mac80211/patches/900-remove_get_user_pages-tmp-fix.patch b/package/kernel/mac80211/patches/900-remove_get_user_pages-tmp-fix.patch new file mode 100644 index 0000000000..95a3b8592d --- /dev/null +++ b/package/kernel/mac80211/patches/900-remove_get_user_pages-tmp-fix.patch @@ -0,0 +1,50 @@ +Index: compat-wireless-2017-01-31/backport-include/linux/mm.h +=================================================================== +--- compat-wireless-2017-01-31.orig/backport-include/linux/mm.h ++++ compat-wireless-2017-01-31/backport-include/linux/mm.h +@@ -27,45 +27,6 @@ + void kvfree(const void *addr); + #endif /* < 3.15 */ + +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,20,0)) +-#define get_user_pages_locked LINUX_BACKPORT(get_user_pages_locked) +-long get_user_pages_locked(unsigned long start, unsigned long nr_pages, +- int write, int force, struct page **pages, int *locked); +-#define get_user_pages_unlocked LINUX_BACKPORT(get_user_pages_unlocked) +-long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, +- int write, int force, struct page **pages); +-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)) +-static inline +-long backport_get_user_pages_locked(unsigned long start, unsigned long nr_pages, +- int write, int force, struct page **pages, int *locked) +-{ +- return get_user_pages_locked(current, current->mm, start, nr_pages, +- write, force, pages, locked); +-} +-#define get_user_pages_locked LINUX_BACKPORT(get_user_pages_locked) +- +-static inline +-long backport_get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, +- int write, int force, struct page **pages) +-{ +- return get_user_pages_unlocked(current, current->mm, start, nr_pages, +- write, force, pages); +-} +-#define get_user_pages_unlocked LINUX_BACKPORT(get_user_pages_unlocked) +-#endif +- +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)) +-static inline +-long backport_get_user_pages(unsigned long start, unsigned long nr_pages, +- int write, int force, struct page **pages, +- struct vm_area_struct **vmas) +-{ +- return get_user_pages(current, current->mm, start, nr_pages, +- write, force, pages, vmas); +-} +-#define get_user_pages LINUX_BACKPORT(get_user_pages) +-#endif +- + #ifndef FOLL_TRIED + #define FOLL_TRIED 0x800 /* a retry, previous pass started an IO */ + #endif diff --git a/target/linux/generic/patches-4.4/030-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch deleted file mode 100644 index a75ddfc4d9..0000000000 --- a/target/linux/generic/patches-4.4/030-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch +++ /dev/null @@ -1,40 +0,0 @@ -From e9156cd26a495a18706e796f02a81fee41ec14f4 Mon Sep 17 00:00:00 2001 -From: James Hughes -Date: Wed, 19 Apr 2017 11:13:40 +0100 -Subject: [PATCH] smsc95xx: Use skb_cow_head to deal with cloned skbs - -The driver was failing to check that the SKB wasn't cloned -before adding checksum data. -Replace existing handling to extend/copy the header buffer -with skb_cow_head. - -Signed-off-by: James Hughes -Acked-by: Eric Dumazet -Acked-by: Woojung Huh -Signed-off-by: David S. Miller ---- - drivers/net/usb/smsc95xx.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -1838,13 +1838,13 @@ static struct sk_buff *smsc95xx_tx_fixup - /* We do not advertise SG, so skbs should be already linearized */ - BUG_ON(skb_shinfo(skb)->nr_frags); - -- if (skb_headroom(skb) < overhead) { -- struct sk_buff *skb2 = skb_copy_expand(skb, -- overhead, 0, flags); -+ /* Make writable and expand header space by overhead if required */ -+ if (skb_cow_head(skb, overhead)) { -+ /* Must deallocate here as returning NULL to indicate error -+ * means the skb won't be deallocated in the caller. -+ */ - dev_kfree_skb_any(skb); -- skb = skb2; -- if (!skb) -- return NULL; -+ return NULL; - } - - if (csum) { diff --git a/target/linux/generic/patches-4.4/030-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch deleted file mode 100644 index 2e8bba57e0..0000000000 --- a/target/linux/generic/patches-4.4/030-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 6bc6895bdd6744e0136eaa4a11fbdb20a7db4e40 Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Wed, 19 Apr 2017 09:59:25 -0700 -Subject: [PATCH] ch9200: use skb_cow_head() to deal with cloned skbs - -We need to ensure there is enough headroom to push extra header, -but we also need to check if we are allowed to change headers. - -skb_cow_head() is the proper helper to deal with this. - -Fixes: 4a476bd6d1d9 ("usbnet: New driver for QinHeng CH9200 devices") -Signed-off-by: Eric Dumazet -Cc: James Hughes -Cc: Matthew Garrett -Signed-off-by: David S. Miller ---- - drivers/net/usb/ch9200.c | 9 ++------- - 1 file changed, 2 insertions(+), 7 deletions(-) - ---- a/drivers/net/usb/ch9200.c -+++ b/drivers/net/usb/ch9200.c -@@ -255,14 +255,9 @@ static struct sk_buff *ch9200_tx_fixup(s - tx_overhead = 0x40; - - len = skb->len; -- if (skb_headroom(skb) < tx_overhead) { -- struct sk_buff *skb2; -- -- skb2 = skb_copy_expand(skb, tx_overhead, 0, flags); -+ if (skb_cow_head(skb, tx_overhead)) { - dev_kfree_skb_any(skb); -- skb = skb2; -- if (!skb) -- return NULL; -+ return NULL; - } - - __skb_push(skb, tx_overhead); diff --git a/target/linux/generic/patches-4.4/030-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/patches-4.4/030-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch deleted file mode 100644 index 541c694bec..0000000000 --- a/target/linux/generic/patches-4.4/030-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 39fba7835aacda65284a86e611774cbba71dac20 Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Wed, 19 Apr 2017 09:59:26 -0700 -Subject: [PATCH] kaweth: use skb_cow_head() to deal with cloned skbs - -We can use skb_cow_head() to properly deal with clones, -especially the ones coming from TCP stack that allow their head being -modified. This avoids a copy. - -Signed-off-by: Eric Dumazet -Cc: James Hughes -Signed-off-by: David S. Miller ---- - drivers/net/usb/kaweth.c | 18 ++++++------------ - 1 file changed, 6 insertions(+), 12 deletions(-) - ---- a/drivers/net/usb/kaweth.c -+++ b/drivers/net/usb/kaweth.c -@@ -812,18 +812,12 @@ static netdev_tx_t kaweth_start_xmit(str - } - - /* We now decide whether we can put our special header into the sk_buff */ -- if (skb_cloned(skb) || skb_headroom(skb) < 2) { -- /* no such luck - we make our own */ -- struct sk_buff *copied_skb; -- copied_skb = skb_copy_expand(skb, 2, 0, GFP_ATOMIC); -- dev_kfree_skb_irq(skb); -- skb = copied_skb; -- if (!copied_skb) { -- kaweth->stats.tx_errors++; -- netif_start_queue(net); -- spin_unlock_irq(&kaweth->device_lock); -- return NETDEV_TX_OK; -- } -+ if (skb_cow_head(skb, 2)) { -+ kaweth->stats.tx_errors++; -+ netif_start_queue(net); -+ spin_unlock_irq(&kaweth->device_lock); -+ dev_kfree_skb_any(skb); -+ return NETDEV_TX_OK; - } - - private_header = (__le16 *)__skb_push(skb, 2); diff --git a/target/linux/generic/patches-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch b/target/linux/generic/patches-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch deleted file mode 100644 index 3a27feac8f..0000000000 --- a/target/linux/generic/patches-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch +++ /dev/null @@ -1,24 +0,0 @@ -From cd4b1e34655d46950c065d9284b596cd8d7b28cd Mon Sep 17 00:00:00 2001 -From: John Youn -Date: Thu, 3 Nov 2016 17:55:45 -0700 -Subject: [PATCH] usb: dwc2: Remove unnecessary kfree - -This shouldn't be freed by the HCD as it is owned by the core and -allocated with devm_kzalloc. - -Signed-off-by: John Youn -Signed-off-by: Felipe Balbi ---- - drivers/usb/dwc2/hcd.c | 1 - - 1 file changed, 1 deletion(-) - ---- a/drivers/usb/dwc2/hcd.c -+++ b/drivers/usb/dwc2/hcd.c -@@ -3160,7 +3160,6 @@ error3: - error2: - usb_put_hcd(hcd); - error1: -- kfree(hsotg->core_params); - - #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS - kfree(hsotg->last_frame_num_array); diff --git a/target/linux/generic/patches-4.4/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch b/target/linux/generic/patches-4.4/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch index 9065369040..c44a46730a 100644 --- a/target/linux/generic/patches-4.4/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch +++ b/target/linux/generic/patches-4.4/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch @@ -1,21 +1,7 @@ -From fcbb6fed85ea9ff4feb4f1ebd4f0f235fdaf06b6 Mon Sep 17 00:00:00 2001 -From: David Heidelberger -Date: Mon, 29 Jun 2015 16:53:03 +0200 -Subject: [PATCH 3/3] uapi/if_ether.h: prevent redefinition of struct ethhdr - -Musl provides its own ethhdr struct definition. Add a guard to prevent -its definition of the appropriate musl header has already been included. - -Signed-off-by: John Spencer -Tested-by: David Heidelberger -Signed-off-by: Jonas Gorski ---- - include/uapi/linux/if_ether.h | 3 +++ - include/uapi/linux/libc-compat.h | 11 +++++++++++ - 2 files changed, 14 insertions(+) - ---- a/include/uapi/linux/if_ether.h -+++ b/include/uapi/linux/if_ether.h +Index: linux-4.4.178/include/uapi/linux/if_ether.h +=================================================================== +--- linux-4.4.178.orig/include/uapi/linux/if_ether.h ++++ linux-4.4.178/include/uapi/linux/if_ether.h @@ -22,6 +22,7 @@ #define _UAPI_LINUX_IF_ETHER_H @@ -24,44 +10,28 @@ Signed-off-by: Jonas Gorski /* * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble -@@ -135,11 +136,13 @@ - * This is an Ethernet frame header. +@@ -137,7 +138,10 @@ */ -+#if __UAPI_DEF_ETHHDR - struct ethhdr { - unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ - unsigned char h_source[ETH_ALEN]; /* source ether addr */ - __be16 h_proto; /* packet type ID field */ - } __attribute__((packed)); -+#endif - - - #endif /* _UAPI_LINUX_IF_ETHER_H */ ---- a/include/uapi/linux/libc-compat.h -+++ b/include/uapi/linux/libc-compat.h -@@ -85,6 +85,14 @@ - - #endif /* _NET_IF_H */ - -+/* musl defines the ethhdr struct itself in its netinet/if_ether.h. -+ * Glibc just includes the kernel header and uses a different guard. */ + /* allow libcs like musl to deactivate this, glibc does not implement this. */ +-#ifndef __UAPI_DEF_ETHHDR ++ +#if defined(_NETINET_IF_ETHER_H) +#define __UAPI_DEF_ETHHDR 0 +#else -+#define __UAPI_DEF_ETHHDR 1 -+#endif -+ - /* Coordinate with libc netinet/in.h header. */ - #if defined(_NETINET_IN_H) - -@@ -161,6 +169,9 @@ + #define __UAPI_DEF_ETHHDR 1 + #endif + +Index: linux-4.4.178/include/uapi/linux/libc-compat.h +=================================================================== +--- linux-4.4.178.orig/include/uapi/linux/libc-compat.h ++++ linux-4.4.178/include/uapi/linux/libc-compat.h +@@ -160,6 +160,8 @@ + #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1 /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 - +/* Definitions for if_ether.h */ -+#define __UAPI_DEF_ETHHDR 1 -+ ++#define __UAPI_DEF_ETHHDR 1 + /* Definitions for in.h */ #define __UAPI_DEF_IN_ADDR 1 - #define __UAPI_DEF_IN_IPPROTO 1 diff --git a/target/linux/generic/patches-4.4/902-debloat_proc.patch b/target/linux/generic/patches-4.4/902-debloat_proc.patch deleted file mode 100644 index d367577cbf..0000000000 --- a/target/linux/generic/patches-4.4/902-debloat_proc.patch +++ /dev/null @@ -1,385 +0,0 @@ ---- a/fs/locks.c -+++ b/fs/locks.c -@@ -2716,6 +2716,8 @@ static const struct file_operations proc - - static int __init proc_locks_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - proc_create("locks", 0, NULL, &proc_locks_operations); - return 0; - } ---- a/fs/proc/Kconfig -+++ b/fs/proc/Kconfig -@@ -81,3 +81,8 @@ config PROC_CHILDREN - - Say Y if you are running any user-space software which takes benefit from - this interface. For example, rkt is such a piece of software. -+ -+config PROC_STRIPPED -+ default n -+ depends on EXPERT -+ bool "Strip non-essential /proc functionality to reduce code size" ---- a/fs/proc/consoles.c -+++ b/fs/proc/consoles.c -@@ -106,6 +106,9 @@ static const struct file_operations proc - - static int __init proc_consoles_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - proc_create("consoles", 0, NULL, &proc_consoles_operations); - return 0; - } ---- a/fs/proc/proc_tty.c -+++ b/fs/proc/proc_tty.c -@@ -144,7 +144,10 @@ static const struct file_operations proc - void proc_tty_register_driver(struct tty_driver *driver) - { - struct proc_dir_entry *ent; -- -+ -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (!driver->driver_name || driver->proc_entry || - !driver->ops->proc_fops) - return; -@@ -161,6 +164,9 @@ void proc_tty_unregister_driver(struct t - { - struct proc_dir_entry *ent; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - ent = driver->proc_entry; - if (!ent) - return; -@@ -175,6 +181,9 @@ void proc_tty_unregister_driver(struct t - */ - void __init proc_tty_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (!proc_mkdir("tty", NULL)) - return; - proc_mkdir("tty/ldisc", NULL); /* Preserved: it's userspace visible */ ---- a/kernel/exec_domain.c -+++ b/kernel/exec_domain.c -@@ -41,6 +41,8 @@ static const struct file_operations exec - - static int __init proc_execdomains_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - proc_create("execdomains", 0, NULL, &execdomains_proc_fops); - return 0; - } ---- a/kernel/irq/proc.c -+++ b/kernel/irq/proc.c -@@ -327,6 +327,9 @@ void register_irq_proc(unsigned int irq, - static DEFINE_MUTEX(register_lock); - char name [MAX_NAMELEN]; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip)) - return; - -@@ -376,6 +379,9 @@ void unregister_irq_proc(unsigned int ir - { - char name [MAX_NAMELEN]; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - if (!root_irq_dir || !desc->dir) - return; - #ifdef CONFIG_SMP -@@ -411,6 +417,9 @@ void init_irq_proc(void) - unsigned int irq; - struct irq_desc *desc; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - /* create /proc/irq */ - root_irq_dir = proc_mkdir("irq", NULL); - if (!root_irq_dir) ---- a/kernel/time/timer_list.c -+++ b/kernel/time/timer_list.c -@@ -399,6 +399,8 @@ static int __init init_timer_list_procfs - { - struct proc_dir_entry *pe; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - pe = proc_create("timer_list", 0444, NULL, &timer_list_fops); - if (!pe) - return -ENOMEM; ---- a/mm/vmalloc.c -+++ b/mm/vmalloc.c -@@ -2685,6 +2685,8 @@ static const struct file_operations proc - - static int __init proc_vmalloc_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); - return 0; - } ---- a/mm/vmstat.c -+++ b/mm/vmstat.c -@@ -1560,10 +1560,12 @@ static int __init setup_vmstat(void) - cpu_notifier_register_done(); - #endif - #ifdef CONFIG_PROC_FS -- proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); -- proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); -+ proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); -+ proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); -+ } - proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); -- proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); - #endif - return 0; - } ---- a/net/8021q/vlanproc.c -+++ b/net/8021q/vlanproc.c -@@ -127,6 +127,9 @@ void vlan_proc_cleanup(struct net *net) - { - struct vlan_net *vn = net_generic(net, vlan_net_id); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (vn->proc_vlan_conf) - remove_proc_entry(name_conf, vn->proc_vlan_dir); - -@@ -146,6 +149,9 @@ int __net_init vlan_proc_init(struct net - { - struct vlan_net *vn = net_generic(net, vlan_net_id); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - vn->proc_vlan_dir = proc_net_mkdir(net, name_root, net->proc_net); - if (!vn->proc_vlan_dir) - goto err; ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -3044,6 +3044,8 @@ static __net_initdata struct pernet_oper - - static int __init proto_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - return register_pernet_subsys(&proto_net_ops); - } - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -2641,10 +2641,12 @@ static const struct file_operations fib_ - - int __net_init fib_proc_init(struct net *net) - { -- if (!proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops)) -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops)) - goto out1; - -- if (!proc_create("fib_triestat", S_IRUGO, net->proc_net, -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("fib_triestat", S_IRUGO, net->proc_net, - &fib_triestat_fops)) - goto out2; - -@@ -2654,17 +2656,21 @@ int __net_init fib_proc_init(struct net - return 0; - - out3: -- remove_proc_entry("fib_triestat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("fib_triestat", net->proc_net); - out2: -- remove_proc_entry("fib_trie", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("fib_trie", net->proc_net); - out1: - return -ENOMEM; - } - - void __net_exit fib_proc_exit(struct net *net) - { -- remove_proc_entry("fib_trie", net->proc_net); -- remove_proc_entry("fib_triestat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ remove_proc_entry("fib_trie", net->proc_net); -+ remove_proc_entry("fib_triestat", net->proc_net); -+ } - remove_proc_entry("route", net->proc_net); - } - ---- a/net/ipv4/proc.c -+++ b/net/ipv4/proc.c -@@ -539,6 +539,9 @@ static __net_initdata struct pernet_oper - - int __init ip_misc_proc_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - return register_pernet_subsys(&ip_proc_ops); - } - ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -423,6 +423,9 @@ static struct pernet_operations ip_rt_pr - - static int __init ip_rt_proc_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - return register_pernet_subsys(&ip_rt_proc_ops); - } - ---- a/ipc/msg.c -+++ b/ipc/msg.c -@@ -1071,6 +1071,9 @@ void __init msg_init(void) - { - msg_init_ns(&init_ipc_ns); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - ipc_init_proc_interface("sysvipc/msg", - " key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n", - IPC_MSG_IDS, sysvipc_msg_proc_show); ---- a/ipc/sem.c -+++ b/ipc/sem.c -@@ -198,6 +198,8 @@ void sem_exit_ns(struct ipc_namespace *n - void __init sem_init(void) - { - sem_init_ns(&init_ipc_ns); -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; - ipc_init_proc_interface("sysvipc/sem", - " key semid perms nsems uid gid cuid cgid otime ctime\n", - IPC_SEM_IDS, sysvipc_sem_proc_show); ---- a/ipc/shm.c -+++ b/ipc/shm.c -@@ -118,6 +118,8 @@ pure_initcall(ipc_ns_init); - - void __init shm_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; - ipc_init_proc_interface("sysvipc/shm", - #if BITS_PER_LONG <= 32 - " key shmid perms size cpid lpid nattch uid gid cuid cgid atime dtime ctime rss swap\n", ---- a/ipc/util.c -+++ b/ipc/util.c -@@ -121,6 +121,9 @@ void __init ipc_init_proc_interface(cons - struct proc_dir_entry *pde; - struct ipc_proc_iface *iface; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - iface = kmalloc(sizeof(*iface), GFP_KERNEL); - if (!iface) - return; ---- a/net/core/net-procfs.c -+++ b/net/core/net-procfs.c -@@ -318,10 +318,12 @@ static int __net_init dev_proc_net_init( - - if (!proc_create("dev", S_IRUGO, net->proc_net, &dev_seq_fops)) - goto out; -- if (!proc_create("softnet_stat", S_IRUGO, net->proc_net, -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("softnet_stat", S_IRUGO, net->proc_net, - &softnet_seq_fops)) - goto out_dev; -- if (!proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops)) -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops)) - goto out_softnet; - - if (wext_proc_init(net)) -@@ -330,9 +332,11 @@ static int __net_init dev_proc_net_init( - out: - return rc; - out_ptype: -- remove_proc_entry("ptype", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("ptype", net->proc_net); - out_softnet: -- remove_proc_entry("softnet_stat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("softnet_stat", net->proc_net); - out_dev: - remove_proc_entry("dev", net->proc_net); - goto out; -@@ -342,8 +346,10 @@ static void __net_exit dev_proc_net_exit - { - wext_proc_exit(net); - -- remove_proc_entry("ptype", net->proc_net); -- remove_proc_entry("softnet_stat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ remove_proc_entry("ptype", net->proc_net); -+ remove_proc_entry("softnet_stat", net->proc_net); -+ } - remove_proc_entry("dev", net->proc_net); - } - ---- a/include/net/snmp.h -+++ b/include/net/snmp.h -@@ -123,6 +123,30 @@ struct linux_xfrm_mib { - #define DECLARE_SNMP_STAT(type, name) \ - extern __typeof__(type) __percpu *name - -+#ifdef CONFIG_PROC_STRIPPED -+#define SNMP_INC_STATS_BH(mib, field) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_INC_STATS_USER(mib, field) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_INC_STATS(mib, field) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_DEC_STATS(mib, field) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_ADD_STATS_BH(mib, field, addend) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_ADD_STATS_USER(mib, field, addend) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_ADD_STATS(mib, field, addend) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ -+ do { (void) mib->mibs[0]; } while(0) -+#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ -+ do { (void) mib->mibs[0]; } while(0) -+ -+#else -+ - #define SNMP_INC_STATS_BH(mib, field) \ - __this_cpu_inc(mib->mibs[field]) - -@@ -159,8 +183,9 @@ struct linux_xfrm_mib { - __this_cpu_add(ptr[basefield##OCTETS], addend); \ - } while (0) - -+#endif - --#if BITS_PER_LONG==32 -+#if (BITS_PER_LONG==32) && !defined(CONFIG_PROC_STRIPPED) - - #define SNMP_ADD_STATS64_BH(mib, field, addend) \ - do { \ -- 2.25.1