Commit 42fda663 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds
Browse files

uml: throw out CONFIG_MODE_TT



This patchset throws out tt mode, which has been non-functional for a while.

This is done in phases, interspersed with code cleanups on the affected files.

The removal is done as follows:
	remove all code, config options, and files which depend on
CONFIG_MODE_TT
	get rid of the CHOOSE_MODE macro, which decided whether to
call tt-mode or skas-mode code, and replace invocations with their
skas portions
	replace all now-trivial procedures with their skas equivalents

There are now a bunch of now-redundant pieces of data structures, including
mode-specific pieces of the thread structure, pt_regs, and mm_context.  These
are all replaced with their skas-specific contents.

As part of the ongoing style compliance project, I made a style pass over all
files that were changed.  There are three such patches, one for each phase,
covering the files affected by that phase but no later ones.

I noticed that we weren't freeing the LDT state associated with a process when
it exited, so that's fixed in one of the later patches.

The last patch is a tidying patch which I've had for a while, but which caused
inexplicable crashes under tt mode.  Since that is no longer a problem, this
can now go in.

This patch:

Start getting rid of tt mode support.

This patch throws out CONFIG_MODE_TT and all config options, code, and files
which depend on it.

CONFIG_MODE_SKAS is gone and everything that depends on it is included
unconditionally.

