export-symbols-needed-by-android-drivers.patch 4.61 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
From: Ben Hutchings <ben@decadent.org.uk>
Date: Tue, 26 Jun 2018 16:59:01 +0100
Subject: Export symbols needed by Android drivers
Bug-Debian: https://bugs.debian.org/901492

We want to enable use of the Android ashmem and binder drivers to
support Anbox, but they should not be built-in as that would waste
resources and increase security attack surface on systems that don't
need them.

Export the currently un-exported symbols they depend on.

---
Romain Perier's avatar
Romain Perier committed
14 15 16 17 18 19 20 21 22 23 24
 fs/file.c           | 5 +++++
 kernel/fork.c       | 1 +
 kernel/sched/core.c | 1 +
 kernel/signal.c     | 1 +
 kernel/task_work.c  | 1 +
 mm/memory.c         | 1 +
 mm/shmem.c          | 1 +
 mm/vmalloc.c        | 2 ++
 security/security.c | 4 ++++
 9 files changed, 17 insertions(+)

25 26
--- a/fs/file.c
+++ b/fs/file.c
Ben Hutchings's avatar
Ben Hutchings committed
27
@@ -409,6 +409,7 @@ struct files_struct *get_files_struct(st
28 29 30 31 32 33 34
 
 	return files;
 }
+EXPORT_SYMBOL_GPL(get_files_struct);
 
 void put_files_struct(struct files_struct *files)
 {
Ben Hutchings's avatar
Ben Hutchings committed
35
@@ -421,6 +422,7 @@ void put_files_struct(struct files_struc
36 37 38 39 40 41 42
 		kmem_cache_free(files_cachep, files);
 	}
 }
+EXPORT_SYMBOL_GPL(put_files_struct);
 
 void reset_files_struct(struct files_struct *files)
 {
Ben Hutchings's avatar
Ben Hutchings committed
43
@@ -533,6 +535,7 @@ out:
44 45 46 47 48 49 50
 	spin_unlock(&files->file_lock);
 	return error;
 }
+EXPORT_SYMBOL_GPL(__alloc_fd);
 
 static int alloc_fd(unsigned start, unsigned flags)
 {
Ben Hutchings's avatar
Ben Hutchings committed
51
@@ -606,6 +609,7 @@ void __fd_install(struct files_struct *f
52 53 54 55 56 57 58
 	rcu_assign_pointer(fdt->fd[fd], file);
 	rcu_read_unlock_sched();
 }
+EXPORT_SYMBOL_GPL(__fd_install);
 
 void fd_install(unsigned int fd, struct file *file)
 {
Ben Hutchings's avatar
Ben Hutchings committed
59
@@ -668,6 +672,7 @@ out_unlock:
Romain Perier's avatar
Romain Perier committed
60 61 62 63 64 65 66
 	*res = NULL;
 	return -ENOENT;
 }
+EXPORT_SYMBOL(__close_fd_get_file);
 
 void do_close_on_exec(struct files_struct *files)
 {
67 68
--- a/kernel/fork.c
+++ b/kernel/fork.c
Ben Hutchings's avatar
Ben Hutchings committed
69
@@ -1085,6 +1085,7 @@ void mmput_async(struct mm_struct *mm)
70 71 72 73 74 75 76
 		schedule_work(&mm->async_put_work);
 	}
 }
+EXPORT_SYMBOL_GPL(mmput_async);
 #endif
 
 /**
Romain Perier's avatar
Romain Perier committed
77 78
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
Ben Hutchings's avatar
Ben Hutchings committed
79
@@ -3943,6 +3943,7 @@ int can_nice(const struct task_struct *p
Romain Perier's avatar
Romain Perier committed
80 81 82 83 84 85 86
 	return (nice_rlim <= task_rlimit(p, RLIMIT_NICE) ||
 		capable(CAP_SYS_NICE));
 }
+EXPORT_SYMBOL_GPL(can_nice);
 
 #ifdef __ARCH_WANT_SYS_NICE
 
87 88
--- a/kernel/signal.c
+++ b/kernel/signal.c
Ben Hutchings's avatar
Ben Hutchings committed
89
@@ -1353,6 +1353,7 @@ struct sighand_struct *__lock_task_sigha
90 91 92 93 94 95 96
 
 	return sighand;
 }
+EXPORT_SYMBOL_GPL(__lock_task_sighand);
 
 /*
  * send signal info to all the members of a group
Romain Perier's avatar
Romain Perier committed
97 98
--- a/kernel/task_work.c
+++ b/kernel/task_work.c
Ben Hutchings's avatar
Ben Hutchings committed
99
@@ -40,6 +40,7 @@ task_work_add(struct task_struct *task,
Romain Perier's avatar
Romain Perier committed
100 101 102 103 104 105 106
 		set_notify_resume(task);
 	return 0;
 }
+EXPORT_SYMBOL(task_work_add);
 
 /**
  * task_work_cancel - cancel a pending work added by task_work_add()
107 108
--- a/mm/memory.c
+++ b/mm/memory.c
Ben Hutchings's avatar
Ben Hutchings committed
109 110 111
@@ -1364,6 +1364,7 @@ void zap_page_range(struct vm_area_struc
 	mmu_notifier_invalidate_range_end(&range);
 	tlb_finish_mmu(&tlb, start, range.end);
112 113 114 115 116 117 118
 }
+EXPORT_SYMBOL_GPL(zap_page_range);
 
 /**
  * zap_page_range_single - remove user pages in a given range
--- a/mm/shmem.c
+++ b/mm/shmem.c
Ben Hutchings's avatar
Ben Hutchings committed
119
@@ -3992,6 +3992,7 @@ int shmem_zero_setup(struct vm_area_stru
120 121 122 123 124 125 126 127 128
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(shmem_zero_setup);
 
 /**
  * shmem_read_mapping_page_gfp - read into page cache, using specified page allocation flags.
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
Ben Hutchings's avatar
Ben Hutchings committed
129
@@ -1295,6 +1295,7 @@ int map_kernel_range_noflush(unsigned lo
130 131 132 133 134 135 136
 {
 	return vmap_page_range_noflush(addr, addr + size, prot, pages);
 }
+EXPORT_SYMBOL_GPL(map_kernel_range_noflush);
 
 /**
  * unmap_kernel_range_noflush - unmap kernel VM area
Ben Hutchings's avatar
Ben Hutchings committed
137
@@ -1435,6 +1436,7 @@ struct vm_struct *get_vm_area(unsigned l
138 139 140 141 142 143 144 145 146
 				  NUMA_NO_NODE, GFP_KERNEL,
 				  __builtin_return_address(0));
 }
+EXPORT_SYMBOL_GPL(get_vm_area);
 
 struct vm_struct *get_vm_area_caller(unsigned long size, unsigned long flags,
 				const void *caller)
--- a/security/security.c
+++ b/security/security.c
Ben Hutchings's avatar
Ben Hutchings committed
147
@@ -247,24 +247,28 @@ int security_binder_set_context_mgr(stru
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
 {
 	return call_int_hook(binder_set_context_mgr, 0, mgr);
 }
+EXPORT_SYMBOL_GPL(security_binder_set_context_mgr);
 
 int security_binder_transaction(struct task_struct *from,
 				struct task_struct *to)
 {
 	return call_int_hook(binder_transaction, 0, from, to);
 }
+EXPORT_SYMBOL_GPL(security_binder_transaction);
 
 int security_binder_transfer_binder(struct task_struct *from,
 				    struct task_struct *to)
 {
 	return call_int_hook(binder_transfer_binder, 0, from, to);
 }
+EXPORT_SYMBOL_GPL(security_binder_transfer_binder);
 
 int security_binder_transfer_file(struct task_struct *from,
 				  struct task_struct *to, struct file *file)
 {
 	return call_int_hook(binder_transfer_file, 0, from, to, file);
 }
+EXPORT_SYMBOL_GPL(security_binder_transfer_file);
 
 int security_ptrace_access_check(struct task_struct *child, unsigned int mode)
 {