aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/defconfig
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2005-07-07 20:56:49 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-07 21:23:44 -0400
commitd67b569f5f620c0fb95d5212642746b7ba9d29e4 (patch)
treec7ef10c906dd83911e10988c6cea6d7d5644e072 /arch/um/defconfig
parent1322ad41513f8f9196801f53cc0851df056f3478 (diff)
[PATCH] uml: skas0 - separate kernel address space on stock hosts
UML has had two modes of operation - an insecure, slow mode (tt mode) in which the kernel is mapped into every process address space which requires no host kernel modifications, and a secure, faster mode (skas mode) in which the UML kernel is in a separate host address space, which requires a patch to the host kernel. This patch implements something very close to skas mode for hosts which don't support skas - I'm calling this skas0. It provides the security of the skas host patch, and some of the performance gains. The two main things that are provided by the skas patch, /proc/mm and PTRACE_FAULTINFO, are implemented in a way that require no host patch. For the remote address space changing stuff (mmap, munmap, and mprotect), we set aside two pages in the process above its stack, one of which contains a little bit of code which can call mmap et al. To update the address space, the system call information (system call number and arguments) are written to the stub page above the code. The %esp is set to the beginning of the data, the %eip is set the the start of the stub, and it repeatedly pops the information into its registers and makes the system call until it sees a system call number of zero. This is to amortize the cost of the context switch across multiple address space updates. When the updates are done, it SIGSTOPs itself, and the kernel process continues what it was doing. For a PTRACE_FAULTINFO replacement, we set up a SIGSEGV handler in the child, and let it handle segfaults rather than nullifying them. The handler is in the same page as the mmap stub. The second page is used as the stack. The handler reads cr2 and err from the sigcontext, sticks them at the base of the stack in a faultinfo struct, and SIGSTOPs itself. The kernel then reads the faultinfo and handles the fault. A complication on x86_64 is that this involves resetting the registers to the segfault values when the process is inside the kill system call. This breaks on x86_64 because %rcx will contain %rip because you tell SYSRET where to return to by putting the value in %rcx. So, this corrupts $rcx on return from the segfault. To work around this, I added an arch_finish_segv, which on x86 does nothing, but which on x86_64 ptraces the child back through the sigreturn. This causes %rcx to be restored by sigreturn and avoids the corruption. Ultimately, I think I will replace this with the trick of having it send itself a blocked signal which will be unblocked by the sigreturn. This will allow it to be stopped just after the sigreturn, and PTRACE_SYSCALLed without all the back-and-forth of PTRACE_SYSCALLing it through sigreturn. This runs on a stock host, so theoretically (and hopefully), tt mode isn't needed any more. We need to make sure that this is better in every way than tt mode, though. I'm concerned about the speed of address space updates and page fault handling, since they involve extra round-trips to the child. We can amortize the round-trip cost for large address space updates by writing all of the operations to the data page and having the child execute them all at the same time. This will help fork and exec, but not page faults, since they involve only one page. I can't think of any way to help page faults, except to add something like PTRACE_FAULTINFO to the host. There is PTRACE_SIGINFO, but UML doesn't use siginfo for SIGSEGV (or anything else) because there isn't enough information in the siginfo struct to handle page faults (the faulting operation type is missing). Adding that would make PTRACE_SIGINFO a usable equivalent to PTRACE_FAULTINFO. As for the code itself: - The system call stub is in arch/um/kernel/sys-$(SUBARCH)/stub.S. It is put in its own section of the binary along with stub_segv_handler in arch/um/kernel/skas/process.c. This is manipulated with run_syscall_stub in arch/um/kernel/skas/mem_user.c. syscall_stub will execute any system call at all, but it's only used for mmap, munmap, and mprotect. - The x86_64 stub calls sigreturn by hand rather than allowing the normal sigreturn to happen, because the normal sigreturn is a SA_RESTORER in UML's address space provided by libc. Needless to say, this is not available in the child's address space. Also, it does a couple of odd pops before that which restore the stack to the state it was in at the time the signal handler was called. - There is a new field in the arch mmu_context, which is now a union. This is the pid to be manipulated rather than the /proc/mm file descriptor. Code which deals with this now checks proc_mm to see whether it should use the usual skas code or the new code. - userspace_tramp is now used to create a new host process for every UML process, rather than one per UML processor. It checks proc_mm and ptrace_faultinfo to decide whether to map in the pages above its stack. - start_userspace now makes CLONE_VM conditional on proc_mm since we need separate address spaces now. - switch_mm_skas now just sets userspace_pid[0] to the new pid rather than PTRACE_SWITCH_MM. There is an addition to userspace which updates its idea of the pid being manipulated each time around the loop. This is important on exec, when the pid will change underneath userspace(). - The stub page has a pte, but it can't be mapped in using tlb_flush because it is part of tlb_flush. This is why it's required for it to be mapped in by userspace_tramp. Other random things: - The stub section in uml.lds.S is page aligned. This page is written out to the backing vm file in setup_physmem because it is mapped from there into user processes. - There's some confusion with TASK_SIZE now that there are a couple of extra pages that the process can't use. TASK_SIZE is considered by the elf code to be the usable process memory, which is reasonable, so it is decreased by two pages. This confuses the definition of USER_PGDS_IN_LAST_PML4, making it too small because of the rounding down of the uneven division. So we round it to the nearest PGDIR_SIZE rather than the lower one. - I added a missing PT_SYSCALL_ARG6_OFFSET macro. - um_mmu.h was made into a userspace-usable file. - proc_mm and ptrace_faultinfo are globals which say whether the host supports these features. - There is a bad interaction between the mm.nr_ptes check at the end of exit_mmap, stack randomization, and skas0. exit_mmap will stop freeing pages at the PGDIR_SIZE boundary after the last vma. If the stack isn't on the last page table page, the last pte page won't be freed, as it should be since the stub ptes are there, and exit_mmap will BUG because there is an unfreed page. To get around this, TASK_SIZE is set to the next lowest PGDIR_SIZE boundary and mm->nr_ptes is decremented after the calls to init_stub_pte. This ensures that we know the process stack (and all other process mappings) will be below the top page table page, and thus we know that mm->nr_ptes will be one too many, and can be decremented. Things that need fixing: - We may need better assurrences that the stub code is PIC. - The stub pte is set up in init_new_context_skas. - alloc_pgdir is probably the right place. Signed-off-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/defconfig')
-rw-r--r--arch/um/defconfig58
1 files changed, 50 insertions, 8 deletions
diff --git a/arch/um/defconfig b/arch/um/defconfig
index 4067c3aa5b60..80d30d19d750 100644
--- a/arch/um/defconfig
+++ b/arch/um/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc3-skas3-v9-pre2 3# Linux kernel version: 2.6.12-rc6-mm1
4# Sun Apr 24 19:46:10 2005 4# Tue Jun 14 18:22:21 2005
5# 5#
6CONFIG_GENERIC_HARDIRQS=y 6CONFIG_GENERIC_HARDIRQS=y
7CONFIG_UML=y 7CONFIG_UML=y
@@ -13,23 +13,32 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y
13# 13#
14# UML-specific options 14# UML-specific options
15# 15#
16CONFIG_MODE_TT=y 16# CONFIG_MODE_TT is not set
17# CONFIG_STATIC_LINK is not set
17CONFIG_MODE_SKAS=y 18CONFIG_MODE_SKAS=y
18CONFIG_UML_X86=y 19CONFIG_UML_X86=y
19# CONFIG_64BIT is not set 20# CONFIG_64BIT is not set
20CONFIG_TOP_ADDR=0xc0000000 21CONFIG_TOP_ADDR=0xc0000000
21# CONFIG_3_LEVEL_PGTABLES is not set 22# CONFIG_3_LEVEL_PGTABLES is not set
23CONFIG_STUB_CODE=0xbfffe000
24CONFIG_STUB_DATA=0xbffff000
25CONFIG_STUB_START=0xbfffe000
22CONFIG_ARCH_HAS_SC_SIGNALS=y 26CONFIG_ARCH_HAS_SC_SIGNALS=y
23CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y 27CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y
24CONFIG_LD_SCRIPT_STATIC=y 28CONFIG_SELECT_MEMORY_MODEL=y
29CONFIG_FLATMEM_MANUAL=y
30# CONFIG_DISCONTIGMEM_MANUAL is not set
31# CONFIG_SPARSEMEM_MANUAL is not set
32CONFIG_FLATMEM=y
33CONFIG_FLAT_NODE_MEM_MAP=y
34CONFIG_LD_SCRIPT_DYN=y
25CONFIG_NET=y 35CONFIG_NET=y
26CONFIG_BINFMT_ELF=y 36CONFIG_BINFMT_ELF=y
27CONFIG_BINFMT_MISC=m 37CONFIG_BINFMT_MISC=m
28CONFIG_HOSTFS=y 38# CONFIG_HOSTFS is not set
29CONFIG_MCONSOLE=y 39CONFIG_MCONSOLE=y
30# CONFIG_MAGIC_SYSRQ is not set 40# CONFIG_MAGIC_SYSRQ is not set
31# CONFIG_HOST_2G_2G is not set 41# CONFIG_HOST_2G_2G is not set
32# CONFIG_SMP is not set
33CONFIG_NEST_LEVEL=0 42CONFIG_NEST_LEVEL=0
34CONFIG_KERNEL_HALF_GIGS=1 43CONFIG_KERNEL_HALF_GIGS=1
35# CONFIG_HIGHMEM is not set 44# CONFIG_HIGHMEM is not set
@@ -63,6 +72,8 @@ CONFIG_IKCONFIG_PROC=y
63CONFIG_KALLSYMS=y 72CONFIG_KALLSYMS=y
64# CONFIG_KALLSYMS_ALL is not set 73# CONFIG_KALLSYMS_ALL is not set
65CONFIG_KALLSYMS_EXTRA_PASS=y 74CONFIG_KALLSYMS_EXTRA_PASS=y
75CONFIG_PRINTK=y
76CONFIG_BUG=y
66CONFIG_BASE_FULL=y 77CONFIG_BASE_FULL=y
67CONFIG_FUTEX=y 78CONFIG_FUTEX=y
68CONFIG_EPOLL=y 79CONFIG_EPOLL=y
@@ -81,6 +92,7 @@ CONFIG_MODULES=y
81CONFIG_MODULE_UNLOAD=y 92CONFIG_MODULE_UNLOAD=y
82# CONFIG_MODULE_FORCE_UNLOAD is not set 93# CONFIG_MODULE_FORCE_UNLOAD is not set
83CONFIG_OBSOLETE_MODPARM=y 94CONFIG_OBSOLETE_MODPARM=y
95# CONFIG_MODVERSIONS is not set
84# CONFIG_MODULE_SRCVERSION_ALL is not set 96# CONFIG_MODULE_SRCVERSION_ALL is not set
85CONFIG_KMOD=y 97CONFIG_KMOD=y
86 98
@@ -115,6 +127,7 @@ CONFIG_UML_SOUND=m
115CONFIG_SOUND=m 127CONFIG_SOUND=m
116CONFIG_HOSTAUDIO=m 128CONFIG_HOSTAUDIO=m
117CONFIG_UML_RANDOM=y 129CONFIG_UML_RANDOM=y
130# CONFIG_MMAPPER is not set
118 131
119# 132#
120# Block devices 133# Block devices
@@ -176,6 +189,17 @@ CONFIG_INET=y
176# CONFIG_INET_TUNNEL is not set 189# CONFIG_INET_TUNNEL is not set
177CONFIG_IP_TCPDIAG=y 190CONFIG_IP_TCPDIAG=y
178# CONFIG_IP_TCPDIAG_IPV6 is not set 191# CONFIG_IP_TCPDIAG_IPV6 is not set
192
193#
194# TCP congestion control
195#
196CONFIG_TCP_CONG_BIC=y
197CONFIG_TCP_CONG_WESTWOOD=y
198CONFIG_TCP_CONG_HTCP=y
199# CONFIG_TCP_CONG_HSTCP is not set
200# CONFIG_TCP_CONG_HYBLA is not set
201# CONFIG_TCP_CONG_VEGAS is not set
202# CONFIG_TCP_CONG_SCALABLE is not set
179# CONFIG_IPV6 is not set 203# CONFIG_IPV6 is not set
180# CONFIG_NETFILTER is not set 204# CONFIG_NETFILTER is not set
181 205
@@ -206,11 +230,15 @@ CONFIG_IP_TCPDIAG=y
206# Network testing 230# Network testing
207# 231#
208# CONFIG_NET_PKTGEN is not set 232# CONFIG_NET_PKTGEN is not set
233# CONFIG_KGDBOE is not set
209# CONFIG_NETPOLL is not set 234# CONFIG_NETPOLL is not set
235# CONFIG_NETPOLL_RX is not set
236# CONFIG_NETPOLL_TRAP is not set
210# CONFIG_NET_POLL_CONTROLLER is not set 237# CONFIG_NET_POLL_CONTROLLER is not set
211# CONFIG_HAMRADIO is not set 238# CONFIG_HAMRADIO is not set
212# CONFIG_IRDA is not set 239# CONFIG_IRDA is not set
213# CONFIG_BT is not set 240# CONFIG_BT is not set
241# CONFIG_IEEE80211 is not set
214CONFIG_DUMMY=m 242CONFIG_DUMMY=m
215# CONFIG_BONDING is not set 243# CONFIG_BONDING is not set
216# CONFIG_EQUALIZER is not set 244# CONFIG_EQUALIZER is not set
@@ -227,6 +255,7 @@ CONFIG_PPP=m
227# CONFIG_PPP_SYNC_TTY is not set 255# CONFIG_PPP_SYNC_TTY is not set
228# CONFIG_PPP_DEFLATE is not set 256# CONFIG_PPP_DEFLATE is not set
229# CONFIG_PPP_BSDCOMP is not set 257# CONFIG_PPP_BSDCOMP is not set
258# CONFIG_PPP_MPPE is not set
230# CONFIG_PPPOE is not set 259# CONFIG_PPPOE is not set
231CONFIG_SLIP=m 260CONFIG_SLIP=m
232# CONFIG_SLIP_COMPRESSED is not set 261# CONFIG_SLIP_COMPRESSED is not set
@@ -240,10 +269,12 @@ CONFIG_SLIP=m
240# 269#
241CONFIG_EXT2_FS=y 270CONFIG_EXT2_FS=y
242# CONFIG_EXT2_FS_XATTR is not set 271# CONFIG_EXT2_FS_XATTR is not set
272# CONFIG_EXT2_FS_XIP is not set
243CONFIG_EXT3_FS=y 273CONFIG_EXT3_FS=y
244# CONFIG_EXT3_FS_XATTR is not set 274# CONFIG_EXT3_FS_XATTR is not set
245CONFIG_JBD=y 275CONFIG_JBD=y
246# CONFIG_JBD_DEBUG is not set 276# CONFIG_JBD_DEBUG is not set
277# CONFIG_REISER4_FS is not set
247CONFIG_REISERFS_FS=y 278CONFIG_REISERFS_FS=y
248# CONFIG_REISERFS_CHECK is not set 279# CONFIG_REISERFS_CHECK is not set
249# CONFIG_REISERFS_PROC_INFO is not set 280# CONFIG_REISERFS_PROC_INFO is not set
@@ -256,6 +287,7 @@ CONFIG_REISERFS_FS=y
256# CONFIG_XFS_FS is not set 287# CONFIG_XFS_FS is not set
257# CONFIG_MINIX_FS is not set 288# CONFIG_MINIX_FS is not set
258# CONFIG_ROMFS_FS is not set 289# CONFIG_ROMFS_FS is not set
290CONFIG_INOTIFY=y
259CONFIG_QUOTA=y 291CONFIG_QUOTA=y
260# CONFIG_QFMT_V1 is not set 292# CONFIG_QFMT_V1 is not set
261# CONFIG_QFMT_V2 is not set 293# CONFIG_QFMT_V2 is not set
@@ -265,6 +297,12 @@ CONFIG_AUTOFS_FS=m
265CONFIG_AUTOFS4_FS=m 297CONFIG_AUTOFS4_FS=m
266 298
267# 299#
300# Caches
301#
302# CONFIG_FSCACHE is not set
303# CONFIG_FUSE_FS is not set
304
305#
268# CD-ROM/DVD Filesystems 306# CD-ROM/DVD Filesystems
269# 307#
270CONFIG_ISO9660_FS=m 308CONFIG_ISO9660_FS=m
@@ -291,6 +329,8 @@ CONFIG_TMPFS=y
291# CONFIG_TMPFS_XATTR is not set 329# CONFIG_TMPFS_XATTR is not set
292# CONFIG_HUGETLB_PAGE is not set 330# CONFIG_HUGETLB_PAGE is not set
293CONFIG_RAMFS=y 331CONFIG_RAMFS=y
332# CONFIG_CONFIGFS_FS is not set
333# CONFIG_RELAYFS_FS is not set
294 334
295# 335#
296# Miscellaneous filesystems 336# Miscellaneous filesystems
@@ -319,6 +359,7 @@ CONFIG_RAMFS=y
319# CONFIG_NCP_FS is not set 359# CONFIG_NCP_FS is not set
320# CONFIG_CODA_FS is not set 360# CONFIG_CODA_FS is not set
321# CONFIG_AFS_FS is not set 361# CONFIG_AFS_FS is not set
362# CONFIG_9P_FS is not set
322 363
323# 364#
324# Partition Types 365# Partition Types
@@ -404,14 +445,15 @@ CONFIG_CRC32=m
404# CONFIG_PRINTK_TIME is not set 445# CONFIG_PRINTK_TIME is not set
405CONFIG_DEBUG_KERNEL=y 446CONFIG_DEBUG_KERNEL=y
406CONFIG_LOG_BUF_SHIFT=14 447CONFIG_LOG_BUF_SHIFT=14
448CONFIG_DETECT_SOFTLOCKUP=y
407# CONFIG_SCHEDSTATS is not set 449# CONFIG_SCHEDSTATS is not set
408# CONFIG_DEBUG_SLAB is not set 450CONFIG_DEBUG_SLAB=y
409# CONFIG_DEBUG_SPINLOCK is not set 451# CONFIG_DEBUG_SPINLOCK is not set
410# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 452# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
411# CONFIG_DEBUG_KOBJECT is not set 453# CONFIG_DEBUG_KOBJECT is not set
412CONFIG_DEBUG_INFO=y 454CONFIG_DEBUG_INFO=y
413# CONFIG_DEBUG_FS is not set 455# CONFIG_DEBUG_FS is not set
414CONFIG_FRAME_POINTER=y 456CONFIG_FRAME_POINTER=y
415CONFIG_PT_PROXY=y 457# CONFIG_GPROF is not set
416# CONFIG_GCOV is not set 458# CONFIG_GCOV is not set
417# CONFIG_SYSCALL_DEBUG is not set 459# CONFIG_SYSCALL_DEBUG is not set