The few changed lines are in re-written Kconfig help, lines which needed
something skas-related removed from them, and a few more which weren't
strictly deletions.
Signed-off-by: default avatarJeff Dike <jdike@linux.intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a1ff5878
......@@ -62,55 +62,16 @@ config IRQ_RELEASE_METHOD
menu "UML-specific options"
config MODE_TT
bool "Tracing thread support (DEPRECATED)"
default n
depends on BROKEN
help
This option controls whether tracing thread support is compiled
into UML. This option is largely obsolete, given that skas0 provides
skas security and performance without needing to patch the host.
It is safe to say 'N' here; saying 'Y' may cause additional problems
with the resulting binary even if you run UML in SKAS mode, and running
in TT mode is strongly *NOT RECOMMENDED*.
config STATIC_LINK
bool "Force a static link"
default n
depends on !MODE_TT
help
If CONFIG_MODE_TT is disabled, then this option gives you the ability
to force a static link of UML. Normally, if only skas mode is built
in to UML, it will be linked as a shared binary. This is inconvenient
for use in a chroot jail. So, if you intend to run UML inside a
chroot, and you disable CONFIG_MODE_TT, you probably want to say Y
here.
This option gives you the ability to force a static link of UML.
Normally, UML is linked as a shared binary. This is inconvenient for
use in a chroot jail. So, if you intend to run UML inside a chroot,
you probably want to say Y here.
Additionally, this option enables using higher memory spaces (up to
2.75G) for UML - disabling CONFIG_MODE_TT and enabling this option leads
to best results for this.
config KERNEL_HALF_GIGS
int "Kernel address space size (in .5G units)"
default "1"
depends on MODE_TT
help
This determines the amount of address space that UML will allocate for
its own, measured in half Gigabyte units. The default is 1.
Change this only if you need to boot UML with an unusually large amount
of physical memory.
config MODE_SKAS
bool "Separate Kernel Address Space support" if MODE_TT
default y
help
This option controls whether skas (separate kernel address space)
support is compiled in.
Unless you have specific needs to use TT mode (which applies almost only
to developers), you should say Y here.
SKAS mode will make use of the SKAS3 patch if it is applied on the host
(and your UML will run in SKAS3 mode), but if no SKAS patch is applied
on the host it will run in SKAS0 mode, which is anyway faster than TT
mode.
2.75G) for UML.
source "arch/um/Kconfig.arch"
source "mm/Kconfig"
......@@ -118,7 +79,7 @@ source "mm/Kconfig"
config LD_SCRIPT_STATIC
bool
default y
depends on MODE_TT || STATIC_LINK
depends on STATIC_LINK
config LD_SCRIPT_DYN
bool
......@@ -220,7 +181,7 @@ config SMP
bool "Symmetric multi-processing support (EXPERIMENTAL)"
default n
#SMP_BROKEN is for x86_64.
depends on MODE_TT && EXPERIMENTAL && (!SMP_BROKEN || (BROKEN && SMP_BROKEN))
depends on EXPERIMENTAL && (!SMP_BROKEN || (BROKEN && SMP_BROKEN))
help
This option enables UML SMP support.
It is NOT related to having a real SMP box. Not directly, at least.
......@@ -258,11 +219,6 @@ config NEST_LEVEL
inside another UML, set CONFIG_NEST_LEVEL to one more than the host
UML.
Note that if the hosting UML has its CONFIG_KERNEL_HALF_GIGS set to
greater than one, then the guest UML should have its CONFIG_NEST_LEVEL
set to the host's CONFIG_NEST_LEVEL + CONFIG_KERNEL_HALF_GIGS.
Only change this if you are running nested UMLs.
config HIGHMEM
bool "Highmem support (EXPERIMENTAL)"
depends on !64BIT && EXPERIMENTAL
......@@ -271,9 +227,9 @@ config HIGHMEM
This was used to allow UML to run with big amounts of memory.
Currently it is unstable, so if unsure say N.
To use big amounts of memory, it is recommended to disable TT mode (i.e.
CONFIG_MODE_TT) and enable static linking (i.e. CONFIG_STATIC_LINK) -
this should allow the guest to use up to 2.75G of memory.
To use big amounts of memory, it is recommended enable static
linking (i.e. CONFIG_STATIC_LINK) - this should allow the
guest to use up to 2.75G of memory.
config KERNEL_STACK_ORDER
int "Kernel stack size order"
......
......@@ -65,8 +65,6 @@ config XTERM_CHAN
This option enables support for attaching UML consoles and serial
lines to xterms. Each UML device so assigned will be brought up in
its own xterm.
If you disable this option, then CONFIG_PT_PROXY will be disabled as
well, since UML's gdb currently requires an xterm.
It is safe to say 'Y' here.
config NOCONFIG_CHAN
......
......@@ -2,28 +2,9 @@ menu "Kernel hacking"
source "lib/Kconfig.debug"
config CMDLINE_ON_HOST
bool "Show command line arguments on the host in TT mode"
depends on MODE_TT
default !DEBUG_INFO
help
This controls whether arguments in guest processes should be shown on
the host's ps output.
Enabling this option hinders debugging on some recent GDB versions
(because GDB gets "confused" when we do an execvp()). So probably you
should disable it.
config PT_PROXY
bool "Enable ptrace proxy"
depends on XTERM_CHAN && DEBUG_INFO && MODE_TT
help
This option enables a debugging interface which allows gdb to debug
the kernel without needing to actually attach to kernel threads.
If you want to do kernel debugging, say Y here; otherwise say N.
config GPROF
bool "Enable gprof support"
depends on DEBUG_INFO && MODE_SKAS && !MODE_TT
depends on DEBUG_INFO
help
This allows profiling of a User-Mode Linux kernel with the gprof
utility.
......@@ -36,7 +17,7 @@ config GPROF
config GCOV
bool "Enable gcov support"
depends on DEBUG_INFO && MODE_SKAS
depends on DEBUG_INFO
help
This option allows developers to retrieve coverage data from a UML
session.
......
......@@ -31,18 +31,9 @@ SYMLINK_HEADERS := $(foreach header,$(SYMLINK_HEADERS),include/asm-um/$(header))
ARCH_SYMLINKS = include/asm-um/arch $(ARCH_DIR)/include/sysdep $(ARCH_DIR)/os \
$(SYMLINK_HEADERS) $(ARCH_DIR)/include/uml-config.h
um-modes-$(CONFIG_MODE_TT) += tt
um-modes-$(CONFIG_MODE_SKAS) += skas
MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include/skas
MODE_INCLUDE += $(foreach mode,$(um-modes-y),\
-I$(srctree)/$(ARCH_DIR)/include/$(mode))
MAKEFILES-INCL += $(foreach mode,$(um-modes-y),\
$(srctree)/$(ARCH_DIR)/Makefile-$(mode))
ifneq ($(MAKEFILES-INCL),)
include $(MAKEFILES-INCL)
endif
include $(srctree)/$(ARCH_DIR)/Makefile-skas
ARCH_INCLUDE := -I$(ARCH_DIR)/include
ifneq ($(KBUILD_SRC),)
......@@ -89,9 +80,8 @@ CFLAGS += $(call cc-option,-fno-unit-at-a-time,)
# included; the values here are meaningless
CONFIG_NEST_LEVEL ?= 0
CONFIG_KERNEL_HALF_GIGS ?= 0
SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000)
SIZE = ($(CONFIG_NEST_LEVEL) * 0x20000000)
PHONY += linux
......@@ -124,7 +114,6 @@ CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,)
$(call cc-option, -fno-stack-protector,) \
$(call cc-option, -fno-stack-protector-all,)
CPP_MODE-$(CONFIG_MODE_TT) := -DMODE_TT
CONFIG_KERNEL_STACK_ORDER ?= 2
STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] )
......@@ -132,11 +121,8 @@ ifndef START
START = $(shell echo $$[ $(TOP_ADDR) - $(SIZE) ] )
endif
CPPFLAGS_vmlinux.lds = -U$(SUBARCH) \
-DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \
-DELF_FORMAT="$(ELF_FORMAT)" $(CPP_MODE-y) \
-DKERNEL_STACK_SIZE=$(STACK_SIZE) \
-DUNMAP_PATH=arch/um/sys-$(SUBARCH)/unmap.o
CPPFLAGS_vmlinux.lds = -U$(SUBARCH) -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \
-DELF_FORMAT="$(ELF_FORMAT)" -DKERNEL_STACK_SIZE=$(STACK_SIZE)
#The wrappers will select whether using "malloc" or the kernel allocator.
LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
......
......@@ -2,11 +2,7 @@ core-y += arch/um/sys-i386/ arch/x86/crypto/
TOP_ADDR := $(CONFIG_TOP_ADDR)
ifeq ($(CONFIG_MODE_SKAS),y)
ifneq ($(CONFIG_MODE_TT),y)
START := 0x8048000
endif
endif
START := 0x8048000
LDFLAGS += -m elf_i386
ELF_ARCH := $(SUBARCH)
......
......@@ -12,9 +12,7 @@ CONFIG_IRQ_RELEASE_METHOD=y
#
# UML-specific options
#
# CONFIG_MODE_TT is not set
# CONFIG_STATIC_LINK is not set
CONFIG_MODE_SKAS=y
#
# Host processor type and features
......
......@@ -735,8 +735,6 @@ void mconsole_sysrq(struct mc_request *req)
}
#endif
#ifdef CONFIG_MODE_SKAS
static void stack_proc(void *arg)
{
struct task_struct *from = current, *to = arg;
......@@ -750,7 +748,7 @@ static void stack_proc(void *arg)
* Dumps a stacks registers to the linux console.
* Usage stack <pid>.
*/
static void do_stack_trace(struct mc_request *req)
void mconsole_stack(struct mc_request *req)
{
char *ptr = req->request.data;
int pid_requested= -1;
......@@ -781,17 +779,6 @@ static void do_stack_trace(struct mc_request *req)
}
with_console(req, stack_proc, to);
}
#endif /* CONFIG_MODE_SKAS */
void mconsole_stack(struct mc_request *req)
{
/* This command doesn't work in TT mode, so let's check and then
* get out of here
*/
CHOOSE_MODE(mconsole_reply(req, "Sorry, this doesn't work in TT mode",
1, 0),
do_stack_trace(req));
}
/* Changed by mconsole_setup, which is __setup, and called before SMP is
* active.
......
......@@ -28,7 +28,6 @@ extern unsigned long _unprotected_end;
extern unsigned long brk_start;
extern int linux_main(int argc, char **argv);
extern void set_cmdline(char *cmd);
extern void (*sig_info[])(int, union uml_pt_regs *);
......
......@@ -8,26 +8,8 @@
#include "uml-config.h"
#if defined(UML_CONFIG_MODE_TT) && defined(UML_CONFIG_MODE_SKAS)
#define CHOOSE_MODE(tt, skas) (mode_tt ? (tt) : (skas))
extern int mode_tt;
static inline void *__choose_mode(void *tt, void *skas) {
return mode_tt ? tt : skas;
}
#define __CHOOSE_MODE(tt, skas) (*( (typeof(tt) *) __choose_mode(&(tt), &(skas))))
#elif defined(UML_CONFIG_MODE_SKAS)
#define CHOOSE_MODE(tt, skas) (skas)
#elif defined(UML_CONFIG_MODE_TT)
#define CHOOSE_MODE(tt, skas) (tt)
#else
#error CONFIG_MODE_SKAS and CONFIG_MODE_TT are both disabled
#endif
#define CHOOSE_MODE_PROC(tt, skas, args...) \
CHOOSE_MODE(tt(args), skas(args))
......
/* for use by sys-$SUBARCH/kernel-offsets.c */
DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE);
#ifdef CONFIG_MODE_TT
OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid);
#endif
OFFSET(HOST_TASK_REGS, task_struct, thread.regs);
OFFSET(HOST_TASK_PID, task_struct, pid);
......
......@@ -30,8 +30,4 @@ extern void deactivate_fd(int fd, int irqnum);
extern int deactivate_all_fds(void);
extern int activate_ipi(int fd, int pid);
#ifdef CONFIG_MODE_TT
extern void forward_interrupts(int pid);
#endif
#endif
......@@ -34,9 +34,6 @@ extern int nsyscalls;
UML_ROUND_DOWN(((unsigned long) addr) + PAGE_SIZE - 1)
extern int kernel_fork(unsigned long flags, int (*fn)(void *), void * arg);
#ifdef UML_CONFIG_MODE_TT
extern unsigned long stack_sp(unsigned long page);
#endif
extern int kernel_thread_proc(void *data);
extern void syscall_segv(int sig);
extern int current_pid(void);
......@@ -82,9 +79,6 @@ extern void check_stack_overflow(void *ptr);
extern void relay_signal(int sig, union uml_pt_regs *regs);
extern int user_context(unsigned long sp);
extern void timer_irq(union uml_pt_regs *regs);
#ifdef CONFIG_MODE_TT
extern void unprotect_stack(unsigned long stack);
#endif
extern void do_uml_exitcalls(void);
extern int attach_debugger(int idle_pid, int pid, int stop);
extern int config_gdb(char *str);
......
......@@ -6,25 +6,6 @@
#ifndef __MODE_H__
#define __MODE_H__
#include "uml-config.h"
#ifdef UML_CONFIG_MODE_TT
#include "mode-tt.h"
#endif
#ifdef UML_CONFIG_MODE_SKAS
#include "mode-skas.h"
#endif
#endif
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-file-style: "linux"
* End:
*/
......@@ -6,12 +6,6 @@
#ifndef __MODE_KERN_H__
#define __MODE_KERN_H__
#ifdef CONFIG_MODE_TT
#include "mode_kern_tt.h"
#endif
#ifdef CONFIG_MODE_SKAS
#include "mode_kern_skas.h"
#endif
#endif
......@@ -178,11 +178,7 @@ extern void check_host_supports_tls(int *supports_tls, int *tls_min);
/* Make sure they are clear when running in TT mode. Required by
* SEGV_MAYBE_FIXABLE */
#ifdef UML_CONFIG_MODE_SKAS
#define clear_can_do_skas() do { ptrace_faultinfo = proc_mm = 0; } while (0)
#else
#define clear_can_do_skas() do {} while (0)
#endif
/* mem.c */
extern int create_mem_file(unsigned long long len);
......@@ -193,18 +189,11 @@ extern int os_process_parent(int pid);
extern void os_stop_process(int pid);
extern void os_kill_process(int pid, int reap_child);
extern void os_kill_ptraced_process(int pid, int reap_child);
#ifdef UML_CONFIG_MODE_TT
extern void os_usr1_process(int pid);
#endif
extern long os_ptrace_ldt(long pid, long addr, long data);
extern int os_getpid(void);
extern int os_getpgrp(void);
#ifdef UML_CONFIG_MODE_TT
extern void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int));
extern void stop(void);
#endif
extern void init_new_thread_signals(void);
extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr);
......@@ -217,18 +206,6 @@ extern int os_drop_memory(void *addr, int length);
extern int can_drop_memory(void);
extern void os_flush_stdout(void);
/* tt.c
* for tt mode only (will be deleted in future...)
*/
extern void forward_ipi(int fd, int pid);
extern void kill_child_dead(int pid);
extern int wait_for_stop(int pid, int sig, int cont_type, void *relay);
extern int protect_memory(unsigned long addr, unsigned long len,
int r, int w, int x, int must_succeed);
extern void forward_pending_sigio(int target);
extern int start_fork_tramp(void *arg, unsigned long temp_stack,
int clone_flags, int (*tramp)(void *));
/* uaccess.c */
extern unsigned long __do_user_copy(void *to, const void *from, int n,
void **fault_addr, void **fault_catcher,
......@@ -281,9 +258,6 @@ extern void os_dump_core(void);
extern void switch_timers(int to_real);
extern void idle_sleep(int secs);
extern int set_interval(int is_virtual);
#ifdef CONFIG_MODE_TT
extern void enable_timer(void);
#endif
extern void disable_timer(void);
extern void uml_idle_timer(void);
extern unsigned long long os_nsecs(void);
......
......@@ -14,12 +14,7 @@
#define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long))
#define MAX_REG_OFFSET (UM_FRAME_SIZE)
#ifdef UML_CONFIG_PT_PROXY
extern void update_debugregs(int seq);
#else
static inline void update_debugregs(int seq) {}
#endif
/* syscall emulation path in ptrace */
......@@ -31,12 +26,6 @@ void set_using_sysemu(int value);
int get_using_sysemu(void);
extern int sysemu_supported;
#ifdef UML_CONFIG_MODE_TT
#include "sysdep/sc.h"
#endif
#ifdef UML_CONFIG_MODE_SKAS
#include "skas_ptregs.h"
#define REGS_IP(r) ((r)[HOST_IP])
......@@ -60,20 +49,11 @@ extern int sysemu_supported;
#define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r))
#endif
#ifndef PTRACE_SYSEMU_SINGLESTEP
#define PTRACE_SYSEMU_SINGLESTEP 32
#endif
union uml_pt_regs {
#ifdef UML_CONFIG_MODE_TT
struct tt_regs {
long syscall;
void *sc;
struct faultinfo faultinfo;
} tt;
#endif
#ifdef UML_CONFIG_MODE_SKAS
struct skas_regs {
unsigned long regs[MAX_REG_NR];
unsigned long fp[HOST_FP_SIZE];
......@@ -82,13 +62,10 @@ union uml_pt_regs {
long syscall;
int is_user;
} skas;
#endif
};
#define EMPTY_UML_PT_REGS { }
extern int mode_tt;
#define UPT_SC(r) ((r)->tt.sc)
#define UPT_IP(r) \
__CHOOSE_MODE(SC_IP(UPT_SC(r)), REGS_IP((r)->skas.regs))
......
......@@ -30,11 +30,7 @@
#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14)
/* SKAS3 has no trap_no on i386, but get_skas_faultinfo() sets it to 0. */
#ifdef UML_CONFIG_MODE_SKAS
#define SEGV_MAYBE_FIXABLE(fi) ((fi)->trap_no == 0 && ptrace_faultinfo)
#else
#define SEGV_MAYBE_FIXABLE(fi) 0
#endif
extern unsigned long *sc_sigmask(void *sc_ptr);
extern int sc_get_fpregs(unsigned long buf, void *sc_ptr);
......
......@@ -4,8 +4,5 @@
#include <kern_constants.h>
#define TASK_DEBUGREGS(task) ((unsigned long *) &(((char *) (task))[HOST_TASK_DEBUGREGS]))
#ifdef UML_CONFIG_MODE_TT
#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[HOST_TASK_EXTERN_PID]))
#endif
#endif
/*
* Copyright 2003 PathScale, Inc.
* Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
*
* Licensed under the GPL
*/
......@@ -14,11 +15,6 @@
#define MAX_REG_OFFSET (UM_FRAME_SIZE)
#define MAX_REG_NR ((MAX_REG_OFFSET) / sizeof(unsigned long))
#ifdef UML_CONFIG_MODE_TT
#include "sysdep/sc.h"
#endif
#ifdef UML_CONFIG_MODE_SKAS
#include "skas_ptregs.h"
#define REGS_IP(r) ((r)[HOST_IP])
......@@ -88,21 +84,10 @@
#define REGS_ERR(r) ((r)->fault_type)
#endif
#include "choose-mode.h"
/* XXX */
union uml_pt_regs {
#ifdef UML_CONFIG_MODE_TT
struct tt_regs {
long syscall;
unsigned long orig_rax;
void *sc;
struct faultinfo faultinfo;
} tt;
#endif
#ifdef UML_CONFIG_MODE_SKAS
struct skas_regs {
unsigned long regs[MAX_REG_NR];
unsigned long fp[HOST_FP_SIZE];
......@@ -110,14 +95,10 @@ union uml_pt_regs {
long syscall;
int is_user;
} skas;
#endif
};
#define EMPTY_UML_PT_REGS { }
/* XXX */
extern int mode_tt;
#define UPT_RBX(r) __CHOOSE_MODE(SC_RBX(UPT_SC(r)), REGS_RBX((r)->skas.regs))
#define UPT_RCX(r) __CHOOSE_MODE(SC_RCX(UPT_SC(r)), REGS_RCX((r)->skas.regs))
#define UPT_RDX(r) __CHOOSE_MODE(SC_RDX(UPT_SC(r)), REGS_RDX((r)->skas.regs))
......
......@@ -3,8 +3,4 @@
#include <kern_constants.h>
#ifdef UML_CONFIG_MODE_TT
#define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[HOST_TASK_EXTERN_PID]))
#endif
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment