aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
Commit message (Collapse)AuthorAgeFilesLines
* vm: add VM_FAULT_SIGSEGV handling supportLinus Torvalds2015-02-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 33692f27597fcab536d7cbbcc8f52905133e4aa7 upstream. The core VM already knows about VM_FAULT_SIGBUS, but cannot return a "you should SIGSEGV" error, because the SIGSEGV case was generally handled by the caller - usually the architecture fault handler. That results in lots of duplication - all the architecture fault handlers end up doing very similar "look up vma, check permissions, do retries etc" - but it generally works. However, there are cases where the VM actually wants to SIGSEGV, and applications _expect_ SIGSEGV. In particular, when accessing the stack guard page, libsigsegv expects a SIGSEGV. And it usually got one, because the stack growth is handled by that duplicated architecture fault handler. However, when the generic VM layer started propagating the error return from the stack expansion in commit fee7e49d4514 ("mm: propagate error from stack expansion even for guard page"), that now exposed the existing VM_FAULT_SIGBUS result to user space. And user space really expected SIGSEGV, not SIGBUS. To fix that case, we need to add a VM_FAULT_SIGSEGV, and teach all those duplicate architecture fault handlers about it. They all already have the code to handle SIGSEGV, so it's about just tying that new return value to the existing code, but it's all a bit annoying. This is the mindless minimal patch to do this. A more extensive patch would be to try to gather up the mostly shared fault handling logic into one generic helper routine, and long-term we really should do that cleanup. Just from this patch, you can generally see that most architectures just copied (directly or indirectly) the old x86 way of doing things, but in the meantime that original x86 model has been improved to hold the VM semaphore for shorter times etc and to handle VM_FAULT_RETRY and other "newer" things, so it would be a good idea to bring all those improvements to the generic case and teach other architectures about them too. Reported-and-tested-by: Takashi Iwai <tiwai@suse.de> Tested-by: Jan Engelhardt <jengelh@inai.de> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> # "s390 still compiles and boots" Cc: linux-arch@vger.kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> [bwh: Backported to 3.2: - Adjust filenames, context - Drop arc, metag, nios2 and lustre changes - For sh, patch both 32-bit and 64-bit implementations to use goto bad_area - For s390, pass int_code and trans_exc_code as arguments to do_no_context() and do_sigsegv()] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* um: add missing declaration of 'getrlimit()' and friendsSergei Trofimovich2014-01-031-0/+2
| | | | | | | | | | | | | | | | | | commit fdfa4c952844fce881df8c76de9c7180cbe913ab upstream. arch/um/os-Linux/start_up.c: In function 'check_coredump_limit': arch/um/os-Linux/start_up.c:338:16: error: storage size of 'lim' isn't known arch/um/os-Linux/start_up.c:339:2: error: implicit declaration of function 'getrlimit' [-Werror=implicit-function-declaration] Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> CC: Jeff Dike <jdike@addtoit.com> CC: Richard Weinberger <richard@nod.at> CC: Al Viro <viro@zeniv.linux.org.uk> CC: user-mode-linux-devel@lists.sourceforge.net CC: user-mode-linux-user@lists.sourceforge.net CC: linux-kernel@vger.kernel.org Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* uml: check length in exitcode_proc_write()Dan Carpenter2013-11-281-1/+3
| | | | | | | | | | | | | commit 201f99f170df14ba52ea4c52847779042b7a623b upstream. We don't cap the size of buffer from the user so we could write past the end of the array here. Only root can write to this file. Reported-by: Nico Golde <nico@ngolde.de> Reported-by: Fabian Yamaguchi <fabs@goesec.de> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* um: Serve io_remap_pfn_range()Richard Weinberger2013-05-301-0/+2
| | | | | | | | | | commit 4d94d6d030adfdea4837694d293ec6918d133ab2 upstream. At some places io_remap_pfn_range() is needed. UML has to serve it like all other archs do. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* um: Fix __swp_type()Richard Weinberger2012-05-311-2/+2
| | | | | | | | | | | | commit 2b76ebaa728f8a3967c52aa189261c72fe56a6f1 upstream. The current __swp_type() function uses a too small bitshift. Using more than one swap files causes bad pages because the type bits clash with other page flags. Analyzed-by: Hugh Dickins <hughd@google.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* um: Implement a custom pte_same() functionRichard Weinberger2012-05-311-0/+6
| | | | | | | | | | | | | | | commit f15b9000eb1d09bbaa4b0a6b2089d7e1f64e84b3 upstream. UML uses the _PAGE_NEWPAGE flag to mark pages which are not jet installed on the host side using mmap(). pte_same() has to ignore this flag, otherwise unuse_pte_range() is unable to unuse the page because two identical page tables entries with different _PAGE_NEWPAGE flags would not match and swapoff() would never return. Analyzed-by: Hugh Dickins <hughd@google.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* Merge branch 'for-linus' of git://github.com/richardweinberger/linuxLinus Torvalds2011-11-02224-8590/+340
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'for-linus' of git://github.com/richardweinberger/linux: (90 commits) um: fix ubd cow size um: Fix kmalloc argument order in um/vdso/vma.c um: switch to use of drivers/Kconfig UserModeLinux-HOWTO.txt: fix a typo UserModeLinux-HOWTO.txt: remove ^H characters um: we need sys/user.h only on i386 um: merge delay_{32,64}.c um: distribute exports to where exported stuff is defined um: kill system-um.h um: generic ftrace.h will do... um: segment.h is x86-only and needed only there um: asm/pda.h is not needed anymore um: hw_irq.h can go generic as well um: switch to generic-y um: clean Kconfig up a bit um: a couple of missing dependencies... um: kill useless argument of free_chan() and free_one_chan() um: unify ptrace_user.h um: unify KSTK_... um: fix gcov build breakage ...
| * um: fix ubd cow sizeRichard Weinberger2011-11-021-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ubd_file_size() cannot use ubd_dev->cow.file because at this time ubd_dev->cow.file is not initialized. Therefore, ubd_file_size() will always report a wrong disk size when COW files are used. Reading from /dev/ubd* would crash the kernel. We have to read the correct disk size from the COW file's backing file. Signed-off-by: Richard Weinberger <richard@nod.at> CC: stable@kernel.org
| * um: switch to use of drivers/KconfigAl Viro2011-11-021-22/+1
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: distribute exports to where exported stuff is definedAl Viro2011-11-0210-54/+40
| | | | | | | | | | | | | | ksyms.c is down to the stuff defined in various USER_OBJS Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: kill system-um.hAl Viro2011-11-022-46/+37
| | | | | | | | | | | | | | most of it belonged in irqflags.h, actually Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: generic ftrace.h will do...Al Viro2011-11-022-1/+1
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: segment.h is x86-only and needed only thereAl Viro2011-11-021-10/+0
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: asm/pda.h is not needed anymoreAl Viro2011-11-021-21/+0
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: hw_irq.h can go generic as wellAl Viro2011-11-022-8/+1
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: switch to generic-yAl Viro2011-11-0213-59/+2
| | | | | | | | | | | | | | kill wrapper headers Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: clean Kconfig up a bitAl Viro2011-11-022-113/+7
| | | | | | | | | | | | | | | | | | | | * kill duplicates with drivers/char/Kconfig * take watchdog one into drivers/watchdog/Kconfig * take mmapper to arch/um/Kconfig.um * rename Kconfig.char menu to "UML Character Devices" Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: kill useless argument of free_chan() and free_one_chan()Al Viro2011-11-021-5/+5
| | | | | | | | | | | | | | delay_free_irq is always 0 for those... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: unify ptrace_user.hAl Viro2011-11-023-8/+7
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: fix gcov build breakageAl Viro2011-11-021-15/+0
| | | | | | | | | | | | | | | | | | a) exports in gmon_syms.c duplicate kernel/gcov/* ones b) excluding -pg in vdso compile is not enough - -fprofile-arcs and -ftest-coverage also needs to be excluded Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: page_offset.h is never usedAl Viro2011-11-021-1/+0
| | | | | | | | | | | | | | ... and neither is the only define in it Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: irq_vectors.h just shadows x86 oneAl Viro2011-11-021-10/+0
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: required-features.h is there only to shadow x86 one...Al Viro2011-11-021-9/+0
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: asm/apic.h is there only to shadow the x86 one...Al Viro2011-11-021-4/+0
| | | | | | | | | | | | | | ... so take it to arch/um/x86/asm. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: take ubd_user.h to its users...Al Viro2011-11-021-0/+0
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: take ldt.h to arch/x86/um/asm/mm_context.hAl Viro2011-11-022-39/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | it's x86-only and we have no business playing with it in asm/mmu.h; make the latter have struct uml_arch_mm_context arch; instead of struct uml_ldt ldt; and let arch/<subarch>/um/asm/mm_context.h decide what'll be in there. While we are at it, kill host_ldt.h - it's not needed in part of places that include it (we want asm/ldt.h in those) and it can be trivially expanded into the single remaining one. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: merge os-Linux/tls.c into arch/x86/um/os-Linux/tls.cAl Viro2011-11-023-42/+2
| | | | | | | | | | | | | | | | | | it's i386-specific; moreover, analogs on other targets have incompatible interface - PTRACE_GET_THREAD_AREA does exist elsewhere, but struct user_desc does *not* Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: move asm/desc.h into arch/x86/um/asmAl Viro2011-11-021-16/+0
| | | | | | | | | | | | | | its only purpose is to shadow the x86 asm/desc.h Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: take um_mmu.h to asm/mmu.h, clean asm/mmu_context.h a bitAl Viro2011-11-023-34/+19
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: kill um_uaccess.hAl Viro2011-11-022-99/+84
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: take mconsole*.h to arch/um/driversAl Viro2011-11-022-0/+0
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: take chan_*.h and line.h to arch/um/driversAl Viro2011-11-028-10/+8
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: take register_winch_irq() into the caller of is_skas_winch()Al Viro2011-11-022-6/+7
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: kill shared/mem_kern.hAl Viro2011-11-022-21/+0
| | | | | | | | | | | | | | ... nothing declared there exists Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: kill shared/tlb.hAl Viro2011-11-023-15/+1
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: make flush_tlb_kernel_range_common() staticAl Viro2011-11-022-3/+1
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: kill shared/task.h and HOST_TASK_REGSAl Viro2011-11-022-10/+0
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: shared/syscall.h is not even includedAl Viro2011-11-021-12/+0
| | | | | | | | | | | | | | ... and functions declared in it do not exist Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: don't include kern.h unless it's neededAl Viro2011-11-022-2/+0
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: trim kern.hAl Viro2011-11-021-18/+0
| | | | | | | | | | | | | | | | most of the functions in there are not used in anything that ends up including that header... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: make load_initrd() static, kill shared/initrd.hAl Viro2011-11-022-14/+2
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: bury unused macros around ptrace.hAl Viro2011-11-021-4/+0
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: take arch/um/sys-x86 to arch/x86/umAl Viro2011-11-0293-6775/+14
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: merge Makefile-{i386,x86_64}Al Viro2011-11-023-28/+35
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: trim detritus from Makefile-i386Al Viro2011-11-021-7/+3
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: arch_hweight.h is needed only on uml-x86Al Viro2011-11-021-0/+0
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: merge kernel_offsets_*.hAl Viro2011-11-023-49/+21
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: merge skas_ptrace.h 32/64bit variantsAl Viro2011-11-023-48/+21
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: sysdep/barrier.h is not used for anythingAl Viro2011-11-024-22/+0
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
| * um: shared/process.h is empty now; kill itAl Viro2011-11-026-14/+0
| | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>