aboutsummaryrefslogtreecommitdiff
path: root/arch/um/include/shared
AgeCommit message (Collapse)AuthorFilesLines
2014-10-13um: delete unnecessary bootmem struct page arrayHonggang Li1-1/+1
1) uml kernel bootmem managed through bootmem_data->node_bootmem_map, not the struct page array, so the array is unnecessary. 2) the bootmem struct page array has been pointed by a *local* pointer, struct page *map, in init_maps function. The array can be accessed only in init_maps's scope. As a result, uml kernel wastes about 1% of total memory. Signed-off-by: Honggang Li <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2014-08-06um: Use get_signal() signal_setup_done()Richard Weinberger1-8/+4
Use the more generic functions get_signal() signal_setup_done() for signal delivery. Signed-off-by: Richard Weinberger <[email protected]>
2014-04-20um: Memory corruption on startupAnton Ivanov1-0/+1
The reverse case of this race (you must msync before read) is well known. This is the not so common one. It can be triggered only on systems which do a lot of task switching and only at UML startup. If you are starting 200+ UMLs ~ 0.5% will always die without this fix. Signed-off-by: Anton Ivanov <[email protected]> [rw: minor whitespace fixes] Signed-off-by: Richard Weinberger <[email protected]>
2013-11-17um: Remove unused declarations from <as-layout.h>Geert Uytterhoeven1-3/+0
_end is used, but it's already provided by <asm/sections.h>, so use that. Signed-off-by: Geert Uytterhoeven <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: [email protected] Signed-off-by: Richard Weinberger <[email protected]>
2013-11-17um: Make stack trace reliable against kernel mode faultsRichard Weinberger1-0/+1
As UML uses an alternative signal stack we cannot use the current stack pointer for stack dumping if UML itself dies by SIGSEGV. To bypass this issue we save regs taken from mcontext in our segv handler into thread_struct and use these regs to obtain the stack pointer in show_stack(). Signed-off-by: Richard Weinberger <[email protected]>
2013-09-07um: Cleanup SIGTERM handlingRichard Weinberger1-0/+1
Richard reported that some UML processes survive if the UML main process receives a SIGTERM. This issue was caused by a wrongly placed signal(SIGTERM, SIG_DFL) in init_new_thread_signals(). It disabled the UML exit handler accidently for some processes. The correct solution is to disable the fatal handler for all UML helper threads/processes. Such that last_ditch_exit() does not get called multiple times and all processes can exit due to SIGTERM. Reported-and-tested-by: Richard W.M. Jones <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2013-09-07um: ubd: Add REQ_FLUSH suppportRichard Weinberger1-0/+1
UML's block device driver does not support write barriers, to support this this patch adds REQ_FLUSH suppport. Every time the block layer sends a REQ_FLUSH we fsync() now our backing file to guarantee data consistency. Reported-and-tested-by: Richard W.M. Jones <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2013-09-07um: Implement probe_kernel_read()Richard Weinberger1-0/+1
UML needs it's own probe_kernel_read() to handle kernel mode faults correctly. The implementation uses mincore() on the host side to detect whether a page is owned by the UML kernel process. This fixes also a possible crash when sysrq-t is used. Starting with 3.10 sysrq-t calls probe_kernel_read() to read details from the kernel workers. As kernel worker are completely async pointers may turn NULL while reading them. Cc: <[email protected]> Cc: <[email protected]> Cc: <[email protected]> # 3.10.x Signed-off-by: Richard Weinberger <[email protected]>
2013-07-19um: siginfo cleanupRichard Weinberger1-4/+4
Currently we use both struct siginfo and siginfo_t. Let's use struct siginfo internally to avoid ongoing compiler warning. We are allowed to do so because struct siginfo and siginfo_t are equivalent. Signed-off-by: Richard Weinberger <[email protected]>
2013-04-03nohz: Rename CONFIG_NO_HZ to CONFIG_NO_HZ_COMMONFrederic Weisbecker1-2/+2
We are planning to convert the dynticks Kconfig options layout into a choice menu. The user must be able to easily pick any of the following implementations: constant periodic tick, idle dynticks, full dynticks. As this implies a mutual exclusion, the two dynticks implementions need to converge on the selection of a common Kconfig option in order to ease the sharing of a common infrastructure. It would thus seem pretty natural to reuse CONFIG_NO_HZ to that end. It already implements all the idle dynticks code and the full dynticks depends on all that code for now. So ideally the choice menu would propose CONFIG_NO_HZ_IDLE and CONFIG_NO_HZ_EXTENDED then both would select CONFIG_NO_HZ. On the other hand we want to stay backward compatible: if CONFIG_NO_HZ is set in an older config file, we want to enable CONFIG_NO_HZ_IDLE by default. But we can't afford both at the same time or we run into a circular dependency: 1) CONFIG_NO_HZ_IDLE and CONFIG_NO_HZ_EXTENDED both select CONFIG_NO_HZ 2) If CONFIG_NO_HZ is set, we default to CONFIG_NO_HZ_IDLE We might be able to support that from Kconfig/Kbuild but it may not be wise to introduce such a confusing behaviour. So to solve this, create a new CONFIG_NO_HZ_COMMON option which gathers the common code between idle and full dynticks (that common code for now is simply the idle dynticks code) and select it from their referring Kconfig. Then we'll later create CONFIG_NO_HZ_IDLE and map CONFIG_NO_HZ to it for backward compatibility. Signed-off-by: Frederic Weisbecker <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Chris Metcalf <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Geoff Levand <[email protected]> Cc: Gilad Ben Yossef <[email protected]> Cc: Hakan Akkan <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Kevin Hilman <[email protected]> Cc: Li Zhong <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul E. McKenney <[email protected]> Cc: Paul Gortmaker <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Thomas Gleixner <[email protected]>
2013-01-03um: net: use eth_hw_addr_random() to generate random macJiri Pirko1-1/+0
Also remove unused "mac" from uml_net struct. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2012-10-13Merge branch 'for-linus' of ↵Linus Torvalds1-1/+0
git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal Pull third pile of kernel_execve() patches from Al Viro: "The last bits of infrastructure for kernel_thread() et.al., with alpha/arm/x86 use of those. Plus sanitizing the asm glue and do_notify_resume() on alpha, fixing the "disabled irq while running task_work stuff" breakage there. At that point the rest of kernel_thread/kernel_execve/sys_execve work can be done independently for different architectures. The only pending bits that do depend on having all architectures converted are restrictred to fs/* and kernel/* - that'll obviously have to wait for the next cycle. I thought we'd have to wait for all of them done before we start eliminating the longjump-style insanity in kernel_execve(), but it turned out there's a very simple way to do that without flagday-style changes." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: alpha: switch to saner kernel_execve() semantics arm: switch to saner kernel_execve() semantics x86, um: convert to saner kernel_execve() semantics infrastructure for saner ret_from_kernel_thread semantics make sure that kernel_thread() callbacks call do_exit() themselves make sure that we always have a return path from kernel_execve() ppc: eeh_event should just use kthread_run() don't bother with kernel_thread/kernel_execve for launching linuxrc alpha: get rid of switch_stack argument of do_work_pending() alpha: don't bother passing switch_stack separately from regs alpha: take SIGPENDING/NOTIFY_RESUME loop into signal.c alpha: simplify TIF_NEED_RESCHED handling
2012-10-12x86, um: convert to saner kernel_execve() semanticsAl Viro1-1/+0
Signed-off-by: Al Viro <[email protected]>
2012-10-09um: get rid of pointless include "..." where include <...> will doAl Viro10-16/+16
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2012-10-09um: move sysrq.h out of include/sharedAl Viro1-7/+0
never used by userland-side objects Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2012-09-27um: Preinclude include/linux/kern_levels.hGeert Uytterhoeven2-10/+11
The userspace part of UML uses the asm-offsets.h generator mechanism to create definitions for UM_KERN_<LEVEL> that match the in-kernel KERN_<LEVEL> constant definitions. As of commit 04d2c8c83d0e3ac5f78aeede51babb3236200112 ("printk: convert the format for KERN_<LEVEL> to a 2 byte pattern"), KERN_<LEVEL> is no longer expanded to the literal '"<LEVEL>"', but to '"\001" "LEVEL"', i.e. it contains two parts. However, the combo of DEFINE_STR() in arch/x86/um/shared/sysdep/kernel-offsets.h and sed-y in Kbuild doesn't support string literals consisting of multiple parts. Hence for all UM_KERN_<LEVEL> definitions, only the SOH character is retained in the actual definition, while the remainder ends up in the comment. E.g. in include/generated/asm-offsets.h we get #define UM_KERN_INFO "\001" /* "6" KERN_INFO */ instead of #define UM_KERN_INFO "\001" "6" /* KERN_INFO */ This causes spurious '^A' output in some kernel messages: Calibrating delay loop... 4640.76 BogoMIPS (lpj=23203840) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 256 ^AChecking that host ptys support output SIGIO...Yes ^AChecking that host ptys support SIGIO on close...No, enabling workaround ^AUsing 2.6 host AIO NET: Registered protocol family 16 bio: create slab <bio-0> at 0 Switching to clocksource itimer To fix this: - Move the mapping from UM_KERN_<LEVEL> to KERN_<LEVEL> from arch/um/include/shared/common-offsets.h to arch/um/include/shared/user.h, which is preincluded for all userspace parts, - Preinclude include/linux/kern_levels.h for all userspace parts, to obtain the in-kernel KERN_<LEVEL> constant definitions. This doesn't violate the kernel/userspace separation, as include/linux/kern_levels.h is self-contained and doesn't expose any other kernel internals. - Remove the now unused STR() and DEFINE_STR() macros. Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2012-08-02um: pass siginfo to guest processMartin Pärtel3-8/+11
UML guest processes now get correct siginfo_t for SIGTRAP, SIGFPE, SIGILL and SIGBUS. Specifically, si_addr and si_code are now correct where previously they were si_addr = NULL and si_code = 128. Signed-off-by: Martin Pärtel <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2012-06-01most of set_current_blocked() callers want SIGKILL/SIGSTOP removed from setAl Viro1-3/+0
Only 3 out of 63 do not. Renamed the current variant to __set_current_blocked(), added set_current_blocked() that will exclude unblockable signals, switched open-coded instances to it. Signed-off-by: Al Viro <[email protected]>
2012-05-21um: Implement um_free_irq()Richard Weinberger1-1/+1
Instead of using chip->release() we can achieve the same using a simple wrapper for free_irq(). We have already um_request_irq(), so um_free_irq() is the perfect counterpart. Signed-off-by: Richard Weinberger <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]>
2012-03-25um: kill HOST_TASK_PIDAl Viro2-3/+1
just provide get_current_pid() to the userland side of things instead of get_current() + manual poking in its results Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: unify ptrace_user.hAl Viro1-1/+2
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: take ubd_user.h to its users...Al Viro1-16/+0
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: take ldt.h to arch/x86/um/asm/mm_context.hAl Viro1-37/+0
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 <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: merge os-Linux/tls.c into arch/x86/um/os-Linux/tls.cAl Viro1-5/+0
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 <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: take um_mmu.h to asm/mmu.h, clean asm/mmu_context.h a bitAl Viro1-24/+0
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: kill um_uaccess.hAl Viro1-94/+0
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: take mconsole*.h to arch/um/driversAl Viro2-150/+0
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: take chan_*.h and line.h to arch/um/driversAl Viro3-211/+0
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: kill shared/mem_kern.hAl Viro1-20/+0
... nothing declared there exists Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: kill shared/tlb.hAl Viro1-13/+0
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: make flush_tlb_kernel_range_common() staticAl Viro1-2/+0
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: kill shared/task.h and HOST_TASK_REGSAl Viro2-10/+0
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: shared/syscall.h is not even includedAl Viro1-12/+0
... and functions declared in it do not exist Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: trim kern.hAl Viro1-18/+0
most of the functions in there are not used in anything that ends up including that header... Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: make load_initrd() static, kill shared/initrd.hAl Viro1-12/+0
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: shared/process.h is empty now; kill itAl Viro1-9/+0
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: start switching the references to host mcontext_t to its userland typeAl Viro1-5/+0
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: take userland definition of barrier() to user.hAl Viro2-3/+3
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: fill the handlers array at build timeAl Viro1-1/+1
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: simplify set_handler()Al Viro1-1/+1
For one thing, we always block the same signals (IRQ ones - IO, WINCH, VTALRM), so there's no need to pass sa_mask elements in arguments. For another, the flags depend only on whether it's an IRQ signal or not (we add SA_RESTART for them). Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: kill dead code around uaccessAl Viro2-9/+0
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: trim unused junk from user.hAl Viro1-2/+0
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: get rid of kern_constants.hAl Viro4-4/+4
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: kill skas_ptregs.hAl Viro1-6/+0
It's a plain include of user_constants.h and all (2) users are including user_constants.h directly prior to that. Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-11-02um: make copy_sc() staticAl Viro1-1/+0
... and kill it in amd64 - not used. Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2011-09-14um: fix oopsable race in line_close()Al Viro1-0/+1
tty->count is decremented only after ->close() had been called and several tasks can hit it in parallel. As the result, using tty->count to check if you are the last one is broken. We end up leaving line->tty not reset to NULL and the next IRQ on that sucker will blow up trying to dereference pointers from kfree'd struct tty. Fix is obvious: we need to use a counter of our own. Signed-off-by: Al Viro <[email protected]> Signed-off-by: Richard Weinberger <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2011-09-14um: Save FPU registers between task switchesIngo van Lil1-1/+1
Some time ago Jeff prepared 42daba316557 ("uml: stop saving process FP state") for UML to stop saving the process FP state between task switches. The assumption was that since with SKAS0 every guest process runs inside a host process context the host OS will take care of keeping the proper FP state. Unfortunately this is not true for multi-threaded applications, where all guest threads share a single host process context yet all may use the FPU on their own. Although I haven't verified it I suspect things to be even worse in SKAS3 mode where all guest processes run inside a single host process. The patch reintroduces the saving and restoring of the FP context between task switches. [[email protected]: Ingo posted this patch in 2009, sadly it was never applied and got lost. Now in 2011 the problem was reported by Gunnar.] Signed-off-by: Ingo van Lil <[email protected]> Signed-off-by: Richard Weinberger <[email protected]> Reported-by: <[email protected]> Tested-by: <[email protected]> Cc: Stanislav Meduna <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2011-05-25um: add earlyprintk supportRichard Weinberger1-0/+1
User Mode Linux can also benefit from earlyprintk. UML's earlyprintk writes kernel messages directly to stdout. Signed-off-by: Richard Weinberger <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2011-05-25um: fix UML_LIB_PATHRichard Weinberger1-0/+6
UML_LIB_PATH is hardcoded to /usr/lib/uml/, on 64bit systems UML_LIB_PATH needs to be /usr/lib64/uml/. Signed-off-by: Richard Weinberger <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2011-03-22um: remove file pointer from ioctlRichard Weinberger1-2/+2
Commit 6caa76b ("tty: now phase out the ioctl file pointer for good") removed the ioctl file pointer. User Mode Linux's line driver uses this ioctl and needs a signature update too. Signed-off-by: Richard Weinberger <[email protected]> Cc: Alan Cox <[email protected]> Cc: Greg KH <[email protected]> Cc: Jeff Dike <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>