aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/hack-4.19/902-debloat_proc.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2018-11-01 18:01:44 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2018-12-15 14:28:48 +0100
commit9261e7447ea7b8d33b70ff6ea008f2041a88e255 (patch)
treec9af04326ac9953a33fc8fd3e852c11fc1eb4df3 /target/linux/generic/hack-4.19/902-debloat_proc.patch
parent52a82ce3dd901a1536c7d7d9d963e9c2d761c816 (diff)
downloadupstream-9261e7447ea7b8d33b70ff6ea008f2041a88e255.tar.gz
upstream-9261e7447ea7b8d33b70ff6ea008f2041a88e255.tar.bz2
upstream-9261e7447ea7b8d33b70ff6ea008f2041a88e255.zip
kernel: Make the patches apply on top of 4.19
This makes the patches which were just copied in the previous commit apply on top of kernel 4.19. The patches in the backports-4.19 folder were checked if they are really in kernel 4.19 based on the title and only removed if they were found in the upstream kernel. The following additional patches form the pending folder went into upstream Linux 4.19: pending-4.19/171-usb-dwc2-Fix-inefficient-copy-of-unaligned-buffers.patch pending-4.19/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch pending-4.19/478-mtd-spi-nor-Add-support-for-XM25QH64A-and-XM25QH128A.patch pending-4.19/479-mtd-spi-nor-add-eon-en25qh32.patch pending-4.19/950-tty-serial-exar-generalize-rs485-setup.patch pending-4.19/340-MIPS-mm-remove-mips_dma_mapping_error.patch Bigger changes were introduced to the m25p80 spi nor driver, as far as I saw it in the new code, it now has the functionality provided in this patch: pending-4.19/450-mtd-m25p80-allow-fallback-from-spi_flash_read-to-reg.patch Part of this patch went upstream independent of OpenWrt: hack-4.19/220-gc_sections.patch This patch was reworked to match the changes done upstream. The MIPS DMA API changed a lot, this patch was rewritten to match the new DMA handling: pending-4.19/341-MIPS-mm-remove-no-op-dma_map_ops-where-possible.patch I did bigger manual changes to the following patches and I am not 100% sure if they are all correct: pending-4.19/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch pending-4.19/411-mtd-partial_eraseblock_write.patch pending-4.19/600-netfilter_conntrack_flush.patch pending-4.19/611-netfilter_match_bypass_default_table.patch pending-4.19/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch hack-4.19/211-host_tools_portability.patch hack-4.19/221-module_exports.patch hack-4.19/321-powerpc_crtsavres_prereq.patch hack-4.19/902-debloat_proc.patch This is based on patchset from Marko Ratkaj <marko.ratkaj@sartura.hr> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'target/linux/generic/hack-4.19/902-debloat_proc.patch')
-rw-r--r--target/linux/generic/hack-4.19/902-debloat_proc.patch126
1 files changed, 63 insertions, 63 deletions
diff --git a/target/linux/generic/hack-4.19/902-debloat_proc.patch b/target/linux/generic/hack-4.19/902-debloat_proc.patch
index cae6d66e7d..6f4d264f35 100644
--- a/target/linux/generic/hack-4.19/902-debloat_proc.patch
+++ b/target/linux/generic/hack-4.19/902-debloat_proc.patch
@@ -29,18 +29,18 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/fs/locks.c
+++ b/fs/locks.c
-@@ -2812,6 +2812,8 @@ static const struct file_operations proc
+@@ -2786,6 +2786,8 @@ static const struct seq_operations locks
static int __init proc_locks_init(void)
{
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
+ return 0;
- proc_create("locks", 0, NULL, &proc_locks_operations);
+ proc_create_seq_private("locks", 0, NULL, &locks_seq_operations,
+ sizeof(struct locks_iterator), NULL);
return 0;
- }
--- a/fs/proc/Kconfig
+++ b/fs/proc/Kconfig
-@@ -81,3 +81,8 @@ config PROC_CHILDREN
+@@ -97,3 +97,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.
@@ -51,19 +51,19 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+ 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
+@@ -93,6 +93,9 @@ static const struct seq_operations conso
static int __init proc_consoles_init(void)
{
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
+ return 0;
+
- proc_create("consoles", 0, NULL, &proc_consoles_operations);
+ proc_create_seq("consoles", 0, NULL, &consoles_op);
return 0;
}
--- a/fs/proc/proc_tty.c
+++ b/fs/proc/proc_tty.c
-@@ -145,7 +145,10 @@ static const struct file_operations proc
+@@ -133,7 +133,10 @@ static const struct seq_operations tty_d
void proc_tty_register_driver(struct tty_driver *driver)
{
struct proc_dir_entry *ent;
@@ -73,9 +73,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+ return;
+
if (!driver->driver_name || driver->proc_entry ||
- !driver->ops->proc_fops)
+ !driver->ops->proc_show)
return;
-@@ -162,6 +165,9 @@ void proc_tty_unregister_driver(struct t
+@@ -150,6 +153,9 @@ void proc_tty_unregister_driver(struct t
{
struct proc_dir_entry *ent;
@@ -85,7 +85,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
ent = driver->proc_entry;
if (!ent)
return;
-@@ -176,6 +182,9 @@ void proc_tty_unregister_driver(struct t
+@@ -164,6 +170,9 @@ void proc_tty_unregister_driver(struct t
*/
void __init proc_tty_init(void)
{
@@ -132,30 +132,30 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
do { \
--- a/ipc/msg.c
+++ b/ipc/msg.c
-@@ -1208,6 +1208,9 @@ int __init msg_init(void)
+@@ -1291,6 +1291,9 @@ void __init msg_init(void)
{
- const int err = msg_init_ns(&init_ipc_ns);
+ msg_init_ns(&init_ipc_ns);
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
-+ return err;
++ 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
-@@ -207,6 +207,8 @@ int __init sem_init(void)
+@@ -243,6 +243,8 @@ void sem_exit_ns(struct ipc_namespace *n
+ void __init sem_init(void)
{
- const int err = sem_init_ns(&init_ipc_ns);
-
+ sem_init_ns(&init_ipc_ns);
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
-+ return err;
++ 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
-@@ -122,6 +122,8 @@ pure_initcall(ipc_ns_init);
+@@ -144,6 +144,8 @@ pure_initcall(ipc_ns_init);
void __init shm_init(void)
{
@@ -166,7 +166,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
" 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
-@@ -141,6 +141,9 @@ void __init ipc_init_proc_interface(cons
+@@ -140,6 +140,9 @@ void __init ipc_init_proc_interface(cons
struct proc_dir_entry *pde;
struct ipc_proc_iface *iface;
@@ -178,18 +178,18 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
return;
--- a/kernel/exec_domain.c
+++ b/kernel/exec_domain.c
-@@ -42,6 +42,8 @@ static const struct file_operations exec
+@@ -29,6 +29,8 @@ static int execdomains_proc_show(struct
static int __init proc_execdomains_init(void)
{
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
+ return 0;
- proc_create("execdomains", 0, NULL, &execdomains_proc_fops);
+ proc_create_single("execdomains", 0, NULL, execdomains_proc_show);
return 0;
}
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
-@@ -396,6 +396,9 @@ void register_irq_proc(unsigned int irq,
+@@ -333,6 +333,9 @@ void register_irq_proc(unsigned int irq,
void __maybe_unused *irqp = (void *)(unsigned long) irq;
char name [MAX_NAMELEN];
@@ -199,7 +199,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip))
return;
-@@ -449,6 +452,9 @@ void unregister_irq_proc(unsigned int ir
+@@ -386,6 +389,9 @@ void unregister_irq_proc(unsigned int ir
{
char name [MAX_NAMELEN];
@@ -209,7 +209,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (!root_irq_dir || !desc->dir)
return;
#ifdef CONFIG_SMP
-@@ -487,6 +493,9 @@ void init_irq_proc(void)
+@@ -424,6 +430,9 @@ void init_irq_proc(void)
unsigned int irq;
struct irq_desc *desc;
@@ -221,47 +221,47 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (!root_irq_dir)
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
-@@ -389,6 +389,8 @@ static int __init init_timer_list_procfs
+@@ -374,6 +374,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);
+ pe = proc_create_seq_private("timer_list", 0400, NULL, &timer_list_sops,
+ sizeof(struct timer_list_iter), NULL);
if (!pe)
- return -ENOMEM;
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
-@@ -2770,6 +2770,8 @@ static const struct file_operations proc
+@@ -2736,6 +2736,8 @@ static const struct seq_operations vmall
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;
- }
+ if (IS_ENABLED(CONFIG_NUMA))
+ proc_create_seq_private("vmallocinfo", 0400, NULL,
+ &vmalloc_op,
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
-@@ -1955,10 +1955,12 @@ void __init init_mm_internals(void)
+@@ -1972,10 +1972,12 @@ void __init init_mm_internals(void)
start_shepherd_timer();
#endif
#ifdef CONFIG_PROC_FS
-- proc_create("buddyinfo", 0444, NULL, &buddyinfo_file_operations);
-- proc_create("pagetypeinfo", 0444, NULL, &pagetypeinfo_file_operations);
+- proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op);
+- proc_create_seq("pagetypeinfo", 0444, NULL, &pagetypeinfo_op);
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) {
-+ proc_create("buddyinfo", 0444, NULL, &buddyinfo_file_operations);
-+ proc_create("pagetypeinfo", 0444, NULL, &pagetypeinfo_file_operations);
-+ proc_create("zoneinfo", 0444, NULL, &zoneinfo_file_operations);
++ proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op);
++ proc_create_seq("pagetypeinfo", 0444, NULL, &pagetypeinfo_op);
++ proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op);
+ }
- proc_create("vmstat", 0444, NULL, &vmstat_file_operations);
-- proc_create("zoneinfo", 0444, NULL, &zoneinfo_file_operations);
+ proc_create_seq("vmstat", 0444, NULL, &vmstat_op);
+- proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op);
#endif
}
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
-@@ -127,6 +127,9 @@ void vlan_proc_cleanup(struct net *net)
+@@ -96,6 +96,9 @@ void vlan_proc_cleanup(struct net *net)
{
struct vlan_net *vn = net_generic(net, vlan_net_id);
@@ -271,7 +271,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
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
+@@ -115,6 +118,9 @@ int __net_init vlan_proc_init(struct net
{
struct vlan_net *vn = net_generic(net, vlan_net_id);
@@ -283,22 +283,22 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
goto err;
--- a/net/core/net-procfs.c
+++ b/net/core/net-procfs.c
-@@ -320,10 +320,12 @@ static int __net_init dev_proc_net_init(
-
- if (!proc_create("dev", S_IRUGO, net->proc_net, &dev_seq_fops))
+@@ -279,10 +279,12 @@ static int __net_init dev_proc_net_init(
+ if (!proc_create_net("dev", 0444, net->proc_net, &dev_seq_ops,
+ sizeof(struct seq_net_private)))
goto out;
-- if (!proc_create("softnet_stat", S_IRUGO, net->proc_net,
+- if (!proc_create_seq("softnet_stat", 0444, net->proc_net,
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) &&
-+ !proc_create("softnet_stat", S_IRUGO, net->proc_net,
- &softnet_seq_fops))
++ !proc_create_seq("softnet_stat", 0444, net->proc_net,
+ &softnet_seq_ops))
goto out_dev;
-- if (!proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops))
+- if (!proc_create_net("ptype", 0444, net->proc_net, &ptype_seq_ops,
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) &&
-+ !proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops))
++ !proc_create_net("ptype", 0444, net->proc_net, &ptype_seq_ops,
+ sizeof(struct seq_net_private)))
goto out_softnet;
- if (wext_proc_init(net))
-@@ -332,9 +334,11 @@ static int __net_init dev_proc_net_init(
+@@ -292,9 +294,11 @@ static int __net_init dev_proc_net_init(
out:
return rc;
out_ptype:
@@ -312,7 +312,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
out_dev:
remove_proc_entry("dev", net->proc_net);
goto out;
-@@ -344,8 +348,10 @@ static void __net_exit dev_proc_net_exit
+@@ -304,8 +308,10 @@ static void __net_exit dev_proc_net_exit
{
wext_proc_exit(net);
@@ -327,7 +327,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/core/sock.c
+++ b/net/core/sock.c
-@@ -3378,6 +3378,8 @@ static __net_initdata struct pernet_oper
+@@ -3477,6 +3477,8 @@ static __net_initdata struct pernet_oper
static int __init proto_init(void)
{
@@ -338,22 +338,23 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
-@@ -2731,10 +2731,12 @@ static const struct file_operations fib_
+@@ -2708,11 +2708,13 @@ static const struct seq_operations fib_r
int __net_init fib_proc_init(struct net *net)
{
-- if (!proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops))
+- if (!proc_create_net("fib_trie", 0444, net->proc_net, &fib_trie_seq_ops,
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) &&
-+ !proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops))
++ !proc_create_net("fib_trie", 0444, net->proc_net, &fib_trie_seq_ops,
+ sizeof(struct fib_trie_iter)))
goto out1;
-- if (!proc_create("fib_triestat", S_IRUGO, net->proc_net,
+- if (!proc_create_net_single("fib_triestat", 0444, net->proc_net,
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) &&
-+ !proc_create("fib_triestat", S_IRUGO, net->proc_net,
- &fib_triestat_fops))
++ !proc_create_net_single("fib_triestat", 0444, net->proc_net,
+ fib_triestat_seq_show, NULL))
goto out2;
-@@ -2744,17 +2746,21 @@ int __net_init fib_proc_init(struct net
+@@ -2723,17 +2725,21 @@ int __net_init fib_proc_init(struct net
return 0;
out3:
@@ -381,7 +382,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
-@@ -558,6 +558,9 @@ static __net_initdata struct pernet_oper
+@@ -523,5 +523,8 @@ static __net_initdata struct pernet_oper
int __init ip_misc_proc_init(void)
{
@@ -390,10 +391,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+
return register_pernet_subsys(&ip_proc_ops);
}
-
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
-@@ -427,6 +427,9 @@ static struct pernet_operations ip_rt_pr
+@@ -410,6 +410,9 @@ static struct pernet_operations ip_rt_pr
static int __init ip_rt_proc_init(void)
{