summaryrefslogtreecommitdiffstats
path: root/arch/um
Commit message (Collapse)AuthorAgeFilesLines
* uml: fix mm_context memory leakJeff Dike2008-02-082-0/+6
| | | | | | | | | | | | | | [ Spotted by Miklos ] Fix a memory leak in init_new_context. The struct page ** buffer allocated for install_special_mapping was never recorded, and thus leaked when the mm_struct was freed. Fix it by saving the pointer in mm_context_t and freeing it in arch_exit_mmap. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: improved error handling while locating temp dirJim Meyering2008-02-081-9/+6Star
| | | | | | | | | | | | | | * arch/um/os-Linux/mem.c (make_tempfile): Don't deref NULL upon failed malloc. * arch/um/os-Linux/mem.c (make_tempfile): Handle NULL tempdir. Don't let a long tempdir (e.g., via TMPDIR) provoke heap corruption. [ jdike - formatting cleanups, deleted obsolete comment ] Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: style fixes in arch/um/os-LinuxJeff Dike2008-02-0814-129/+98Star
| | | | | | | | | | | | | | | | | | | | | Style changes under arch/um/os-Linux: include trimming CodingStyle fixes some printks needed severity indicators make_tempfile turns out not to be used outside of mem.c, so it is now static. Its declaration in tempfile.h is no longer needed, and tempfile.h itself is no longer needed. create_tmp_file was also made static. checkpatch moans about an EXPORT_SYMBOL in user_syms.c which is part of a macro definition - this is copying a bit of kernel infrastructure into the libc side of UML because the kernel headers can't be included there. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: runtime host VMSPLIT detectionJeff Dike2008-02-0813-72/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calculate TASK_SIZE at run-time by figuring out the host's VMSPLIT - this is needed on i386 if UML is to run on hosts with varying VMSPLITs without recompilation. TASK_SIZE is now defined in terms of a variable, task_size. This gets rid of an include of pgtable.h from processor.h, which can cause include loops. On i386, task_size is calculated early in boot by probing the address space in a binary search to figure out where the boundary between usable and non-usable memory is. This tries to make sure that a page that is considered to be in userspace is, or can be made, read-write. I'm concerned about a system-global VDSO page in kernel memory being hit and considered to be a userspace page. On x86_64, task_size is just the old value of CONFIG_TOP_ADDR. A bunch of config variable are gone now. CONFIG_TOP_ADDR is directly replaced by TASK_SIZE. NEST_LEVEL is gone since the relocation of the stubs makes it irrelevant. All the HOST_VMSPLIT stuff is gone. All references to these in arch/um/Makefile are also gone. I noticed and fixed a missing extern in os.h when adding os_get_task_size. Note: This has been revised to fix the 32-bit UML on 64-bit host bug that Miklos ran into. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* CONFIG_HIGHPTE vs. sub-page page tables.Martin Schwidefsky2008-02-081-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Background: I've implemented 1K/2K page tables for s390. These sub-page page tables are required to properly support the s390 virtualization instruction with KVM. The SIE instruction requires that the page tables have 256 page table entries (pte) followed by 256 page status table entries (pgste). The pgstes are only required if the process is using the SIE instruction. The pgstes are updated by the hardware and by the hypervisor for a number of reasons, one of them is dirty and reference bit tracking. To avoid wasting memory the standard pte table allocation should return 1K/2K (31/64 bit) and 2K/4K if the process is using SIE. Problem: Page size on s390 is 4K, page table size is 1K or 2K. That means the s390 version for pte_alloc_one cannot return a pointer to a struct page. Trouble is that with the CONFIG_HIGHPTE feature on x86 pte_alloc_one cannot return a pointer to a pte either, since that would require more than 32 bit for the return value of pte_alloc_one (and the pte * would not be accessible since its not kmapped). Solution: The only solution I found to this dilemma is a new typedef: a pgtable_t. For s390 pgtable_t will be a (pte *) - to be introduced with a later patch. For everybody else it will be a (struct page *). The additional problem with the initialization of the ptl lock and the NR_PAGETABLE accounting is solved with a constructor pgtable_page_ctor and a destructor pgtable_page_dtor. The page table allocation and free functions need to call these two whenever a page table page is allocated or freed. pmd_populate will get a pgtable_t instead of a struct page pointer. To get the pgtable_t back from a pmd entry that has been installed with pmd_populate a new function pmd_pgtable is added. It replaces the pmd_page call in free_pte_range and apply_to_pte_range. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* aout: remove unnecessary inclusions of {asm, linux}/a.out.hDavid Howells2008-02-081-1/+0Star
| | | | | | | | | | Remove now unnecessary inclusions of {asm,linux}/a.out.h. [akpm@linux-foundation.org: fix alpha build] Signed-off-by: David Howells <dhowells@redhat.com> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* aout: suppress A.OUT library support if !CONFIG_ARCH_SUPPORTS_AOUTDavid Howells2008-02-082-5/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppress A.OUT library support if CONFIG_ARCH_SUPPORTS_AOUT is not set. Not all architectures support the A.OUT binfmt, so the ELF binfmt should not be permitted to go looking for A.OUT libraries to load in such a case. Not only that, but under such conditions A.OUT core dumps are not produced either. To make this work, this patch also does the following: (1) Makes the existence of the contents of linux/a.out.h contingent on CONFIG_ARCH_SUPPORTS_AOUT. (2) Renames dump_thread() to aout_dump_thread() as it's only called by A.OUT core dumping code. (3) Moves aout_dump_thread() into asm/a.out-core.h and makes it inline. This is then included only where needed. This means that this bit of arch code will be stored in the appropriate A.OUT binfmt module rather than the core kernel. (4) Drops A.OUT support for Blackfin (according to Mike Frysinger it's not needed) and FRV. This patch depends on the previous patch to move STACK_TOP[_MAX] out of asm/a.out.h and into asm/processor.h as they're required whether or not A.OUT format is available. [jdike@addtoit.com: uml: re-remove accidentally restored code] Signed-off-by: David Howells <dhowells@redhat.com> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* aout: mark arches that support A.OUT formatDavid Howells2008-02-082-0/+4
| | | | | | | | | | | | | | | | | | | Mark arches that support A.OUT format by including the following in their master Kconfig files: config ARCH_SUPPORTS_AOUT def_bool y This should also be set if the arch provides compatibility A.OUT support for an older arch, for instance x86_64 for i386 or sparc64 for sparc. I've guessed at which arches don't, based on comments in the code, however I'm sure that some of the ones I've marked as 'yes' actually should be 'no'. Signed-off-by: David Howells <dhowells@redhat.com> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: make mconsole_stack namespace-awareJeff Dike2008-02-051-17/+18
| | | | | | | | | Also fixed the include syntax while I was there. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: redo the calculation of NR_syscallsJeff Dike2008-02-056-19/+25
| | | | | | | | | | | | | | | | | | | | Redo the calculation of NR_syscalls since that disappeared from i386 and use a similar mechanism on x86_64. We now figure out the size of the system call table in arch code and stick that in syscall_table_size. arch/um/kernel/skas/syscall.c defines NR_syscalls in terms of that since its the only thing that needs to know how many system calls there are. The old mechananism that was used on x86_64 is gone. arch/um/include/sysdep-i386/syscalls.h got some formatting since I was looking at it. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: defconfig tweaksJeff Dike2008-02-051-3/+3
| | | | | | | | | | | | Tweak the UML defconfig - we probably don't need 256 old-style ptys - this slows down udev noticably enable hostfs disable slab debugging - another noticable performance hit Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: port mutex conversionDaniel Walker2008-02-051-3/+4
| | | | | | | | | | | The port_sem is already used as a mutex since it's using DECLARE_MUTEX(), but the underlying construct is still a semaphore .. This patch switches it over to a struct mutex. Signed-off-by: Daniel Walker <dwalker@mvista.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: mconsole mutex conversionDaniel Walker2008-02-051-3/+4
| | | | | | | | | | | The plug_mem_mutex is already used as a mutex since it's using DECLARE_MUTEX(), but the underlying construct is still a semaphore .. This patch switches it over to a struct mutex. Signed-off-by: Daniel Walker <dwalker@mvista.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: LDT mutex conversionDaniel Walker2008-02-051-7/+7
| | | | | | | | | | The ldt.semaphore conforms to the new struct mutex requirments, so I converted it to use the new API and changed the name. Signed-off-by: Daniel Walker <dwalker@mvista.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: use of a public MAC is a warning, not an errorJeff Dike2008-02-051-5/+4Star
| | | | | | | | | | Downgrade one of the MAC validity checks. If it's one that could be possibly assigned to a physical NIC, then nothing will break. So, emit a warning in this case, but keep the requested MAC. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: fix infinite mconsole loopKarol Swietlicki2008-02-051-1/+3
| | | | | | | | | | | | | | | | | This patch takes care of a problem with the stopping code. The function inside the while condition returns 0 to signify a problem. A problem could be for example a bad command or a bad version of the mconsole client. A bad command would terminate the stopping loop and resume the kernel. This is a problem. A better solution is to make the loop infinite and don't leave it until we are explicitly told to. Signed-off-by: Karol Swietlicki <magotari@gmail.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: remove map_cbJeff Dike2008-02-051-7/+1Star
| | | | | | | | | | | | | John Reiser noticed that a physical memory region was being mapped twice. This patch fixes that, and it inlines the responsible function, as that had only one caller. Cc: John Reiser <jreiser@BitWagon.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: remove TOPDIRWANG Cong2008-02-052-13/+13
| | | | | | | | | | | TOPDIR is obsolete, use srctree instead. This patch removes TOPDIR from all UML Makefiles. Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: remove unused fields from mm_contextJeff Dike2008-02-051-4/+0Star
| | | | | | | | | The 3-level page table fixes forgot to remove a couple now-unused fields from struct mm_context. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: move register initializationJeff Dike2008-02-051-3/+7
| | | | | | | | | | Calling init_registers inside the skas3 checking causes mysterious crashes if it doesn't happen because the skas3 checking is bypassed. This patch moves it to os_early_checks. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: add newlines to printksJeff Dike2008-02-051-4/+4
| | | | | | | | Some printks were missing newlines. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: style fixes in arch/um/sys-x86_64Jeff Dike2008-02-058-106/+65Star
| | | | | | | | | | | | | | Style fixes in arch/um/sys-x86_64: updated copyrights CodingStyle fixes added severities to printks which needed them A bunch of functions in sys-*/ptrace_user.c turn out to be unused, so they and their declarations are gone. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: add back CONFIG_HZJeff Dike2008-02-051-0/+4
| | | | | | | | | | | | | avoid-overflows-in-kernel-timec.patch makes CONFIG_HZ necessary for a successful build. UML lacks a definition, so this patch adds one. It also changes the hard-wired definition of HZ to CONFIG_HZ. Note: this patch is a good idea even in the absence of hpa's time fixes. Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: DEBUG_SHIRQ fixesJeff Dike2008-02-052-4/+12
| | | | | | | | | | | | | | | | | | A couple more DEBUG_SHIRQ fixes. The previous mconsole blocking fix exposed the lack of O_NONBLOCK on the mconsole socket. Also, winch_interrupt started crashing because it is called at irq free time and it tries to dereference tty->driver_data, which has already been set to NULL. I added some error cleanup in mconsole_init while I was there. Cc: "Karol Swietlicki" <magotari@gmail.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: remove fakehdJeff Dike2008-02-051-16/+4Star
| | | | | | | | | The fakehd switch lost its implementation at some point. Since no one is screaming for it, we might as well remove it. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: implement O_APPENDJeff Dike2008-02-051-0/+2
| | | | | | | | The .a flags in openflags never had an implementation. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: SMP locking commentaryJeff Dike2008-02-054-10/+17
| | | | | | | | | | | Add some more commentary about various pieces of global data not needing locking. Also got rid of unmap_physmem since that is no longer used. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: remove init_irq_signalsJeff Dike2008-02-053-13/+4Star
| | | | | | | | | | | init_irq_signals doesn't need to be called from the context of a new process. It initializes handlers, which are useless in process context. With that call gone, init_irq_signals has only one caller, so it can be inlined into init_new_thread_signals. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: signal handling tidyingJeff Dike2008-02-051-21/+12Star
| | | | | | | | | | | | | | | This patch tidies the signal handling code slightly. pending is renamed to signals_pending for symmetry with signals_enabled. remove_sigstack was unused, so can be deleted. The value of change_sig was never used, so it is now void and the return value is not calculated any more. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: style fixes in arch/um/kernelJeff Dike2008-02-0514-133/+122Star
| | | | | | | | | | | | | | | | Joe Perches noticed some printks in smp.c that needed fixing. While I was in there, I did the usual tidying in arch/um/kernel, which should be fairly style-clean at this point: copyright updates emacs formatting comments removal include tidying style fixes Cc: Joe Perches <joe@perches.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: clean up sig_handler_common_skasJeff Dike2008-02-051-45/+18Star
| | | | | | | | | | | | | | | | | | | | | | | | sig_handler_common_skas needs significant modernization, starting with its name and storage class. There is no need to hide the true type of the sigcontext pointer, so the void * dummy parameter can be replaced with a sigcontext *sc. The array of uml_pt_regs structs used in the page fault case are gone, replaced by a local variable. This is also used in the non-segfault case instead of the copy in the task_struct. Since it's local, the special handling of the is_user flag can go away. There hasn't been any special treatment of SIGUSR1 in ages, so the line that enables it can be deleted. The special treatment of SIGSEGV similarly goes away, but to compensate, SA_NODEFER is added to sa_mask when registering a signal handler. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: move sig_handler_common_skasJeff Dike2008-02-054-79/+65Star
| | | | | | | | | | | | | This patch moves sig_handler_common_skas from arch/um/os-Linux/skas/trap.c to its only caller in arch/um/os-Linux/signal.c. trap.c is now empty, so it can be removed. This is code movement only - the significant cleanup needed here is done in the next patch. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: don't allow processes to call into stubJeff Dike2008-02-051-0/+3
| | | | | | | | | | | | | Kill a process that tries to branch into a stub and execute a system call. There are no security implications here - a system call in a stub is treated the same as a system call anywhere else. But if a process is trying to branch into a stub, either it is trying something nasty or it has gone haywire, so it's a good idea to get rid of it in either case. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: get rid of syscall countersJeff Dike2008-02-053-7/+0Star
| | | | | | | | Get rid of some syscall counters which haven't been useful in ages. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: don't kill pid 0Jeff Dike2008-02-051-1/+13
| | | | | | | | | | | | | | | A bit of defensive programming - during development, it ocassionally happens that a call to init_new_context is missed, resulting in context holding a host pid of zero. When that address space is torn down, destroy_context does a kill(0), which instantly kills the whole UML without any errors whatsoever. This patch add a check for pids less than 2, to also catch 1 and negative pids. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: tidy helper codeJeff Dike2008-02-057-50/+36Star
| | | | | | | | | | | | | | | | | | | | | | | | Style fixes to arch/um/os/helper.c and tidying up the breakpoint fix a bit. helper.c gets all the usual style fixes - updated copyright all printks get severities Also - errval changes to err in helper_child fixed an obsolete comment run_helper was killing a child process which is guaranteed to be dead or dying anyway Removed the nohang and pname arguments from helper_wait and fixed the declaration and callers. nohang was used only in the slirp driver and I don't think it was needed. I think pname was a bit of overkill in putting out an error message when something goes wrong. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: use barrier() instead of mb()Jeff Dike2008-02-051-20/+8Star
| | | | | | | | | | | | | | | | signals_enabled and pending have requirements on the order in which they are modified. This used to be done by declaring them volatile and putting an mb() where the ordering requirements were in effect. After getting a better (I hope) understanding of how to do this correctly, the volatile declarations are gone and the mb()'s replaced by barrier()'s. One of the mb()'s was deleted because I see no problematic writes that could be re-ordered past that point. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: install panic notifier earlierJeff Dike2008-02-054-32/+42
| | | | | | | | | | | | | | | | | | | | It turns out that if there's a panic early enough, UML will just sit there in the LED-blinking loop because the panic notifier hadn't been installed yet. This patch installs it earlier. It also fixes the problem which exposed the hang, namely that if you give UML a zero-sized initrd, it will ask alloc_bootmem for zero bytes, and that will cause the panic. While I was in initrd.c, I gave it a style makeover. Prompted by checkpatch, I moved a couple extern declarations of uml_exitcode to kern_util.h. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: eliminate setjmp_wrapperJeff Dike2008-02-053-62/+27Star
| | | | | | | | | | | | | | | | | setjmp_wrapper existed to provide setjmp to kernel code when UML used libc's setjmp and longjmp. Now that UML has its own implementation, this isn't needed and kernel code can invoke setjmp directly. do_buffer_op is massively cleaned up since it is no longer a callback from setjmp_wrapper and given a va_list from which it must extract its arguments. The actual setjmp is moved from buffer_op to do_op_one_page because the copy operation is inside an atomic section (kmap_atomic to kunmap_atomic) and it shouldn't be longjmp-ed out of. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: customize tlb.hJeff Dike2008-02-051-7/+18
| | | | | | | | | | | | | | Customize the hooks in tlb.h to optimize TLB flushing some more. Add start and end fields to tlb_gather_mmu, which are used to limit the address space range scanned when a region is unmapped. The interfaces which just free page tables, without actually changing mappings, don't need to cause a TLB flush. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: 64-bit tlb fixesJeff Dike2008-02-051-4/+4
| | | | | | | | | | | | Some 64-bit tlb fixes - moved pmd_page_vaddr to pgtable.h since it's the same for both 2-level and 3-level page tables fixed a bogus cast on pud_page_vaddr made the address checking in update_*_range more careful Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: style fixes in file.cJeff Dike2008-02-052-115/+118
| | | | | | | | | | | | | | | | arch/um/os-Linux/file.c needed some style work - updated the copyright cleaned up the includes CodingStyle fixes added some missing CATCH_EINTRs os_set_owner was unused, so it is gone all printks now have severities fcntl(F_GETFL) was being called without checking the return removed an obsolete comment Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: miscellaneous code cleanupsJeff Dike2008-02-057-40/+18Star
| | | | | | | | | | | | | | | Code tidying - the pid field of struct irq_fd isn't used, so it is removed os_set_fd_async needed to read flags before changing them, it doesn't need a pid passed in because it can call getpid itself, and a block of unused code needed deleting os_get_exec_close was unused, so it is removed ptrace_child called _exit for historical reasons which are no longer valid, so just calls exit instead Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: fix mconsole stopKarol Swietlicki2008-02-051-3/+2Star
| | | | | | | | | | | | | | | | Bring back the functionality of stopping user mode linux with the help of mconsole. [jdike - the bug being fixed is that the mconsole file descriptor is already set O_NONBLOCK or not, depending on whether we want no blocking (the normal case) or we want blocking (when an mconsole stop is in effect), so the MSG_DONTWAIT is redundant in the normal case, and wrong when we want to block.] Signed-off-by: Karol Swietlicki <magotari@gmail.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: remove duplicate config symbol and unused file and variablesKarol Swietlicki2008-02-054-27/+2Star
| | | | | | | | | | | | | | Fix the repetition of the NET symbol. It was once in UML specific options and once in networking. I removed the first occurrence, as it makes more sense to me to keep it only in networking. It also removes a mostly empty file which is not used anymore and some unused variables. Signed-off-by: Karol Swietlicki <magotari@gmail.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: syle fixes in arch/um/os-LinuxJeff Dike2008-02-052-118/+150
| | | | | | | | | | | | | | | Style fixes in arch/um/os-Linux/irq.c and arch/um/os-Linux/sigio.c: Updated copyrights trimmed includes added severity indicators to printks CodingStyle fixes turned an bunch of panics into printks call some libc functions directly instead of going through the os_* wrappers Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: fx command-line CFLAGS and LDFLAGS supportJeff Dike2008-02-051-3/+3
| | | | | | | | | | | | | | | | | UML still needed some work in order to allow CFLAGS to be passed in from the command line. USER_CFLAGS is produced from KBUILD_CFLAGS in part by removing all the -I switches. This is so that kernel headers don't accidentally get pulled into libc files. However, a common use of command-line CFLAGS would be to add -I switches to the build. This patch specifically adds any command-line -I flags back to USER_CFLAGS. I also corrected the spelling of LFLAGS to LDFLAGS. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: cover stubs with a VMAJeff Dike2008-02-055-72/+70Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Give the stubs a VMA. This allows the removal of a truly nasty kludge to make sure that mm->nr_ptes was correct in exit_mmap. The underlying problem was always that the stubs, which have ptes, and thus allocated a page table, weren't covered by a VMA. This patch fixes that by using install_special_mapping in arch_dup_mmap and activate_context to create the VMA. The stubs have to be moved, since shift_arg_pages seems to assume that the stack is the only VMA present at that point during exec, and uses vma_adjust to fiddle its VMA. However, that extends the stub VMA by the amount removed from the stack VMA. To avoid this problem, the stubs were moved to a different fixed location at the start of the address space. The init_stub_pte calls were moved from init_new_context to arch_dup_mmap because I was occasionally seeing arch_dup_mmap not being called, causing exit_mmap to die. Rather than figure out what was really happening, I decided it was cleaner to just move the calls so that there's no doubt that both the pte and VMA creation happen, no matter what. arch_exit_mmap is used to clear the stub ptes at exit time. The STUB_* constants in as-layout.h no longer depend on UM_TASK_SIZE, that that definition is removed, along with the comments complaining about gcc. Because the stubs are no longer at the top of the address space, some care is needed while flushing TLBs. update_pte_range checks for addresses in the stub range and skips them. flush_thread now issues two unmaps, one for the range before STUB_START and one for the range after STUB_END. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: clean up TASK_SIZE usageJeff Dike2008-02-058-41/+20Star
| | | | | | | | | | | | | | | | | Clean up the calculation and use of the usable address space size on the host. task_size is gone, replaced with TASK_SIZE, which is calculated from CONFIG_TOP_ADDR. get_kmem_end and set_task_sizes_skas are also gone. host_task_size, which refers to the entire address space usable by the UML kernel and which may be larger than the address space usable by a UML process, since that has to end on a pgdir boundary, is replaced by CONFIG_TOP_ADDR. STACK_TOP is now TASK_SIZE minus the two stub pages. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uml: add missing spaceJoe Perches2008-02-051-1/+1
| | | | | | | | | Add missing space between merged string constants. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>