android_kernel_xiaomi_sm8350/arch/mips/kernel
Hugh Dickins 2fd4ef85e0 [PATCH] error path in setup_arg_pages() misses vm_unacct_memory()
Pavel Emelianov and Kirill Korotaev observe that fs and arch users of
security_vm_enough_memory tend to forget to vm_unacct_memory when a
failure occurs further down (typically in setup_arg_pages variants).

These are all users of insert_vm_struct, and that reservation will only
be unaccounted on exit if the vma is marked VM_ACCOUNT: which in some
cases it is (hidden inside VM_STACK_FLAGS) and in some cases it isn't.

So x86_64 32-bit and ppc64 vDSO ELFs have been leaking memory into
Committed_AS each time they're run.  But don't add VM_ACCOUNT to them,
it's inappropriate to reserve against the very unlikely case that gdb
be used to COW a vDSO page - we ought to do something about that in
do_wp_page, but there are yet other inconsistencies to be resolved.

The safe and economical way to fix this is to let insert_vm_struct do
the security_vm_enough_memory check when it finds VM_ACCOUNT is set.

And the MIPS irix_brk has been calling security_vm_enough_memory before
calling do_brk which repeats it, doubly accounting and so also leaking.
Remove that, and all the fs and arch calls to security_vm_enough_memory:
give it a less misleading name later on.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-Off-By: Kirill Korotaev <dev@sw.ru>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-14 11:18:13 -07:00
..
asm-offsets.c mips: rename offsets.c to asm-offsets.c 2005-09-11 22:35:18 +02:00
binfmt_elfn32.c [PATCH] mips: nuke trailing whitespace 2005-09-05 00:06:07 -07:00
binfmt_elfo32.c [PATCH] mips: nuke trailing whitespace 2005-09-05 00:06:07 -07:00
branch.c
cpu-bugs64.c [PATCH] mips: nuke trailing whitespace 2005-09-05 00:06:07 -07:00
cpu-probe.c [PATCH] more vr4181 removal 2005-09-05 00:06:03 -07:00
entry.S
gdb-low.S [PATCH] mips: clean up 32/64-bit configuration 2005-09-05 00:06:06 -07:00
gdb-stub.c [PATCH] mips: nuke trailing whitespace 2005-09-05 00:06:07 -07:00
genex.S [PATCH] mips: fix build warnings 2005-09-05 00:06:08 -07:00
genrtc.c [PATCH] more SPIN_LOCK_UNLOCKED -> DEFINE_SPINLOCK conversions 2005-09-09 14:03:48 -07:00
head.S [PATCH] mips: clean up 32/64-bit configuration 2005-09-05 00:06:06 -07:00
i8259.c [PATCH] more SPIN_LOCK_UNLOCKED -> DEFINE_SPINLOCK conversions 2005-09-09 14:03:48 -07:00
init_task.c
ioctl32.c [PATCH] mips: nuke trailing whitespace 2005-09-05 00:06:07 -07:00
irix5sys.S
irixelf.c
irixinv.c
irixioctl.c [PATCH] files: lock-free fd look-up 2005-09-09 13:57:55 -07:00
irixsig.c [PATCH] mips: fix-up schedule_timeout() usage 2005-09-10 10:06:37 -07:00
irq_cpu.c
irq-msc01.c
irq-mv6434x.c
irq-rm7000.c
irq-rm9000.c
irq.c [PATCH] mips: nuke trailing whitespace 2005-09-05 00:06:07 -07:00
linux32.c [PATCH] compat: be more consistent about [ug]id_t 2005-09-07 16:57:19 -07:00
Makefile [PATCH] mips: clean up 32/64-bit configuration 2005-09-05 00:06:06 -07:00
mips_ksyms.c [PATCH] mips: clean up 32/64-bit configuration 2005-09-05 00:06:06 -07:00
module-elf32.c
module-elf64.c
module.c
proc.c
process.c [PATCH] mips: clean up 32/64-bit configuration 2005-09-05 00:06:06 -07:00
ptrace32.c
ptrace.c [PATCH] mips: clean up 32/64-bit configuration 2005-09-05 00:06:06 -07:00
r4k_fpu.S kbuild: mips use generic asm-offsets.h support 2005-09-09 22:32:31 +02:00
r4k_switch.S kbuild: mips use generic asm-offsets.h support 2005-09-09 22:32:31 +02:00
r2300_fpu.S kbuild: mips use generic asm-offsets.h support 2005-09-09 22:32:31 +02:00
r2300_switch.S kbuild: mips use generic asm-offsets.h support 2005-09-09 22:32:31 +02:00
r6000_fpu.S kbuild: mips use generic asm-offsets.h support 2005-09-09 22:32:31 +02:00
reset.c
scall32-o32.S kbuild: mips use generic asm-offsets.h support 2005-09-09 22:32:31 +02:00
scall64-64.S kbuild: mips use generic asm-offsets.h support 2005-09-09 22:32:31 +02:00
scall64-n32.S
scall64-o32.S
semaphore.c
setup.c [PATCH] mips: clean up 32/64-bit configuration 2005-09-05 00:06:06 -07:00
signal32.c [PATCH] mips: nuke trailing whitespace 2005-09-05 00:06:07 -07:00
signal_n32.c
signal-common.h
signal.c [PATCH] convert signal handling of NODEFER to act like other Unix boxes. 2005-08-29 10:03:11 -07:00
smp.c
syscall.c kbuild: mips use generic asm-offsets.h support 2005-09-09 22:32:31 +02:00
sysirix.c [PATCH] error path in setup_arg_pages() misses vm_unacct_memory() 2005-09-14 11:18:13 -07:00
time.c [PATCH] NTP: ntp-helper functions 2005-09-07 16:57:34 -07:00
traps.c [PATCH] mips: clean up 32/64-bit configuration 2005-09-05 00:06:06 -07:00
unaligned.c [PATCH] mips: clean up 32/64-bit configuration 2005-09-05 00:06:06 -07:00
vmlinux.lds.S [PATCH] mips: nuke trailing whitespace 2005-09-05 00:06:07 -07:00