Skip to content

Commit

Permalink
uml: throw out CONFIG_MODE_TT
Browse files Browse the repository at this point in the history
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: Jeff Dike <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
cfd-36 authored and Linus Torvalds committed Oct 16, 2007
1 parent a1ff587 commit 42fda66
Show file tree
Hide file tree
Showing 87 changed files with 34 additions and 4,203 deletions.
64 changes: 10 additions & 54 deletions arch/um/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -62,63 +62,24 @@ 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"

config LD_SCRIPT_STATIC
bool
default y
depends on MODE_TT || STATIC_LINK
depends on STATIC_LINK

config LD_SCRIPT_DYN
bool
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down
2 changes: 0 additions & 2 deletions arch/um/Kconfig.char
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 2 additions & 21 deletions arch/um/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
24 changes: 5 additions & 19 deletions arch/um/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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),)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -124,19 +114,15 @@ 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)) ] )

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
Expand Down
6 changes: 1 addition & 5 deletions arch/um/Makefile-i386
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions arch/um/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 1 addition & 14 deletions arch/um/drivers/mconsole_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion arch/um/include/as-layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);

Expand Down
18 changes: 0 additions & 18 deletions arch/um/include/choose-mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
3 changes: 0 additions & 3 deletions arch/um/include/common-offsets.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/* 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);
Expand Down
4 changes: 0 additions & 4 deletions arch/um/include/irq_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 0 additions & 6 deletions arch/um/include/kern_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
19 changes: 0 additions & 19 deletions arch/um/include/mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 0 additions & 6 deletions arch/um/include/mode_kern.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit 42fda66

Please sign in to comment.