diff options
author | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-06-10 14:47:26 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-06-10 14:47:26 -0400 |
commit | f0cd91a68acdc9b49d7f6738b514a426da627649 (patch) | |
tree | 8ad73564015794197583b094217ae0a71e71e753 /arch/um | |
parent | 60eef25701d25e99c991dd0f4a9f3832a0c3ad3e (diff) | |
parent | 128e6ced247cda88f96fa9f2e4ba8b2c4a681560 (diff) |
Merge ../linux-2.6
Diffstat (limited to 'arch/um')
38 files changed, 549 insertions, 313 deletions
diff --git a/arch/um/Kconfig b/arch/um/Kconfig index 05fbb20636cb..76e85bbaea55 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig | |||
@@ -57,20 +57,6 @@ config STATIC_LINK | |||
57 | chroot, and you disable CONFIG_MODE_TT, you probably want to say Y | 57 | chroot, and you disable CONFIG_MODE_TT, you probably want to say Y |
58 | here. | 58 | here. |
59 | 59 | ||
60 | config HOST_2G_2G | ||
61 | bool "2G/2G host address space split" | ||
62 | default n | ||
63 | depends on MODE_TT | ||
64 | help | ||
65 | This is needed when the host on which you run has a 2G/2G memory | ||
66 | split, instead of the customary 3G/1G. | ||
67 | |||
68 | Note that to enable such a host | ||
69 | configuration, which makes sense only in some cases, you need special | ||
70 | host patches. | ||
71 | |||
72 | So, if you do not know what to do here, say 'N'. | ||
73 | |||
74 | config KERNEL_HALF_GIGS | 60 | config KERNEL_HALF_GIGS |
75 | int "Kernel address space size (in .5G units)" | 61 | int "Kernel address space size (in .5G units)" |
76 | default "1" | 62 | default "1" |
diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386 index 85e6a55b3b59..f6eb72d117b9 100644 --- a/arch/um/Kconfig.i386 +++ b/arch/um/Kconfig.i386 | |||
@@ -16,6 +16,19 @@ config SEMAPHORE_SLEEPERS | |||
16 | bool | 16 | bool |
17 | default y | 17 | default y |
18 | 18 | ||
19 | config HOST_2G_2G | ||
20 | bool "2G/2G host address space split" | ||
21 | default n | ||
22 | help | ||
23 | This is needed when the host on which you run has a 2G/2G memory | ||
24 | split, instead of the customary 3G/1G. | ||
25 | |||
26 | Note that to enable such a host | ||
27 | configuration, which makes sense only in some cases, you need special | ||
28 | host patches. | ||
29 | |||
30 | So, if you do not know what to do here, say 'N'. | ||
31 | |||
19 | config TOP_ADDR | 32 | config TOP_ADDR |
20 | hex | 33 | hex |
21 | default 0xc0000000 if !HOST_2G_2G | 34 | default 0xc0000000 if !HOST_2G_2G |
@@ -35,11 +48,13 @@ config 3_LEVEL_PGTABLES | |||
35 | 48 | ||
36 | config STUB_CODE | 49 | config STUB_CODE |
37 | hex | 50 | hex |
38 | default 0xbfffe000 | 51 | default 0xbfffe000 if !HOST_2G_2G |
52 | default 0x7fffe000 if HOST_2G_2G | ||
39 | 53 | ||
40 | config STUB_DATA | 54 | config STUB_DATA |
41 | hex | 55 | hex |
42 | default 0xbffff000 | 56 | default 0xbffff000 if !HOST_2G_2G |
57 | default 0x7ffff000 if HOST_2G_2G | ||
43 | 58 | ||
44 | config STUB_START | 59 | config STUB_START |
45 | hex | 60 | hex |
diff --git a/arch/um/Makefile b/arch/um/Makefile index a508e7a02891..f6ad832faf13 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile | |||
@@ -96,7 +96,8 @@ PHONY += linux | |||
96 | all: linux | 96 | all: linux |
97 | 97 | ||
98 | linux: vmlinux | 98 | linux: vmlinux |
99 | ln -f $< $@ | 99 | @echo ' LINK $@' |
100 | $(Q)ln -f $< $@ | ||
100 | 101 | ||
101 | define archhelp | 102 | define archhelp |
102 | echo '* linux - Binary kernel image (./linux) - for backward' | 103 | echo '* linux - Binary kernel image (./linux) - for backward' |
@@ -117,6 +118,10 @@ prepare: $(ARCH_DIR)/include/kern_constants.h | |||
117 | LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static | 118 | LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static |
118 | LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib | 119 | LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib |
119 | 120 | ||
121 | CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \ | ||
122 | $(call cc-option, -fno-stack-protector,) \ | ||
123 | $(call cc-option, -fno-stack-protector-all,) | ||
124 | |||
120 | CPP_MODE-$(CONFIG_MODE_TT) := -DMODE_TT | 125 | CPP_MODE-$(CONFIG_MODE_TT) := -DMODE_TT |
121 | CONFIG_KERNEL_STACK_ORDER ?= 2 | 126 | CONFIG_KERNEL_STACK_ORDER ?= 2 |
122 | STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] ) | 127 | STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] ) |
@@ -203,8 +208,8 @@ endef | |||
203 | $(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h | 208 | $(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h |
204 | $(call filechk,umlconfig) | 209 | $(call filechk,umlconfig) |
205 | 210 | ||
206 | $(ARCH_DIR)/user-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.c | 211 | $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s: FORCE |
207 | $(CC) $(USER_CFLAGS) -S -o $@ $< | 212 | $(Q)$(MAKE) $(build)=$(ARCH_DIR)/sys-$(SUBARCH) $@ |
208 | 213 | ||
209 | define filechk_gen-asm-offsets | 214 | define filechk_gen-asm-offsets |
210 | (set -e; \ | 215 | (set -e; \ |
@@ -219,13 +224,11 @@ define filechk_gen-asm-offsets | |||
219 | echo ""; ) | 224 | echo ""; ) |
220 | endef | 225 | endef |
221 | 226 | ||
222 | $(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/user-offsets.s | 227 | $(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s |
223 | $(call filechk,gen-asm-offsets) | 228 | $(call filechk,gen-asm-offsets) |
224 | 229 | ||
225 | CLEAN_FILES += $(ARCH_DIR)/user-offsets.s | ||
226 | |||
227 | $(ARCH_DIR)/include/kern_constants.h: $(objtree)/$(ARCH_DIR)/include | 230 | $(ARCH_DIR)/include/kern_constants.h: $(objtree)/$(ARCH_DIR)/include |
228 | @echo ' SYMLINK $@' | 231 | @echo ' SYMLINK $@' |
229 | $(Q) ln -sf ../../../include/asm-um/asm-offsets.h $@ | 232 | $(Q)ln -sf ../../../include/asm-um/asm-offsets.h $@ |
230 | 233 | ||
231 | export SUBARCH USER_CFLAGS OS | 234 | export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS |
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386 index 7a0e04e34bf9..b65ca115ef77 100644 --- a/arch/um/Makefile-i386 +++ b/arch/um/Makefile-i386 | |||
@@ -33,5 +33,9 @@ include $(srctree)/arch/i386/Makefile.cpu | |||
33 | # prevent gcc from keeping the stack 16 byte aligned. Taken from i386. | 33 | # prevent gcc from keeping the stack 16 byte aligned. Taken from i386. |
34 | cflags-y += $(call cc-option,-mpreferred-stack-boundary=2) | 34 | cflags-y += $(call cc-option,-mpreferred-stack-boundary=2) |
35 | 35 | ||
36 | # Prevent sprintf in nfsd from being converted to strcpy and resulting in | ||
37 | # an unresolved reference. | ||
38 | cflags-y += -ffreestanding | ||
39 | |||
36 | CFLAGS += $(cflags-y) | 40 | CFLAGS += $(cflags-y) |
37 | USER_CFLAGS += $(cflags-y) | 41 | USER_CFLAGS += $(cflags-y) |
diff --git a/arch/um/defconfig b/arch/um/defconfig index 80d30d19d750..402a74dc5026 100644 --- a/arch/um/defconfig +++ b/arch/um/defconfig | |||
@@ -1,14 +1,13 @@ | |||
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-rc6-mm1 | 3 | # Linux kernel version: 2.6.17-rc3 |
4 | # Tue Jun 14 18:22:21 2005 | 4 | # Fri Apr 28 09:31:20 2006 |
5 | # | 5 | # |
6 | CONFIG_GENERIC_HARDIRQS=y | 6 | CONFIG_GENERIC_HARDIRQS=y |
7 | CONFIG_UML=y | 7 | CONFIG_UML=y |
8 | CONFIG_MMU=y | 8 | CONFIG_MMU=y |
9 | CONFIG_UID16=y | ||
10 | CONFIG_RWSEM_GENERIC_SPINLOCK=y | ||
11 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 9 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
10 | CONFIG_IRQ_RELEASE_METHOD=y | ||
12 | 11 | ||
13 | # | 12 | # |
14 | # UML-specific options | 13 | # UML-specific options |
@@ -16,8 +15,50 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y | |||
16 | # CONFIG_MODE_TT is not set | 15 | # CONFIG_MODE_TT is not set |
17 | # CONFIG_STATIC_LINK is not set | 16 | # CONFIG_STATIC_LINK is not set |
18 | CONFIG_MODE_SKAS=y | 17 | CONFIG_MODE_SKAS=y |
18 | |||
19 | # | ||
20 | # Host processor type and features | ||
21 | # | ||
22 | # CONFIG_M386 is not set | ||
23 | # CONFIG_M486 is not set | ||
24 | # CONFIG_M586 is not set | ||
25 | # CONFIG_M586TSC is not set | ||
26 | # CONFIG_M586MMX is not set | ||
27 | CONFIG_M686=y | ||
28 | # CONFIG_MPENTIUMII is not set | ||
29 | # CONFIG_MPENTIUMIII is not set | ||
30 | # CONFIG_MPENTIUMM is not set | ||
31 | # CONFIG_MPENTIUM4 is not set | ||
32 | # CONFIG_MK6 is not set | ||
33 | # CONFIG_MK7 is not set | ||
34 | # CONFIG_MK8 is not set | ||
35 | # CONFIG_MCRUSOE is not set | ||
36 | # CONFIG_MEFFICEON is not set | ||
37 | # CONFIG_MWINCHIPC6 is not set | ||
38 | # CONFIG_MWINCHIP2 is not set | ||
39 | # CONFIG_MWINCHIP3D is not set | ||
40 | # CONFIG_MGEODEGX1 is not set | ||
41 | # CONFIG_MGEODE_LX is not set | ||
42 | # CONFIG_MCYRIXIII is not set | ||
43 | # CONFIG_MVIAC3_2 is not set | ||
44 | # CONFIG_X86_GENERIC is not set | ||
45 | CONFIG_X86_CMPXCHG=y | ||
46 | CONFIG_X86_XADD=y | ||
47 | CONFIG_X86_L1_CACHE_SHIFT=5 | ||
48 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | ||
49 | CONFIG_X86_PPRO_FENCE=y | ||
50 | CONFIG_X86_WP_WORKS_OK=y | ||
51 | CONFIG_X86_INVLPG=y | ||
52 | CONFIG_X86_BSWAP=y | ||
53 | CONFIG_X86_POPAD_OK=y | ||
54 | CONFIG_X86_CMPXCHG64=y | ||
55 | CONFIG_X86_GOOD_APIC=y | ||
56 | CONFIG_X86_USE_PPRO_CHECKSUM=y | ||
57 | CONFIG_X86_TSC=y | ||
19 | CONFIG_UML_X86=y | 58 | CONFIG_UML_X86=y |
20 | # CONFIG_64BIT is not set | 59 | # CONFIG_64BIT is not set |
60 | CONFIG_SEMAPHORE_SLEEPERS=y | ||
61 | # CONFIG_HOST_2G_2G is not set | ||
21 | CONFIG_TOP_ADDR=0xc0000000 | 62 | CONFIG_TOP_ADDR=0xc0000000 |
22 | # CONFIG_3_LEVEL_PGTABLES is not set | 63 | # CONFIG_3_LEVEL_PGTABLES is not set |
23 | CONFIG_STUB_CODE=0xbfffe000 | 64 | CONFIG_STUB_CODE=0xbfffe000 |
@@ -25,22 +66,24 @@ CONFIG_STUB_DATA=0xbffff000 | |||
25 | CONFIG_STUB_START=0xbfffe000 | 66 | CONFIG_STUB_START=0xbfffe000 |
26 | CONFIG_ARCH_HAS_SC_SIGNALS=y | 67 | CONFIG_ARCH_HAS_SC_SIGNALS=y |
27 | CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y | 68 | CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y |
69 | CONFIG_GENERIC_HWEIGHT=y | ||
28 | CONFIG_SELECT_MEMORY_MODEL=y | 70 | CONFIG_SELECT_MEMORY_MODEL=y |
29 | CONFIG_FLATMEM_MANUAL=y | 71 | CONFIG_FLATMEM_MANUAL=y |
30 | # CONFIG_DISCONTIGMEM_MANUAL is not set | 72 | # CONFIG_DISCONTIGMEM_MANUAL is not set |
31 | # CONFIG_SPARSEMEM_MANUAL is not set | 73 | # CONFIG_SPARSEMEM_MANUAL is not set |
32 | CONFIG_FLATMEM=y | 74 | CONFIG_FLATMEM=y |
33 | CONFIG_FLAT_NODE_MEM_MAP=y | 75 | CONFIG_FLAT_NODE_MEM_MAP=y |
76 | # CONFIG_SPARSEMEM_STATIC is not set | ||
77 | CONFIG_SPLIT_PTLOCK_CPUS=4 | ||
34 | CONFIG_LD_SCRIPT_DYN=y | 78 | CONFIG_LD_SCRIPT_DYN=y |
35 | CONFIG_NET=y | 79 | CONFIG_NET=y |
36 | CONFIG_BINFMT_ELF=y | 80 | CONFIG_BINFMT_ELF=y |
37 | CONFIG_BINFMT_MISC=m | 81 | CONFIG_BINFMT_MISC=m |
38 | # CONFIG_HOSTFS is not set | 82 | # CONFIG_HOSTFS is not set |
83 | # CONFIG_HPPFS is not set | ||
39 | CONFIG_MCONSOLE=y | 84 | CONFIG_MCONSOLE=y |
40 | # CONFIG_MAGIC_SYSRQ is not set | 85 | # CONFIG_MAGIC_SYSRQ is not set |
41 | # CONFIG_HOST_2G_2G is not set | ||
42 | CONFIG_NEST_LEVEL=0 | 86 | CONFIG_NEST_LEVEL=0 |
43 | CONFIG_KERNEL_HALF_GIGS=1 | ||
44 | # CONFIG_HIGHMEM is not set | 87 | # CONFIG_HIGHMEM is not set |
45 | CONFIG_KERNEL_STACK_ORDER=2 | 88 | CONFIG_KERNEL_STACK_ORDER=2 |
46 | CONFIG_UML_REAL_TIME_CLOCK=y | 89 | CONFIG_UML_REAL_TIME_CLOCK=y |
@@ -49,7 +92,6 @@ CONFIG_UML_REAL_TIME_CLOCK=y | |||
49 | # Code maturity level options | 92 | # Code maturity level options |
50 | # | 93 | # |
51 | CONFIG_EXPERIMENTAL=y | 94 | CONFIG_EXPERIMENTAL=y |
52 | CONFIG_CLEAN_COMPILE=y | ||
53 | CONFIG_BROKEN_ON_SMP=y | 95 | CONFIG_BROKEN_ON_SMP=y |
54 | CONFIG_INIT_ENV_ARG_LIMIT=32 | 96 | CONFIG_INIT_ENV_ARG_LIMIT=32 |
55 | 97 | ||
@@ -57,6 +99,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32 | |||
57 | # General setup | 99 | # General setup |
58 | # | 100 | # |
59 | CONFIG_LOCALVERSION="" | 101 | CONFIG_LOCALVERSION="" |
102 | CONFIG_LOCALVERSION_AUTO=y | ||
60 | CONFIG_SWAP=y | 103 | CONFIG_SWAP=y |
61 | CONFIG_SYSVIPC=y | 104 | CONFIG_SYSVIPC=y |
62 | CONFIG_POSIX_MQUEUE=y | 105 | CONFIG_POSIX_MQUEUE=y |
@@ -64,26 +107,28 @@ CONFIG_BSD_PROCESS_ACCT=y | |||
64 | # CONFIG_BSD_PROCESS_ACCT_V3 is not set | 107 | # CONFIG_BSD_PROCESS_ACCT_V3 is not set |
65 | CONFIG_SYSCTL=y | 108 | CONFIG_SYSCTL=y |
66 | # CONFIG_AUDIT is not set | 109 | # CONFIG_AUDIT is not set |
67 | # CONFIG_HOTPLUG is not set | ||
68 | CONFIG_KOBJECT_UEVENT=y | ||
69 | CONFIG_IKCONFIG=y | 110 | CONFIG_IKCONFIG=y |
70 | CONFIG_IKCONFIG_PROC=y | 111 | CONFIG_IKCONFIG_PROC=y |
112 | # CONFIG_RELAY is not set | ||
113 | CONFIG_INITRAMFS_SOURCE="" | ||
114 | CONFIG_UID16=y | ||
115 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | ||
71 | # CONFIG_EMBEDDED is not set | 116 | # CONFIG_EMBEDDED is not set |
72 | CONFIG_KALLSYMS=y | 117 | CONFIG_KALLSYMS=y |
73 | # CONFIG_KALLSYMS_ALL is not set | 118 | # CONFIG_KALLSYMS_ALL is not set |
74 | CONFIG_KALLSYMS_EXTRA_PASS=y | 119 | CONFIG_KALLSYMS_EXTRA_PASS=y |
120 | CONFIG_HOTPLUG=y | ||
75 | CONFIG_PRINTK=y | 121 | CONFIG_PRINTK=y |
76 | CONFIG_BUG=y | 122 | CONFIG_BUG=y |
123 | CONFIG_ELF_CORE=y | ||
77 | CONFIG_BASE_FULL=y | 124 | CONFIG_BASE_FULL=y |
78 | CONFIG_FUTEX=y | 125 | CONFIG_FUTEX=y |
79 | CONFIG_EPOLL=y | 126 | CONFIG_EPOLL=y |
80 | CONFIG_SHMEM=y | 127 | CONFIG_SHMEM=y |
81 | CONFIG_CC_ALIGN_FUNCTIONS=0 | 128 | CONFIG_SLAB=y |
82 | CONFIG_CC_ALIGN_LABELS=0 | ||
83 | CONFIG_CC_ALIGN_LOOPS=0 | ||
84 | CONFIG_CC_ALIGN_JUMPS=0 | ||
85 | # CONFIG_TINY_SHMEM is not set | 129 | # CONFIG_TINY_SHMEM is not set |
86 | CONFIG_BASE_SMALL=0 | 130 | CONFIG_BASE_SMALL=0 |
131 | # CONFIG_SLOB is not set | ||
87 | 132 | ||
88 | # | 133 | # |
89 | # Loadable module support | 134 | # Loadable module support |
@@ -91,18 +136,43 @@ CONFIG_BASE_SMALL=0 | |||
91 | CONFIG_MODULES=y | 136 | CONFIG_MODULES=y |
92 | CONFIG_MODULE_UNLOAD=y | 137 | CONFIG_MODULE_UNLOAD=y |
93 | # CONFIG_MODULE_FORCE_UNLOAD is not set | 138 | # CONFIG_MODULE_FORCE_UNLOAD is not set |
94 | CONFIG_OBSOLETE_MODPARM=y | ||
95 | # CONFIG_MODVERSIONS is not set | 139 | # CONFIG_MODVERSIONS is not set |
96 | # CONFIG_MODULE_SRCVERSION_ALL is not set | 140 | # CONFIG_MODULE_SRCVERSION_ALL is not set |
97 | CONFIG_KMOD=y | 141 | CONFIG_KMOD=y |
98 | 142 | ||
99 | # | 143 | # |
100 | # Generic Driver Options | 144 | # Block layer |
101 | # | 145 | # |
102 | CONFIG_STANDALONE=y | 146 | # CONFIG_LBD is not set |
103 | CONFIG_PREVENT_FIRMWARE_BUILD=y | 147 | # CONFIG_BLK_DEV_IO_TRACE is not set |
104 | # CONFIG_FW_LOADER is not set | 148 | # CONFIG_LSF is not set |
105 | # CONFIG_DEBUG_DRIVER is not set | 149 | |
150 | # | ||
151 | # IO Schedulers | ||
152 | # | ||
153 | CONFIG_IOSCHED_NOOP=y | ||
154 | CONFIG_IOSCHED_AS=y | ||
155 | CONFIG_IOSCHED_DEADLINE=y | ||
156 | CONFIG_IOSCHED_CFQ=y | ||
157 | CONFIG_DEFAULT_AS=y | ||
158 | # CONFIG_DEFAULT_DEADLINE is not set | ||
159 | # CONFIG_DEFAULT_CFQ is not set | ||
160 | # CONFIG_DEFAULT_NOOP is not set | ||
161 | CONFIG_DEFAULT_IOSCHED="anticipatory" | ||
162 | |||
163 | # | ||
164 | # Block devices | ||
165 | # | ||
166 | CONFIG_BLK_DEV_UBD=y | ||
167 | # CONFIG_BLK_DEV_UBD_SYNC is not set | ||
168 | CONFIG_BLK_DEV_COW_COMMON=y | ||
169 | # CONFIG_MMAPPER is not set | ||
170 | CONFIG_BLK_DEV_LOOP=m | ||
171 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set | ||
172 | CONFIG_BLK_DEV_NBD=m | ||
173 | # CONFIG_BLK_DEV_RAM is not set | ||
174 | # CONFIG_BLK_DEV_INITRD is not set | ||
175 | # CONFIG_ATA_OVER_ETH is not set | ||
106 | 176 | ||
107 | # | 177 | # |
108 | # Character Devices | 178 | # Character Devices |
@@ -127,50 +197,23 @@ CONFIG_UML_SOUND=m | |||
127 | CONFIG_SOUND=m | 197 | CONFIG_SOUND=m |
128 | CONFIG_HOSTAUDIO=m | 198 | CONFIG_HOSTAUDIO=m |
129 | CONFIG_UML_RANDOM=y | 199 | CONFIG_UML_RANDOM=y |
130 | # CONFIG_MMAPPER is not set | ||
131 | |||
132 | # | ||
133 | # Block devices | ||
134 | # | ||
135 | CONFIG_BLK_DEV_UBD=y | ||
136 | CONFIG_BLK_DEV_UBD_SYNC=y | ||
137 | CONFIG_BLK_DEV_COW_COMMON=y | ||
138 | CONFIG_BLK_DEV_LOOP=m | ||
139 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set | ||
140 | CONFIG_BLK_DEV_NBD=m | ||
141 | # CONFIG_BLK_DEV_RAM is not set | ||
142 | CONFIG_BLK_DEV_RAM_COUNT=16 | ||
143 | CONFIG_INITRAMFS_SOURCE="" | ||
144 | # CONFIG_LBD is not set | ||
145 | |||
146 | # | ||
147 | # IO Schedulers | ||
148 | # | ||
149 | CONFIG_IOSCHED_NOOP=y | ||
150 | CONFIG_IOSCHED_AS=y | ||
151 | CONFIG_IOSCHED_DEADLINE=y | ||
152 | CONFIG_IOSCHED_CFQ=y | ||
153 | # CONFIG_ATA_OVER_ETH is not set | ||
154 | CONFIG_NETDEVICES=y | ||
155 | 200 | ||
156 | # | 201 | # |
157 | # UML Network Devices | 202 | # Generic Driver Options |
158 | # | 203 | # |
159 | CONFIG_UML_NET=y | 204 | CONFIG_STANDALONE=y |
160 | CONFIG_UML_NET_ETHERTAP=y | 205 | CONFIG_PREVENT_FIRMWARE_BUILD=y |
161 | CONFIG_UML_NET_TUNTAP=y | 206 | # CONFIG_FW_LOADER is not set |
162 | CONFIG_UML_NET_SLIP=y | 207 | # CONFIG_DEBUG_DRIVER is not set |
163 | CONFIG_UML_NET_DAEMON=y | ||
164 | CONFIG_UML_NET_MCAST=y | ||
165 | CONFIG_UML_NET_SLIRP=y | ||
166 | 208 | ||
167 | # | 209 | # |
168 | # Networking support | 210 | # Networking |
169 | # | 211 | # |
170 | 212 | ||
171 | # | 213 | # |
172 | # Networking options | 214 | # Networking options |
173 | # | 215 | # |
216 | # CONFIG_NETDEBUG is not set | ||
174 | CONFIG_PACKET=y | 217 | CONFIG_PACKET=y |
175 | CONFIG_PACKET_MMAP=y | 218 | CONFIG_PACKET_MMAP=y |
176 | CONFIG_UNIX=y | 219 | CONFIG_UNIX=y |
@@ -178,6 +221,7 @@ CONFIG_UNIX=y | |||
178 | CONFIG_INET=y | 221 | CONFIG_INET=y |
179 | # CONFIG_IP_MULTICAST is not set | 222 | # CONFIG_IP_MULTICAST is not set |
180 | # CONFIG_IP_ADVANCED_ROUTER is not set | 223 | # CONFIG_IP_ADVANCED_ROUTER is not set |
224 | CONFIG_IP_FIB_HASH=y | ||
181 | # CONFIG_IP_PNP is not set | 225 | # CONFIG_IP_PNP is not set |
182 | # CONFIG_NET_IPIP is not set | 226 | # CONFIG_NET_IPIP is not set |
183 | # CONFIG_NET_IPGRE is not set | 227 | # CONFIG_NET_IPGRE is not set |
@@ -186,27 +230,31 @@ CONFIG_INET=y | |||
186 | # CONFIG_INET_AH is not set | 230 | # CONFIG_INET_AH is not set |
187 | # CONFIG_INET_ESP is not set | 231 | # CONFIG_INET_ESP is not set |
188 | # CONFIG_INET_IPCOMP is not set | 232 | # CONFIG_INET_IPCOMP is not set |
233 | # CONFIG_INET_XFRM_TUNNEL is not set | ||
189 | # CONFIG_INET_TUNNEL is not set | 234 | # CONFIG_INET_TUNNEL is not set |
190 | CONFIG_IP_TCPDIAG=y | 235 | CONFIG_INET_DIAG=y |
191 | # CONFIG_IP_TCPDIAG_IPV6 is not set | 236 | CONFIG_INET_TCP_DIAG=y |
192 | 237 | # CONFIG_TCP_CONG_ADVANCED is not set | |
193 | # | ||
194 | # TCP congestion control | ||
195 | # | ||
196 | CONFIG_TCP_CONG_BIC=y | 238 | CONFIG_TCP_CONG_BIC=y |
197 | CONFIG_TCP_CONG_WESTWOOD=y | ||
198 | CONFIG_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 | ||
203 | # CONFIG_IPV6 is not set | 239 | # CONFIG_IPV6 is not set |
240 | # CONFIG_INET6_XFRM_TUNNEL is not set | ||
241 | # CONFIG_INET6_TUNNEL is not set | ||
204 | # CONFIG_NETFILTER is not set | 242 | # CONFIG_NETFILTER is not set |
205 | 243 | ||
206 | # | 244 | # |
245 | # DCCP Configuration (EXPERIMENTAL) | ||
246 | # | ||
247 | # CONFIG_IP_DCCP is not set | ||
248 | |||
249 | # | ||
207 | # SCTP Configuration (EXPERIMENTAL) | 250 | # SCTP Configuration (EXPERIMENTAL) |
208 | # | 251 | # |
209 | # CONFIG_IP_SCTP is not set | 252 | # CONFIG_IP_SCTP is not set |
253 | |||
254 | # | ||
255 | # TIPC Configuration (EXPERIMENTAL) | ||
256 | # | ||
257 | # CONFIG_TIPC is not set | ||
210 | # CONFIG_ATM is not set | 258 | # CONFIG_ATM is not set |
211 | # CONFIG_BRIDGE is not set | 259 | # CONFIG_BRIDGE is not set |
212 | # CONFIG_VLAN_8021Q is not set | 260 | # CONFIG_VLAN_8021Q is not set |
@@ -224,27 +272,47 @@ CONFIG_TCP_CONG_HTCP=y | |||
224 | # QoS and/or fair queueing | 272 | # QoS and/or fair queueing |
225 | # | 273 | # |
226 | # CONFIG_NET_SCHED is not set | 274 | # CONFIG_NET_SCHED is not set |
227 | # CONFIG_NET_CLS_ROUTE is not set | ||
228 | 275 | ||
229 | # | 276 | # |
230 | # Network testing | 277 | # Network testing |
231 | # | 278 | # |
232 | # CONFIG_NET_PKTGEN is not set | 279 | # CONFIG_NET_PKTGEN is not set |
233 | # CONFIG_KGDBOE is not set | ||
234 | # CONFIG_NETPOLL is not set | ||
235 | # CONFIG_NETPOLL_RX is not set | ||
236 | # CONFIG_NETPOLL_TRAP is not set | ||
237 | # CONFIG_NET_POLL_CONTROLLER is not set | ||
238 | # CONFIG_HAMRADIO is not set | 280 | # CONFIG_HAMRADIO is not set |
239 | # CONFIG_IRDA is not set | 281 | # CONFIG_IRDA is not set |
240 | # CONFIG_BT is not set | 282 | # CONFIG_BT is not set |
241 | # CONFIG_IEEE80211 is not set | 283 | # CONFIG_IEEE80211 is not set |
284 | |||
285 | # | ||
286 | # UML Network Devices | ||
287 | # | ||
288 | CONFIG_UML_NET=y | ||
289 | CONFIG_UML_NET_ETHERTAP=y | ||
290 | CONFIG_UML_NET_TUNTAP=y | ||
291 | CONFIG_UML_NET_SLIP=y | ||
292 | CONFIG_UML_NET_DAEMON=y | ||
293 | CONFIG_UML_NET_MCAST=y | ||
294 | # CONFIG_UML_NET_PCAP is not set | ||
295 | CONFIG_UML_NET_SLIRP=y | ||
296 | |||
297 | # | ||
298 | # Network device support | ||
299 | # | ||
300 | CONFIG_NETDEVICES=y | ||
242 | CONFIG_DUMMY=m | 301 | CONFIG_DUMMY=m |
243 | # CONFIG_BONDING is not set | 302 | # CONFIG_BONDING is not set |
244 | # CONFIG_EQUALIZER is not set | 303 | # CONFIG_EQUALIZER is not set |
245 | CONFIG_TUN=m | 304 | CONFIG_TUN=m |
246 | 305 | ||
247 | # | 306 | # |
307 | # PHY device support | ||
308 | # | ||
309 | |||
310 | # | ||
311 | # Wireless LAN (non-hamradio) | ||
312 | # | ||
313 | # CONFIG_NET_RADIO is not set | ||
314 | |||
315 | # | ||
248 | # Wan interfaces | 316 | # Wan interfaces |
249 | # | 317 | # |
250 | # CONFIG_WAN is not set | 318 | # CONFIG_WAN is not set |
@@ -263,6 +331,13 @@ CONFIG_SLIP=m | |||
263 | # CONFIG_SLIP_MODE_SLIP6 is not set | 331 | # CONFIG_SLIP_MODE_SLIP6 is not set |
264 | # CONFIG_SHAPER is not set | 332 | # CONFIG_SHAPER is not set |
265 | # CONFIG_NETCONSOLE is not set | 333 | # CONFIG_NETCONSOLE is not set |
334 | # CONFIG_NETPOLL is not set | ||
335 | # CONFIG_NET_POLL_CONTROLLER is not set | ||
336 | |||
337 | # | ||
338 | # Connector - unified userspace <-> kernelspace linker | ||
339 | # | ||
340 | # CONFIG_CONNECTOR is not set | ||
266 | 341 | ||
267 | # | 342 | # |
268 | # File systems | 343 | # File systems |
@@ -274,17 +349,14 @@ CONFIG_EXT3_FS=y | |||
274 | # CONFIG_EXT3_FS_XATTR is not set | 349 | # CONFIG_EXT3_FS_XATTR is not set |
275 | CONFIG_JBD=y | 350 | CONFIG_JBD=y |
276 | # CONFIG_JBD_DEBUG is not set | 351 | # CONFIG_JBD_DEBUG is not set |
277 | # CONFIG_REISER4_FS is not set | ||
278 | CONFIG_REISERFS_FS=y | 352 | CONFIG_REISERFS_FS=y |
279 | # CONFIG_REISERFS_CHECK is not set | 353 | # CONFIG_REISERFS_CHECK is not set |
280 | # CONFIG_REISERFS_PROC_INFO is not set | 354 | # CONFIG_REISERFS_PROC_INFO is not set |
281 | # CONFIG_REISERFS_FS_XATTR is not set | 355 | # CONFIG_REISERFS_FS_XATTR is not set |
282 | # CONFIG_JFS_FS is not set | 356 | # CONFIG_JFS_FS is not set |
283 | 357 | # CONFIG_FS_POSIX_ACL is not set | |
284 | # | ||
285 | # XFS support | ||
286 | # | ||
287 | # CONFIG_XFS_FS is not set | 358 | # CONFIG_XFS_FS is not set |
359 | # CONFIG_OCFS2_FS is not set | ||
288 | # CONFIG_MINIX_FS is not set | 360 | # CONFIG_MINIX_FS is not set |
289 | # CONFIG_ROMFS_FS is not set | 361 | # CONFIG_ROMFS_FS is not set |
290 | CONFIG_INOTIFY=y | 362 | CONFIG_INOTIFY=y |
@@ -295,11 +367,6 @@ CONFIG_QUOTACTL=y | |||
295 | CONFIG_DNOTIFY=y | 367 | CONFIG_DNOTIFY=y |
296 | CONFIG_AUTOFS_FS=m | 368 | CONFIG_AUTOFS_FS=m |
297 | CONFIG_AUTOFS4_FS=m | 369 | CONFIG_AUTOFS4_FS=m |
298 | |||
299 | # | ||
300 | # Caches | ||
301 | # | ||
302 | # CONFIG_FSCACHE is not set | ||
303 | # CONFIG_FUSE_FS is not set | 370 | # CONFIG_FUSE_FS is not set |
304 | 371 | ||
305 | # | 372 | # |
@@ -323,14 +390,10 @@ CONFIG_JOLIET=y | |||
323 | CONFIG_PROC_FS=y | 390 | CONFIG_PROC_FS=y |
324 | CONFIG_PROC_KCORE=y | 391 | CONFIG_PROC_KCORE=y |
325 | CONFIG_SYSFS=y | 392 | CONFIG_SYSFS=y |
326 | # CONFIG_DEVFS_FS is not set | ||
327 | # CONFIG_DEVPTS_FS_XATTR is not set | ||
328 | CONFIG_TMPFS=y | 393 | CONFIG_TMPFS=y |
329 | # CONFIG_TMPFS_XATTR is not set | ||
330 | # CONFIG_HUGETLB_PAGE is not set | 394 | # CONFIG_HUGETLB_PAGE is not set |
331 | CONFIG_RAMFS=y | 395 | CONFIG_RAMFS=y |
332 | # CONFIG_CONFIGFS_FS is not set | 396 | # CONFIG_CONFIGFS_FS is not set |
333 | # CONFIG_RELAYFS_FS is not set | ||
334 | 397 | ||
335 | # | 398 | # |
336 | # Miscellaneous filesystems | 399 | # Miscellaneous filesystems |
@@ -430,6 +493,7 @@ CONFIG_NLS_DEFAULT="iso8859-1" | |||
430 | # Library routines | 493 | # Library routines |
431 | # | 494 | # |
432 | # CONFIG_CRC_CCITT is not set | 495 | # CONFIG_CRC_CCITT is not set |
496 | # CONFIG_CRC16 is not set | ||
433 | CONFIG_CRC32=m | 497 | CONFIG_CRC32=m |
434 | # CONFIG_LIBCRC32C is not set | 498 | # CONFIG_LIBCRC32C is not set |
435 | 499 | ||
@@ -448,12 +512,18 @@ CONFIG_LOG_BUF_SHIFT=14 | |||
448 | CONFIG_DETECT_SOFTLOCKUP=y | 512 | CONFIG_DETECT_SOFTLOCKUP=y |
449 | # CONFIG_SCHEDSTATS is not set | 513 | # CONFIG_SCHEDSTATS is not set |
450 | CONFIG_DEBUG_SLAB=y | 514 | CONFIG_DEBUG_SLAB=y |
515 | # CONFIG_DEBUG_SLAB_LEAK is not set | ||
516 | # CONFIG_DEBUG_MUTEXES is not set | ||
451 | # CONFIG_DEBUG_SPINLOCK is not set | 517 | # CONFIG_DEBUG_SPINLOCK is not set |
452 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | 518 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set |
453 | # CONFIG_DEBUG_KOBJECT is not set | 519 | # CONFIG_DEBUG_KOBJECT is not set |
454 | CONFIG_DEBUG_INFO=y | 520 | CONFIG_DEBUG_INFO=y |
455 | # CONFIG_DEBUG_FS is not set | 521 | # CONFIG_DEBUG_FS is not set |
522 | # CONFIG_DEBUG_VM is not set | ||
456 | CONFIG_FRAME_POINTER=y | 523 | CONFIG_FRAME_POINTER=y |
524 | # CONFIG_UNWIND_INFO is not set | ||
525 | CONFIG_FORCED_INLINING=y | ||
526 | # CONFIG_RCU_TORTURE_TEST is not set | ||
457 | # CONFIG_GPROF is not set | 527 | # CONFIG_GPROF is not set |
458 | # CONFIG_GCOV is not set | 528 | # CONFIG_GCOV is not set |
459 | # CONFIG_SYSCALL_DEBUG is not set | 529 | # CONFIG_SYSCALL_DEBUG is not set |
diff --git a/arch/um/include/kern_util.h b/arch/um/include/kern_util.h index efa3d33c0be6..310980b32173 100644 --- a/arch/um/include/kern_util.h +++ b/arch/um/include/kern_util.h | |||
@@ -120,20 +120,11 @@ extern int is_syscall(unsigned long addr); | |||
120 | extern void free_irq(unsigned int, void *); | 120 | extern void free_irq(unsigned int, void *); |
121 | extern int cpu(void); | 121 | extern int cpu(void); |
122 | 122 | ||
123 | extern void time_init_kern(void); | ||
124 | |||
123 | /* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */ | 125 | /* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */ |
124 | extern int __cant_sleep(void); | 126 | extern int __cant_sleep(void); |
125 | extern void segv_handler(int sig, union uml_pt_regs *regs); | 127 | extern void segv_handler(int sig, union uml_pt_regs *regs); |
126 | extern void sigio_handler(int sig, union uml_pt_regs *regs); | 128 | extern void sigio_handler(int sig, union uml_pt_regs *regs); |
127 | 129 | ||
128 | #endif | 130 | #endif |
129 | |||
130 | /* | ||
131 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
132 | * Emacs will notice this stuff at the end of the file and automatically | ||
133 | * adjust the settings for this buffer only. This must remain at the end | ||
134 | * of the file. | ||
135 | * --------------------------------------------------------------------------- | ||
136 | * Local variables: | ||
137 | * c-file-style: "linux" | ||
138 | * End: | ||
139 | */ | ||
diff --git a/arch/um/include/longjmp.h b/arch/um/include/longjmp.h index 018b3819ab0b..8e7053013f7b 100644 --- a/arch/um/include/longjmp.h +++ b/arch/um/include/longjmp.h | |||
@@ -4,11 +4,11 @@ | |||
4 | #include <setjmp.h> | 4 | #include <setjmp.h> |
5 | #include "os.h" | 5 | #include "os.h" |
6 | 6 | ||
7 | #define UML_SIGLONGJMP(buf, val) do { \ | 7 | #define UML_LONGJMP(buf, val) do { \ |
8 | longjmp(*buf, val); \ | 8 | longjmp(*buf, val); \ |
9 | } while(0) | 9 | } while(0) |
10 | 10 | ||
11 | #define UML_SIGSETJMP(buf, enable) ({ \ | 11 | #define UML_SETJMP(buf, enable) ({ \ |
12 | int n; \ | 12 | int n; \ |
13 | enable = get_signals(); \ | 13 | enable = get_signals(); \ |
14 | n = setjmp(*buf); \ | 14 | n = setjmp(*buf); \ |
diff --git a/arch/um/include/sysdep-i386/kernel-offsets.h b/arch/um/include/sysdep-i386/kernel-offsets.h index 82f96c574144..2c13de321f2f 100644 --- a/arch/um/include/sysdep-i386/kernel-offsets.h +++ b/arch/um/include/sysdep-i386/kernel-offsets.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <linux/stddef.h> | 1 | #include <linux/stddef.h> |
2 | #include <linux/sched.h> | 2 | #include <linux/sched.h> |
3 | #include <linux/elf.h> | 3 | #include <linux/elf.h> |
4 | #include <asm/mman.h> | ||
4 | 5 | ||
5 | #define DEFINE(sym, val) \ | 6 | #define DEFINE(sym, val) \ |
6 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | 7 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) |
@@ -16,6 +17,7 @@ | |||
16 | void foo(void) | 17 | void foo(void) |
17 | { | 18 | { |
18 | OFFSET(HOST_TASK_DEBUGREGS, task_struct, thread.arch.debugregs); | 19 | OFFSET(HOST_TASK_DEBUGREGS, task_struct, thread.arch.debugregs); |
20 | DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE); | ||
19 | #ifdef CONFIG_MODE_TT | 21 | #ifdef CONFIG_MODE_TT |
20 | OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); | 22 | OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); |
21 | #endif | 23 | #endif |
diff --git a/arch/um/include/sysdep-x86_64/kernel-offsets.h b/arch/um/include/sysdep-x86_64/kernel-offsets.h index 5ce93abd0b54..939cc475757a 100644 --- a/arch/um/include/sysdep-x86_64/kernel-offsets.h +++ b/arch/um/include/sysdep-x86_64/kernel-offsets.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/time.h> | 4 | #include <linux/time.h> |
5 | #include <linux/elf.h> | 5 | #include <linux/elf.h> |
6 | #include <asm/page.h> | 6 | #include <asm/page.h> |
7 | #include <asm/mman.h> | ||
7 | 8 | ||
8 | #define DEFINE(sym, val) \ | 9 | #define DEFINE(sym, val) \ |
9 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | 10 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) |
@@ -18,6 +19,7 @@ | |||
18 | 19 | ||
19 | void foo(void) | 20 | void foo(void) |
20 | { | 21 | { |
22 | DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE); | ||
21 | #ifdef CONFIG_MODE_TT | 23 | #ifdef CONFIG_MODE_TT |
22 | OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); | 24 | OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); |
23 | #endif | 25 | #endif |
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c index c39ea3abeda4..2ffda012385e 100644 --- a/arch/um/kernel/irq.c +++ b/arch/um/kernel/irq.c | |||
@@ -89,16 +89,18 @@ void sigio_handler(int sig, union uml_pt_regs *regs) | |||
89 | struct irq_fd *irq_fd; | 89 | struct irq_fd *irq_fd; |
90 | int n; | 90 | int n; |
91 | 91 | ||
92 | if(smp_sigio_handler()) return; | 92 | if (smp_sigio_handler()) |
93 | while(1){ | 93 | return; |
94 | |||
95 | while (1) { | ||
94 | n = os_waiting_for_events(active_fds); | 96 | n = os_waiting_for_events(active_fds); |
95 | if (n <= 0) { | 97 | if (n <= 0) { |
96 | if(n == -EINTR) continue; | 98 | if(n == -EINTR) continue; |
97 | else break; | 99 | else break; |
98 | } | 100 | } |
99 | 101 | ||
100 | for(irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next){ | 102 | for (irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next) { |
101 | if(irq_fd->current_events != 0){ | 103 | if (irq_fd->current_events != 0) { |
102 | irq_fd->current_events = 0; | 104 | irq_fd->current_events = 0; |
103 | do_IRQ(irq_fd->irq, regs); | 105 | do_IRQ(irq_fd->irq, regs); |
104 | } | 106 | } |
@@ -110,19 +112,17 @@ void sigio_handler(int sig, union uml_pt_regs *regs) | |||
110 | 112 | ||
111 | static void maybe_sigio_broken(int fd, int type) | 113 | static void maybe_sigio_broken(int fd, int type) |
112 | { | 114 | { |
113 | if(os_isatty(fd)){ | 115 | if (os_isatty(fd)) { |
114 | if((type == IRQ_WRITE) && !pty_output_sigio){ | 116 | if ((type == IRQ_WRITE) && !pty_output_sigio) { |
115 | write_sigio_workaround(); | 117 | write_sigio_workaround(); |
116 | add_sigio_fd(fd, 0); | 118 | add_sigio_fd(fd, 0); |
117 | } | 119 | } else if ((type == IRQ_READ) && !pty_close_sigio) { |
118 | else if((type == IRQ_READ) && !pty_close_sigio){ | ||
119 | write_sigio_workaround(); | 120 | write_sigio_workaround(); |
120 | add_sigio_fd(fd, 1); | 121 | add_sigio_fd(fd, 1); |
121 | } | 122 | } |
122 | } | 123 | } |
123 | } | 124 | } |
124 | 125 | ||
125 | |||
126 | int activate_fd(int irq, int fd, int type, void *dev_id) | 126 | int activate_fd(int irq, int fd, int type, void *dev_id) |
127 | { | 127 | { |
128 | struct pollfd *tmp_pfd; | 128 | struct pollfd *tmp_pfd; |
@@ -132,16 +132,18 @@ int activate_fd(int irq, int fd, int type, void *dev_id) | |||
132 | 132 | ||
133 | pid = os_getpid(); | 133 | pid = os_getpid(); |
134 | err = os_set_fd_async(fd, pid); | 134 | err = os_set_fd_async(fd, pid); |
135 | if(err < 0) | 135 | if (err < 0) |
136 | goto out; | 136 | goto out; |
137 | 137 | ||
138 | new_fd = um_kmalloc(sizeof(*new_fd)); | 138 | new_fd = um_kmalloc(sizeof(*new_fd)); |
139 | err = -ENOMEM; | 139 | err = -ENOMEM; |
140 | if(new_fd == NULL) | 140 | if (new_fd == NULL) |
141 | goto out; | 141 | goto out; |
142 | 142 | ||
143 | if(type == IRQ_READ) events = UM_POLLIN | UM_POLLPRI; | 143 | if (type == IRQ_READ) |
144 | else events = UM_POLLOUT; | 144 | events = UM_POLLIN | UM_POLLPRI; |
145 | else | ||
146 | events = UM_POLLOUT; | ||
145 | *new_fd = ((struct irq_fd) { .next = NULL, | 147 | *new_fd = ((struct irq_fd) { .next = NULL, |
146 | .id = dev_id, | 148 | .id = dev_id, |
147 | .fd = fd, | 149 | .fd = fd, |
@@ -165,8 +167,8 @@ int activate_fd(int irq, int fd, int type, void *dev_id) | |||
165 | * a semaphore. | 167 | * a semaphore. |
166 | */ | 168 | */ |
167 | flags = irq_lock(); | 169 | flags = irq_lock(); |
168 | for(irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next){ | 170 | for (irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next) { |
169 | if((irq_fd->fd == fd) && (irq_fd->type == type)){ | 171 | if ((irq_fd->fd == fd) && (irq_fd->type == type)) { |
170 | printk("Registering fd %d twice\n", fd); | 172 | printk("Registering fd %d twice\n", fd); |
171 | printk("Irqs : %d, %d\n", irq_fd->irq, irq); | 173 | printk("Irqs : %d, %d\n", irq_fd->irq, irq); |
172 | printk("Ids : 0x%p, 0x%p\n", irq_fd->id, dev_id); | 174 | printk("Ids : 0x%p, 0x%p\n", irq_fd->id, dev_id); |
@@ -175,13 +177,13 @@ int activate_fd(int irq, int fd, int type, void *dev_id) | |||
175 | } | 177 | } |
176 | 178 | ||
177 | /*-------------*/ | 179 | /*-------------*/ |
178 | if(type == IRQ_WRITE) | 180 | if (type == IRQ_WRITE) |
179 | fd = -1; | 181 | fd = -1; |
180 | 182 | ||
181 | tmp_pfd = NULL; | 183 | tmp_pfd = NULL; |
182 | n = 0; | 184 | n = 0; |
183 | 185 | ||
184 | while(1){ | 186 | while (1) { |
185 | n = os_create_pollfd(fd, events, tmp_pfd, n); | 187 | n = os_create_pollfd(fd, events, tmp_pfd, n); |
186 | if (n == 0) | 188 | if (n == 0) |
187 | break; | 189 | break; |
@@ -198,10 +200,8 @@ int activate_fd(int irq, int fd, int type, void *dev_id) | |||
198 | * then we free the buffer tmp_fds and try again. | 200 | * then we free the buffer tmp_fds and try again. |
199 | */ | 201 | */ |
200 | irq_unlock(flags); | 202 | irq_unlock(flags); |
201 | if (tmp_pfd != NULL) { | 203 | kfree(tmp_pfd); |
202 | kfree(tmp_pfd); | 204 | tmp_pfd = NULL; |
203 | tmp_pfd = NULL; | ||
204 | } | ||
205 | 205 | ||
206 | tmp_pfd = um_kmalloc(n); | 206 | tmp_pfd = um_kmalloc(n); |
207 | if (tmp_pfd == NULL) | 207 | if (tmp_pfd == NULL) |
@@ -249,7 +249,7 @@ static int same_irq_and_dev(struct irq_fd *irq, void *d) | |||
249 | { | 249 | { |
250 | struct irq_and_dev *data = d; | 250 | struct irq_and_dev *data = d; |
251 | 251 | ||
252 | return((irq->irq == data->irq) && (irq->id == data->dev)); | 252 | return ((irq->irq == data->irq) && (irq->id == data->dev)); |
253 | } | 253 | } |
254 | 254 | ||
255 | void free_irq_by_irq_and_dev(unsigned int irq, void *dev) | 255 | void free_irq_by_irq_and_dev(unsigned int irq, void *dev) |
@@ -262,7 +262,7 @@ void free_irq_by_irq_and_dev(unsigned int irq, void *dev) | |||
262 | 262 | ||
263 | static int same_fd(struct irq_fd *irq, void *fd) | 263 | static int same_fd(struct irq_fd *irq, void *fd) |
264 | { | 264 | { |
265 | return(irq->fd == *((int *) fd)); | 265 | return (irq->fd == *((int *)fd)); |
266 | } | 266 | } |
267 | 267 | ||
268 | void free_irq_by_fd(int fd) | 268 | void free_irq_by_fd(int fd) |
@@ -276,16 +276,17 @@ static struct irq_fd *find_irq_by_fd(int fd, int irqnum, int *index_out) | |||
276 | int i = 0; | 276 | int i = 0; |
277 | int fdi; | 277 | int fdi; |
278 | 278 | ||
279 | for(irq=active_fds; irq != NULL; irq = irq->next){ | 279 | for (irq = active_fds; irq != NULL; irq = irq->next) { |
280 | if((irq->fd == fd) && (irq->irq == irqnum)) break; | 280 | if ((irq->fd == fd) && (irq->irq == irqnum)) |
281 | break; | ||
281 | i++; | 282 | i++; |
282 | } | 283 | } |
283 | if(irq == NULL){ | 284 | if (irq == NULL) { |
284 | printk("find_irq_by_fd doesn't have descriptor %d\n", fd); | 285 | printk("find_irq_by_fd doesn't have descriptor %d\n", fd); |
285 | goto out; | 286 | goto out; |
286 | } | 287 | } |
287 | fdi = os_get_pollfd(i); | 288 | fdi = os_get_pollfd(i); |
288 | if((fdi != -1) && (fdi != fd)){ | 289 | if ((fdi != -1) && (fdi != fd)) { |
289 | printk("find_irq_by_fd - mismatch between active_fds and " | 290 | printk("find_irq_by_fd - mismatch between active_fds and " |
290 | "pollfds, fd %d vs %d, need %d\n", irq->fd, | 291 | "pollfds, fd %d vs %d, need %d\n", irq->fd, |
291 | fdi, fd); | 292 | fdi, fd); |
@@ -294,7 +295,7 @@ static struct irq_fd *find_irq_by_fd(int fd, int irqnum, int *index_out) | |||
294 | } | 295 | } |
295 | *index_out = i; | 296 | *index_out = i; |
296 | out: | 297 | out: |
297 | return(irq); | 298 | return irq; |
298 | } | 299 | } |
299 | 300 | ||
300 | void reactivate_fd(int fd, int irqnum) | 301 | void reactivate_fd(int fd, int irqnum) |
@@ -305,7 +306,7 @@ void reactivate_fd(int fd, int irqnum) | |||
305 | 306 | ||
306 | flags = irq_lock(); | 307 | flags = irq_lock(); |
307 | irq = find_irq_by_fd(fd, irqnum, &i); | 308 | irq = find_irq_by_fd(fd, irqnum, &i); |
308 | if(irq == NULL){ | 309 | if (irq == NULL) { |
309 | irq_unlock(flags); | 310 | irq_unlock(flags); |
310 | return; | 311 | return; |
311 | } | 312 | } |
@@ -326,7 +327,7 @@ void deactivate_fd(int fd, int irqnum) | |||
326 | 327 | ||
327 | flags = irq_lock(); | 328 | flags = irq_lock(); |
328 | irq = find_irq_by_fd(fd, irqnum, &i); | 329 | irq = find_irq_by_fd(fd, irqnum, &i); |
329 | if(irq == NULL) | 330 | if (irq == NULL) |
330 | goto out; | 331 | goto out; |
331 | os_set_pollfd(i, -1); | 332 | os_set_pollfd(i, -1); |
332 | out: | 333 | out: |
@@ -338,15 +339,15 @@ int deactivate_all_fds(void) | |||
338 | struct irq_fd *irq; | 339 | struct irq_fd *irq; |
339 | int err; | 340 | int err; |
340 | 341 | ||
341 | for(irq=active_fds;irq != NULL;irq = irq->next){ | 342 | for (irq = active_fds; irq != NULL; irq = irq->next) { |
342 | err = os_clear_fd_async(irq->fd); | 343 | err = os_clear_fd_async(irq->fd); |
343 | if(err) | 344 | if (err) |
344 | return(err); | 345 | return err; |
345 | } | 346 | } |
346 | /* If there is a signal already queued, after unblocking ignore it */ | 347 | /* If there is a signal already queued, after unblocking ignore it */ |
347 | os_set_ioignore(); | 348 | os_set_ioignore(); |
348 | 349 | ||
349 | return(0); | 350 | return 0; |
350 | } | 351 | } |
351 | 352 | ||
352 | void forward_interrupts(int pid) | 353 | void forward_interrupts(int pid) |
@@ -356,9 +357,9 @@ void forward_interrupts(int pid) | |||
356 | int err; | 357 | int err; |
357 | 358 | ||
358 | flags = irq_lock(); | 359 | flags = irq_lock(); |
359 | for(irq=active_fds;irq != NULL;irq = irq->next){ | 360 | for (irq = active_fds; irq != NULL; irq = irq->next) { |
360 | err = os_set_owner(irq->fd, pid); | 361 | err = os_set_owner(irq->fd, pid); |
361 | if(err < 0){ | 362 | if (err < 0) { |
362 | /* XXX Just remove the irq rather than | 363 | /* XXX Just remove the irq rather than |
363 | * print out an infinite stream of these | 364 | * print out an infinite stream of these |
364 | */ | 365 | */ |
@@ -379,7 +380,7 @@ void forward_interrupts(int pid) | |||
379 | unsigned int do_IRQ(int irq, union uml_pt_regs *regs) | 380 | unsigned int do_IRQ(int irq, union uml_pt_regs *regs) |
380 | { | 381 | { |
381 | irq_enter(); | 382 | irq_enter(); |
382 | __do_IRQ(irq, (struct pt_regs *) regs); | 383 | __do_IRQ(irq, (struct pt_regs *)regs); |
383 | irq_exit(); | 384 | irq_exit(); |
384 | return 1; | 385 | return 1; |
385 | } | 386 | } |
@@ -392,12 +393,12 @@ int um_request_irq(unsigned int irq, int fd, int type, | |||
392 | int err; | 393 | int err; |
393 | 394 | ||
394 | err = request_irq(irq, handler, irqflags, devname, dev_id); | 395 | err = request_irq(irq, handler, irqflags, devname, dev_id); |
395 | if(err) | 396 | if (err) |
396 | return(err); | 397 | return err; |
397 | 398 | ||
398 | if(fd != -1) | 399 | if (fd != -1) |
399 | err = activate_fd(irq, fd, type, dev_id); | 400 | err = activate_fd(irq, fd, type, dev_id); |
400 | return(err); | 401 | return err; |
401 | } | 402 | } |
402 | EXPORT_SYMBOL(um_request_irq); | 403 | EXPORT_SYMBOL(um_request_irq); |
403 | EXPORT_SYMBOL(reactivate_fd); | 404 | EXPORT_SYMBOL(reactivate_fd); |
@@ -409,7 +410,7 @@ unsigned long irq_lock(void) | |||
409 | unsigned long flags; | 410 | unsigned long flags; |
410 | 411 | ||
411 | spin_lock_irqsave(&irq_spinlock, flags); | 412 | spin_lock_irqsave(&irq_spinlock, flags); |
412 | return(flags); | 413 | return flags; |
413 | } | 414 | } |
414 | 415 | ||
415 | void irq_unlock(unsigned long flags) | 416 | void irq_unlock(unsigned long flags) |
@@ -452,7 +453,7 @@ void __init init_IRQ(void) | |||
452 | irq_desc[TIMER_IRQ].depth = 1; | 453 | irq_desc[TIMER_IRQ].depth = 1; |
453 | irq_desc[TIMER_IRQ].handler = &SIGVTALRM_irq_type; | 454 | irq_desc[TIMER_IRQ].handler = &SIGVTALRM_irq_type; |
454 | enable_irq(TIMER_IRQ); | 455 | enable_irq(TIMER_IRQ); |
455 | for(i=1;i<NR_IRQS;i++){ | 456 | for (i = 1; i < NR_IRQS; i++) { |
456 | irq_desc[i].status = IRQ_DISABLED; | 457 | irq_desc[i].status = IRQ_DISABLED; |
457 | irq_desc[i].action = NULL; | 458 | irq_desc[i].action = NULL; |
458 | irq_desc[i].depth = 1; | 459 | irq_desc[i].depth = 1; |
@@ -467,7 +468,7 @@ int init_aio_irq(int irq, char *name, irqreturn_t (*handler)(int, void *, | |||
467 | int fds[2], err; | 468 | int fds[2], err; |
468 | 469 | ||
469 | err = os_pipe(fds, 1, 1); | 470 | err = os_pipe(fds, 1, 1); |
470 | if(err){ | 471 | if (err) { |
471 | printk("init_aio_irq - os_pipe failed, err = %d\n", -err); | 472 | printk("init_aio_irq - os_pipe failed, err = %d\n", -err); |
472 | goto out; | 473 | goto out; |
473 | } | 474 | } |
@@ -475,7 +476,7 @@ int init_aio_irq(int irq, char *name, irqreturn_t (*handler)(int, void *, | |||
475 | err = um_request_irq(irq, fds[0], IRQ_READ, handler, | 476 | err = um_request_irq(irq, fds[0], IRQ_READ, handler, |
476 | SA_INTERRUPT | SA_SAMPLE_RANDOM, name, | 477 | SA_INTERRUPT | SA_SAMPLE_RANDOM, name, |
477 | (void *) (long) fds[0]); | 478 | (void *) (long) fds[0]); |
478 | if(err){ | 479 | if (err) { |
479 | printk("init_aio_irq - : um_request_irq failed, err = %d\n", | 480 | printk("init_aio_irq - : um_request_irq failed, err = %d\n", |
480 | err); | 481 | err); |
481 | goto out_close; | 482 | goto out_close; |
@@ -488,5 +489,5 @@ int init_aio_irq(int irq, char *name, irqreturn_t (*handler)(int, void *, | |||
488 | os_close_file(fds[0]); | 489 | os_close_file(fds[0]); |
489 | os_close_file(fds[1]); | 490 | os_close_file(fds[1]); |
490 | out: | 491 | out: |
491 | return(err); | 492 | return err; |
492 | } | 493 | } |
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index 0500800df1c1..fc0f0b085ca7 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c | |||
@@ -407,6 +407,8 @@ unsigned long find_iomem(char *driver, unsigned long *len_out) | |||
407 | *len_out = region->size; | 407 | *len_out = region->size; |
408 | return(region->virt); | 408 | return(region->virt); |
409 | } | 409 | } |
410 | |||
411 | region = region->next; | ||
410 | } | 412 | } |
411 | 413 | ||
412 | return(0); | 414 | return(0); |
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index 60d2eda995c1..9a77fb3c269d 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c | |||
@@ -275,15 +275,13 @@ void syscall_trace(union uml_pt_regs *regs, int entryexit) | |||
275 | 275 | ||
276 | if (unlikely(current->audit_context)) { | 276 | if (unlikely(current->audit_context)) { |
277 | if (!entryexit) | 277 | if (!entryexit) |
278 | audit_syscall_entry(current, | 278 | audit_syscall_entry(HOST_AUDIT_ARCH, |
279 | HOST_AUDIT_ARCH, | ||
280 | UPT_SYSCALL_NR(regs), | 279 | UPT_SYSCALL_NR(regs), |
281 | UPT_SYSCALL_ARG1(regs), | 280 | UPT_SYSCALL_ARG1(regs), |
282 | UPT_SYSCALL_ARG2(regs), | 281 | UPT_SYSCALL_ARG2(regs), |
283 | UPT_SYSCALL_ARG3(regs), | 282 | UPT_SYSCALL_ARG3(regs), |
284 | UPT_SYSCALL_ARG4(regs)); | 283 | UPT_SYSCALL_ARG4(regs)); |
285 | else audit_syscall_exit(current, | 284 | else audit_syscall_exit(AUDITSC_RESULT(UPT_SYSCALL_RET(regs)), |
286 | AUDITSC_RESULT(UPT_SYSCALL_RET(regs)), | ||
287 | UPT_SYSCALL_RET(regs)); | 285 | UPT_SYSCALL_RET(regs)); |
288 | } | 286 | } |
289 | 287 | ||
diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile index 57181a920d48..ea3a8e409a6e 100644 --- a/arch/um/kernel/skas/Makefile +++ b/arch/um/kernel/skas/Makefile | |||
@@ -6,9 +6,11 @@ | |||
6 | obj-y := clone.o exec_kern.o mem.o mmu.o process_kern.o \ | 6 | obj-y := clone.o exec_kern.o mem.o mmu.o process_kern.o \ |
7 | syscall.o tlb.o uaccess.o | 7 | syscall.o tlb.o uaccess.o |
8 | 8 | ||
9 | USER_OBJS := clone.o | 9 | # clone.o is in the stub, so it can't be built with profiling |
10 | # GCC hardened also auto-enables -fpic, but we need %ebx so it can't work -> | ||
11 | # disable it | ||
10 | 12 | ||
11 | include arch/um/scripts/Makefile.rules | 13 | CFLAGS_clone.o := $(CFLAGS_NO_HARDENING) |
14 | UNPROFILE_OBJS := clone.o | ||
12 | 15 | ||
13 | # clone.o is in the stub, so it can't be built with profiling | 16 | include arch/um/scripts/Makefile.rules |
14 | $(obj)/clone.o : c_flags = -Wp,-MD,$(depfile) $(call unprofile,$(USER_CFLAGS)) | ||
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c index 3c7626cdba4b..86f51d04c98d 100644 --- a/arch/um/kernel/time_kern.c +++ b/arch/um/kernel/time_kern.c | |||
@@ -84,6 +84,16 @@ void timer_irq(union uml_pt_regs *regs) | |||
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | |||
88 | void time_init_kern(void) | ||
89 | { | ||
90 | unsigned long long nsecs; | ||
91 | |||
92 | nsecs = os_nsecs(); | ||
93 | set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION, | ||
94 | -nsecs % BILLION); | ||
95 | } | ||
96 | |||
87 | void do_boot_timer_handler(struct sigcontext * sc) | 97 | void do_boot_timer_handler(struct sigcontext * sc) |
88 | { | 98 | { |
89 | struct pt_regs regs; | 99 | struct pt_regs regs; |
@@ -209,4 +219,4 @@ int __init timer_init(void) | |||
209 | return(0); | 219 | return(0); |
210 | } | 220 | } |
211 | 221 | ||
212 | __initcall(timer_init); | 222 | arch_initcall(timer_init); |
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c index 3bd10deea280..09251338d99e 100644 --- a/arch/um/os-Linux/file.c +++ b/arch/um/os-Linux/file.c | |||
@@ -171,7 +171,7 @@ int os_sigio_async(int master, int slave) | |||
171 | 171 | ||
172 | flags = fcntl(master, F_GETFL); | 172 | flags = fcntl(master, F_GETFL); |
173 | if(flags < 0) | 173 | if(flags < 0) |
174 | return errno; | 174 | return -errno; |
175 | 175 | ||
176 | if((fcntl(master, F_SETFL, flags | O_NONBLOCK | O_ASYNC) < 0) || | 176 | if((fcntl(master, F_SETFL, flags | O_NONBLOCK | O_ASYNC) < 0) || |
177 | (fcntl(master, F_SETOWN, os_getpid()) < 0)) | 177 | (fcntl(master, F_SETOWN, os_getpid()) < 0)) |
diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c index e599be423da1..3788d4568d33 100644 --- a/arch/um/os-Linux/irq.c +++ b/arch/um/os-Linux/irq.c | |||
@@ -29,21 +29,21 @@ int os_waiting_for_events(struct irq_fd *active_fds) | |||
29 | int i, n, err; | 29 | int i, n, err; |
30 | 30 | ||
31 | n = poll(pollfds, pollfds_num, 0); | 31 | n = poll(pollfds, pollfds_num, 0); |
32 | if(n < 0){ | 32 | if (n < 0) { |
33 | err = -errno; | 33 | err = -errno; |
34 | if(errno != EINTR) | 34 | if (errno != EINTR) |
35 | printk("sigio_handler: os_waiting_for_events:" | 35 | printk("sigio_handler: os_waiting_for_events:" |
36 | " poll returned %d, errno = %d\n", n, errno); | 36 | " poll returned %d, errno = %d\n", n, errno); |
37 | return err; | 37 | return err; |
38 | } | 38 | } |
39 | 39 | ||
40 | if(n == 0) | 40 | if (n == 0) |
41 | return 0; | 41 | return 0; |
42 | 42 | ||
43 | irq_fd = active_fds; | 43 | irq_fd = active_fds; |
44 | 44 | ||
45 | for(i = 0; i < pollfds_num; i++){ | 45 | for (i = 0; i < pollfds_num; i++) { |
46 | if(pollfds[i].revents != 0){ | 46 | if (pollfds[i].revents != 0) { |
47 | irq_fd->current_events = pollfds[i].revents; | 47 | irq_fd->current_events = pollfds[i].revents; |
48 | pollfds[i].fd = -1; | 48 | pollfds[i].fd = -1; |
49 | } | 49 | } |
@@ -54,7 +54,7 @@ int os_waiting_for_events(struct irq_fd *active_fds) | |||
54 | 54 | ||
55 | int os_isatty(int fd) | 55 | int os_isatty(int fd) |
56 | { | 56 | { |
57 | return(isatty(fd)); | 57 | return isatty(fd); |
58 | } | 58 | } |
59 | 59 | ||
60 | int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds) | 60 | int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds) |
@@ -65,7 +65,7 @@ int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds) | |||
65 | return((pollfds_size + 1) * sizeof(pollfds[0])); | 65 | return((pollfds_size + 1) * sizeof(pollfds[0])); |
66 | } | 66 | } |
67 | 67 | ||
68 | if(pollfds != NULL){ | 68 | if (pollfds != NULL) { |
69 | memcpy(tmp_pfd, pollfds, | 69 | memcpy(tmp_pfd, pollfds, |
70 | sizeof(pollfds[0]) * pollfds_size); | 70 | sizeof(pollfds[0]) * pollfds_size); |
71 | /* remove old pollfds */ | 71 | /* remove old pollfds */ |
@@ -73,18 +73,15 @@ int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds) | |||
73 | } | 73 | } |
74 | pollfds = tmp_pfd; | 74 | pollfds = tmp_pfd; |
75 | pollfds_size++; | 75 | pollfds_size++; |
76 | } else { | 76 | } else |
77 | /* remove not used tmp_pfd */ | 77 | kfree(tmp_pfd); /* remove not used tmp_pfd */ |
78 | if (tmp_pfd != NULL) | ||
79 | kfree(tmp_pfd); | ||
80 | } | ||
81 | 78 | ||
82 | pollfds[pollfds_num] = ((struct pollfd) { .fd = fd, | 79 | pollfds[pollfds_num] = ((struct pollfd) { .fd = fd, |
83 | .events = events, | 80 | .events = events, |
84 | .revents = 0 }); | 81 | .revents = 0 }); |
85 | pollfds_num++; | 82 | pollfds_num++; |
86 | 83 | ||
87 | return(0); | 84 | return 0; |
88 | } | 85 | } |
89 | 86 | ||
90 | void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg, | 87 | void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg, |
@@ -94,11 +91,11 @@ void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg, | |||
94 | int i = 0; | 91 | int i = 0; |
95 | 92 | ||
96 | prev = &active_fds; | 93 | prev = &active_fds; |
97 | while(*prev != NULL){ | 94 | while (*prev != NULL) { |
98 | if((*test)(*prev, arg)){ | 95 | if ((*test)(*prev, arg)) { |
99 | struct irq_fd *old_fd = *prev; | 96 | struct irq_fd *old_fd = *prev; |
100 | if((pollfds[i].fd != -1) && | 97 | if ((pollfds[i].fd != -1) && |
101 | (pollfds[i].fd != (*prev)->fd)){ | 98 | (pollfds[i].fd != (*prev)->fd)) { |
102 | printk("os_free_irq_by_cb - mismatch between " | 99 | printk("os_free_irq_by_cb - mismatch between " |
103 | "active_fds and pollfds, fd %d vs %d\n", | 100 | "active_fds and pollfds, fd %d vs %d\n", |
104 | (*prev)->fd, pollfds[i].fd); | 101 | (*prev)->fd, pollfds[i].fd); |
@@ -110,7 +107,6 @@ void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg, | |||
110 | /* This moves the *whole* array after pollfds[i] | 107 | /* This moves the *whole* array after pollfds[i] |
111 | * (though it doesn't spot as such)! | 108 | * (though it doesn't spot as such)! |
112 | */ | 109 | */ |
113 | |||
114 | memmove(&pollfds[i], &pollfds[i + 1], | 110 | memmove(&pollfds[i], &pollfds[i + 1], |
115 | (pollfds_num - i) * sizeof(pollfds[0])); | 111 | (pollfds_num - i) * sizeof(pollfds[0])); |
116 | if(*last_irq_ptr2 == &old_fd->next) | 112 | if(*last_irq_ptr2 == &old_fd->next) |
@@ -129,10 +125,9 @@ void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg, | |||
129 | return; | 125 | return; |
130 | } | 126 | } |
131 | 127 | ||
132 | |||
133 | int os_get_pollfd(int i) | 128 | int os_get_pollfd(int i) |
134 | { | 129 | { |
135 | return(pollfds[i].fd); | 130 | return pollfds[i].fd; |
136 | } | 131 | } |
137 | 132 | ||
138 | void os_set_pollfd(int i, int fd) | 133 | void os_set_pollfd(int i, int fd) |
@@ -151,8 +146,10 @@ void init_irq_signals(int on_sigstack) | |||
151 | int flags; | 146 | int flags; |
152 | 147 | ||
153 | flags = on_sigstack ? SA_ONSTACK : 0; | 148 | flags = on_sigstack ? SA_ONSTACK : 0; |
154 | if(timer_irq_inited) h = (__sighandler_t) alarm_handler; | 149 | if (timer_irq_inited) |
155 | else h = boot_timer_handler; | 150 | h = (__sighandler_t)alarm_handler; |
151 | else | ||
152 | h = boot_timer_handler; | ||
156 | 153 | ||
157 | set_handler(SIGVTALRM, h, flags | SA_RESTART, | 154 | set_handler(SIGVTALRM, h, flags | SA_RESTART, |
158 | SIGUSR1, SIGIO, SIGWINCH, SIGALRM, -1); | 155 | SIGUSR1, SIGIO, SIGWINCH, SIGALRM, -1); |
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index 2878e89a674f..90912aaca7aa 100644 --- a/arch/um/os-Linux/main.c +++ b/arch/um/os-Linux/main.c | |||
@@ -59,7 +59,7 @@ static __init void do_uml_initcalls(void) | |||
59 | initcall_t *call; | 59 | initcall_t *call; |
60 | 60 | ||
61 | call = &__uml_initcall_start; | 61 | call = &__uml_initcall_start; |
62 | while (call < &__uml_initcall_end){; | 62 | while (call < &__uml_initcall_end){ |
63 | (*call)(); | 63 | (*call)(); |
64 | call++; | 64 | call++; |
65 | } | 65 | } |
@@ -74,6 +74,34 @@ static void last_ditch_exit(int sig) | |||
74 | exit(1); | 74 | exit(1); |
75 | } | 75 | } |
76 | 76 | ||
77 | #define UML_LIB_PATH ":/usr/lib/uml" | ||
78 | |||
79 | static void setup_env_path(void) | ||
80 | { | ||
81 | char *new_path = NULL; | ||
82 | char *old_path = NULL; | ||
83 | int path_len = 0; | ||
84 | |||
85 | old_path = getenv("PATH"); | ||
86 | /* if no PATH variable is set or it has an empty value | ||
87 | * just use the default + /usr/lib/uml | ||
88 | */ | ||
89 | if (!old_path || (path_len = strlen(old_path)) == 0) { | ||
90 | putenv("PATH=:/bin:/usr/bin/" UML_LIB_PATH); | ||
91 | return; | ||
92 | } | ||
93 | |||
94 | /* append /usr/lib/uml to the existing path */ | ||
95 | path_len += strlen("PATH=" UML_LIB_PATH) + 1; | ||
96 | new_path = malloc(path_len); | ||
97 | if (!new_path) { | ||
98 | perror("coudn't malloc to set a new PATH"); | ||
99 | return; | ||
100 | } | ||
101 | snprintf(new_path, path_len, "PATH=%s" UML_LIB_PATH, old_path); | ||
102 | putenv(new_path); | ||
103 | } | ||
104 | |||
77 | extern int uml_exitcode; | 105 | extern int uml_exitcode; |
78 | 106 | ||
79 | extern void scan_elf_aux( char **envp); | 107 | extern void scan_elf_aux( char **envp); |
@@ -114,6 +142,8 @@ int main(int argc, char **argv, char **envp) | |||
114 | 142 | ||
115 | set_stklim(); | 143 | set_stklim(); |
116 | 144 | ||
145 | setup_env_path(); | ||
146 | |||
117 | new_argv = malloc((argc + 1) * sizeof(char *)); | 147 | new_argv = malloc((argc + 1) * sizeof(char *)); |
118 | if(new_argv == NULL){ | 148 | if(new_argv == NULL){ |
119 | perror("Mallocing argv"); | 149 | perror("Mallocing argv"); |
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c index 71bb90a7606d..c6432e729241 100644 --- a/arch/um/os-Linux/mem.c +++ b/arch/um/os-Linux/mem.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <fcntl.h> | 8 | #include <fcntl.h> |
9 | #include <sys/types.h> | 9 | #include <sys/types.h> |
10 | #include <sys/mman.h> | 10 | #include <sys/mman.h> |
11 | #include <sys/statfs.h> | ||
11 | #include "kern_util.h" | 12 | #include "kern_util.h" |
12 | #include "user.h" | 13 | #include "user.h" |
13 | #include "user_util.h" | 14 | #include "user_util.h" |
@@ -19,6 +20,7 @@ | |||
19 | 20 | ||
20 | #include <sys/param.h> | 21 | #include <sys/param.h> |
21 | 22 | ||
23 | static char *default_tmpdir = "/tmp"; | ||
22 | static char *tempdir = NULL; | 24 | static char *tempdir = NULL; |
23 | 25 | ||
24 | static void __init find_tempdir(void) | 26 | static void __init find_tempdir(void) |
@@ -34,7 +36,7 @@ static void __init find_tempdir(void) | |||
34 | break; | 36 | break; |
35 | } | 37 | } |
36 | if((dir == NULL) || (*dir == '\0')) | 38 | if((dir == NULL) || (*dir == '\0')) |
37 | dir = "/tmp"; | 39 | dir = default_tmpdir; |
38 | 40 | ||
39 | tempdir = malloc(strlen(dir) + 2); | 41 | tempdir = malloc(strlen(dir) + 2); |
40 | if(tempdir == NULL){ | 42 | if(tempdir == NULL){ |
@@ -46,6 +48,96 @@ static void __init find_tempdir(void) | |||
46 | strcat(tempdir, "/"); | 48 | strcat(tempdir, "/"); |
47 | } | 49 | } |
48 | 50 | ||
51 | /* This will return 1, with the first character in buf being the | ||
52 | * character following the next instance of c in the file. This will | ||
53 | * read the file as needed. If there's an error, -errno is returned; | ||
54 | * if the end of the file is reached, 0 is returned. | ||
55 | */ | ||
56 | static int next(int fd, char *buf, int size, char c) | ||
57 | { | ||
58 | int n; | ||
59 | char *ptr; | ||
60 | |||
61 | while((ptr = strchr(buf, c)) == NULL){ | ||
62 | n = read(fd, buf, size - 1); | ||
63 | if(n == 0) | ||
64 | return 0; | ||
65 | else if(n < 0) | ||
66 | return -errno; | ||
67 | |||
68 | buf[n] = '\0'; | ||
69 | } | ||
70 | |||
71 | ptr++; | ||
72 | memmove(buf, ptr, strlen(ptr) + 1); | ||
73 | return 1; | ||
74 | } | ||
75 | |||
76 | static int checked_tmpdir = 0; | ||
77 | |||
78 | /* Look for a tmpfs mounted at /dev/shm. I couldn't find a cleaner | ||
79 | * way to do this than to parse /proc/mounts. statfs will return the | ||
80 | * same filesystem magic number and fs id for both /dev and /dev/shm | ||
81 | * when they are both tmpfs, so you can't tell if they are different | ||
82 | * filesystems. Also, there seems to be no other way of finding the | ||
83 | * mount point of a filesystem from within it. | ||
84 | * | ||
85 | * If a /dev/shm tmpfs entry is found, then we switch to using it. | ||
86 | * Otherwise, we stay with the default /tmp. | ||
87 | */ | ||
88 | static void which_tmpdir(void) | ||
89 | { | ||
90 | int fd, found; | ||
91 | char buf[128] = { '\0' }; | ||
92 | |||
93 | if(checked_tmpdir) | ||
94 | return; | ||
95 | |||
96 | checked_tmpdir = 1; | ||
97 | |||
98 | printf("Checking for tmpfs mount on /dev/shm..."); | ||
99 | |||
100 | fd = open("/proc/mounts", O_RDONLY); | ||
101 | if(fd < 0){ | ||
102 | printf("failed to open /proc/mounts, errno = %d\n", errno); | ||
103 | return; | ||
104 | } | ||
105 | |||
106 | while(1){ | ||
107 | found = next(fd, buf, sizeof(buf) / sizeof(buf[0]), ' '); | ||
108 | if(found != 1) | ||
109 | break; | ||
110 | |||
111 | if(!strncmp(buf, "/dev/shm", strlen("/dev/shm"))) | ||
112 | goto found; | ||
113 | |||
114 | found = next(fd, buf, sizeof(buf) / sizeof(buf[0]), '\n'); | ||
115 | if(found != 1) | ||
116 | break; | ||
117 | } | ||
118 | |||
119 | err: | ||
120 | if(found == 0) | ||
121 | printf("nothing mounted on /dev/shm\n"); | ||
122 | else if(found < 0) | ||
123 | printf("read returned errno %d\n", -found); | ||
124 | |||
125 | return; | ||
126 | |||
127 | found: | ||
128 | found = next(fd, buf, sizeof(buf) / sizeof(buf[0]), ' '); | ||
129 | if(found != 1) | ||
130 | goto err; | ||
131 | |||
132 | if(strncmp(buf, "tmpfs", strlen("tmpfs"))){ | ||
133 | printf("not tmpfs\n"); | ||
134 | return; | ||
135 | } | ||
136 | |||
137 | printf("OK\n"); | ||
138 | default_tmpdir = "/dev/shm"; | ||
139 | } | ||
140 | |||
49 | /* | 141 | /* |
50 | * This proc still used in tt-mode | 142 | * This proc still used in tt-mode |
51 | * (file: kernel/tt/ptproxy/proxy.c, proc: start_debugger). | 143 | * (file: kernel/tt/ptproxy/proxy.c, proc: start_debugger). |
@@ -56,6 +148,7 @@ int make_tempfile(const char *template, char **out_tempname, int do_unlink) | |||
56 | char *tempname; | 148 | char *tempname; |
57 | int fd; | 149 | int fd; |
58 | 150 | ||
151 | which_tmpdir(); | ||
59 | tempname = malloc(MAXPATHLEN); | 152 | tempname = malloc(MAXPATHLEN); |
60 | 153 | ||
61 | find_tempdir(); | 154 | find_tempdir(); |
@@ -137,3 +230,26 @@ int create_mem_file(unsigned long long len) | |||
137 | } | 230 | } |
138 | return(fd); | 231 | return(fd); |
139 | } | 232 | } |
233 | |||
234 | |||
235 | void check_tmpexec(void) | ||
236 | { | ||
237 | void *addr; | ||
238 | int err, fd = create_tmp_file(UM_KERN_PAGE_SIZE); | ||
239 | |||
240 | addr = mmap(NULL, UM_KERN_PAGE_SIZE, | ||
241 | PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0); | ||
242 | printf("Checking PROT_EXEC mmap in %s...",tempdir); | ||
243 | fflush(stdout); | ||
244 | if(addr == MAP_FAILED){ | ||
245 | err = errno; | ||
246 | perror("failed"); | ||
247 | if(err == EPERM) | ||
248 | printf("%s must be not mounted noexec\n",tempdir); | ||
249 | exit(1); | ||
250 | } | ||
251 | printf("OK\n"); | ||
252 | munmap(addr, UM_KERN_PAGE_SIZE); | ||
253 | |||
254 | close(fd); | ||
255 | } | ||
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c index 8176b0b52047..233be2f4f8cb 100644 --- a/arch/um/os-Linux/process.c +++ b/arch/um/os-Linux/process.c | |||
@@ -190,7 +190,7 @@ int os_unmap_memory(void *addr, int len) | |||
190 | } | 190 | } |
191 | 191 | ||
192 | #ifndef MADV_REMOVE | 192 | #ifndef MADV_REMOVE |
193 | #define MADV_REMOVE 0x5 /* remove these pages & resources */ | 193 | #define MADV_REMOVE KERNEL_MADV_REMOVE |
194 | #endif | 194 | #endif |
195 | 195 | ||
196 | int os_drop_memory(void *addr, int length) | 196 | int os_drop_memory(void *addr, int length) |
@@ -206,29 +206,36 @@ int os_drop_memory(void *addr, int length) | |||
206 | int can_drop_memory(void) | 206 | int can_drop_memory(void) |
207 | { | 207 | { |
208 | void *addr; | 208 | void *addr; |
209 | int fd; | 209 | int fd, ok = 0; |
210 | 210 | ||
211 | printk("Checking host MADV_REMOVE support..."); | 211 | printk("Checking host MADV_REMOVE support..."); |
212 | fd = create_mem_file(UM_KERN_PAGE_SIZE); | 212 | fd = create_mem_file(UM_KERN_PAGE_SIZE); |
213 | if(fd < 0){ | 213 | if(fd < 0){ |
214 | printk("Creating test memory file failed, err = %d\n", -fd); | 214 | printk("Creating test memory file failed, err = %d\n", -fd); |
215 | return 0; | 215 | goto out; |
216 | } | 216 | } |
217 | 217 | ||
218 | addr = mmap64(NULL, UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE, | 218 | addr = mmap64(NULL, UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE, |
219 | MAP_PRIVATE, fd, 0); | 219 | MAP_SHARED, fd, 0); |
220 | if(addr == MAP_FAILED){ | 220 | if(addr == MAP_FAILED){ |
221 | printk("Mapping test memory file failed, err = %d\n", -errno); | 221 | printk("Mapping test memory file failed, err = %d\n", -errno); |
222 | return 0; | 222 | goto out_close; |
223 | } | 223 | } |
224 | 224 | ||
225 | if(madvise(addr, UM_KERN_PAGE_SIZE, MADV_REMOVE) != 0){ | 225 | if(madvise(addr, UM_KERN_PAGE_SIZE, MADV_REMOVE) != 0){ |
226 | printk("MADV_REMOVE failed, err = %d\n", -errno); | 226 | printk("MADV_REMOVE failed, err = %d\n", -errno); |
227 | return 0; | 227 | goto out_unmap; |
228 | } | 228 | } |
229 | 229 | ||
230 | printk("OK\n"); | 230 | printk("OK\n"); |
231 | return 1; | 231 | ok = 1; |
232 | |||
233 | out_unmap: | ||
234 | munmap(addr, UM_KERN_PAGE_SIZE); | ||
235 | out_close: | ||
236 | close(fd); | ||
237 | out: | ||
238 | return ok; | ||
232 | } | 239 | } |
233 | 240 | ||
234 | void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)) | 241 | void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)) |
@@ -266,11 +273,11 @@ void init_new_thread_signals(int altstack) | |||
266 | 273 | ||
267 | int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) | 274 | int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) |
268 | { | 275 | { |
269 | sigjmp_buf buf; | 276 | jmp_buf buf; |
270 | int n, enable; | 277 | int n, enable; |
271 | 278 | ||
272 | *jmp_ptr = &buf; | 279 | *jmp_ptr = &buf; |
273 | n = UML_SIGSETJMP(&buf, enable); | 280 | n = UML_SETJMP(&buf, enable); |
274 | if(n != 0) | 281 | if(n != 0) |
275 | return(n); | 282 | return(n); |
276 | (*fn)(arg); | 283 | (*fn)(arg); |
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index 045ae0037456..bd89c6b99d5d 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
@@ -344,12 +344,12 @@ int copy_context_skas0(unsigned long new_stack, int pid) | |||
344 | err = ptrace_setregs(pid, regs); | 344 | err = ptrace_setregs(pid, regs); |
345 | if(err < 0) | 345 | if(err < 0) |
346 | panic("copy_context_skas0 : PTRACE_SETREGS failed, " | 346 | panic("copy_context_skas0 : PTRACE_SETREGS failed, " |
347 | "pid = %d, errno = %d\n", pid, errno); | 347 | "pid = %d, errno = %d\n", pid, -err); |
348 | 348 | ||
349 | err = ptrace_setfpregs(pid, fp_regs); | 349 | err = ptrace_setfpregs(pid, fp_regs); |
350 | if(err < 0) | 350 | if(err < 0) |
351 | panic("copy_context_skas0 : PTRACE_SETFPREGS failed, " | 351 | panic("copy_context_skas0 : PTRACE_SETFPREGS failed, " |
352 | "pid = %d, errno = %d\n", pid, errno); | 352 | "pid = %d, errno = %d\n", pid, -err); |
353 | 353 | ||
354 | /* set a well known return code for detection of child write failure */ | 354 | /* set a well known return code for detection of child write failure */ |
355 | child_data->err = 12345678; | 355 | child_data->err = 12345678; |
@@ -362,7 +362,7 @@ int copy_context_skas0(unsigned long new_stack, int pid) | |||
362 | pid = data->err; | 362 | pid = data->err; |
363 | if(pid < 0) | 363 | if(pid < 0) |
364 | panic("copy_context_skas0 - stub-parent reports error %d\n", | 364 | panic("copy_context_skas0 - stub-parent reports error %d\n", |
365 | pid); | 365 | -pid); |
366 | 366 | ||
367 | /* Wait, until child has finished too: read child's result from | 367 | /* Wait, until child has finished too: read child's result from |
368 | * child's stack and check it. | 368 | * child's stack and check it. |
@@ -434,7 +434,7 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, | |||
434 | void (*handler)(int)) | 434 | void (*handler)(int)) |
435 | { | 435 | { |
436 | unsigned long flags; | 436 | unsigned long flags; |
437 | sigjmp_buf switch_buf, fork_buf; | 437 | jmp_buf switch_buf, fork_buf; |
438 | int enable; | 438 | int enable; |
439 | 439 | ||
440 | *switch_buf_ptr = &switch_buf; | 440 | *switch_buf_ptr = &switch_buf; |
@@ -450,7 +450,7 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, | |||
450 | */ | 450 | */ |
451 | flags = get_signals(); | 451 | flags = get_signals(); |
452 | block_signals(); | 452 | block_signals(); |
453 | if(UML_SIGSETJMP(&fork_buf, enable) == 0) | 453 | if(UML_SETJMP(&fork_buf, enable) == 0) |
454 | new_thread_proc(stack, handler); | 454 | new_thread_proc(stack, handler); |
455 | 455 | ||
456 | remove_sigstack(); | 456 | remove_sigstack(); |
@@ -466,35 +466,35 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, | |||
466 | 466 | ||
467 | void thread_wait(void *sw, void *fb) | 467 | void thread_wait(void *sw, void *fb) |
468 | { | 468 | { |
469 | sigjmp_buf buf, **switch_buf = sw, *fork_buf; | 469 | jmp_buf buf, **switch_buf = sw, *fork_buf; |
470 | int enable; | 470 | int enable; |
471 | 471 | ||
472 | *switch_buf = &buf; | 472 | *switch_buf = &buf; |
473 | fork_buf = fb; | 473 | fork_buf = fb; |
474 | if(UML_SIGSETJMP(&buf, enable) == 0) | 474 | if(UML_SETJMP(&buf, enable) == 0) |
475 | siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK); | 475 | siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK); |
476 | } | 476 | } |
477 | 477 | ||
478 | void switch_threads(void *me, void *next) | 478 | void switch_threads(void *me, void *next) |
479 | { | 479 | { |
480 | sigjmp_buf my_buf, **me_ptr = me, *next_buf = next; | 480 | jmp_buf my_buf, **me_ptr = me, *next_buf = next; |
481 | int enable; | 481 | int enable; |
482 | 482 | ||
483 | *me_ptr = &my_buf; | 483 | *me_ptr = &my_buf; |
484 | if(UML_SIGSETJMP(&my_buf, enable) == 0) | 484 | if(UML_SETJMP(&my_buf, enable) == 0) |
485 | UML_SIGLONGJMP(next_buf, 1); | 485 | UML_LONGJMP(next_buf, 1); |
486 | } | 486 | } |
487 | 487 | ||
488 | static sigjmp_buf initial_jmpbuf; | 488 | static jmp_buf initial_jmpbuf; |
489 | 489 | ||
490 | /* XXX Make these percpu */ | 490 | /* XXX Make these percpu */ |
491 | static void (*cb_proc)(void *arg); | 491 | static void (*cb_proc)(void *arg); |
492 | static void *cb_arg; | 492 | static void *cb_arg; |
493 | static sigjmp_buf *cb_back; | 493 | static jmp_buf *cb_back; |
494 | 494 | ||
495 | int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) | 495 | int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) |
496 | { | 496 | { |
497 | sigjmp_buf **switch_buf = switch_buf_ptr; | 497 | jmp_buf **switch_buf = switch_buf_ptr; |
498 | int n, enable; | 498 | int n, enable; |
499 | 499 | ||
500 | set_handler(SIGWINCH, (__sighandler_t) sig_handler, | 500 | set_handler(SIGWINCH, (__sighandler_t) sig_handler, |
@@ -502,7 +502,7 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) | |||
502 | SIGVTALRM, -1); | 502 | SIGVTALRM, -1); |
503 | 503 | ||
504 | *fork_buf_ptr = &initial_jmpbuf; | 504 | *fork_buf_ptr = &initial_jmpbuf; |
505 | n = UML_SIGSETJMP(&initial_jmpbuf, enable); | 505 | n = UML_SETJMP(&initial_jmpbuf, enable); |
506 | switch(n){ | 506 | switch(n){ |
507 | case INIT_JMP_NEW_THREAD: | 507 | case INIT_JMP_NEW_THREAD: |
508 | new_thread_proc((void *) stack, new_thread_handler); | 508 | new_thread_proc((void *) stack, new_thread_handler); |
@@ -512,7 +512,7 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) | |||
512 | break; | 512 | break; |
513 | case INIT_JMP_CALLBACK: | 513 | case INIT_JMP_CALLBACK: |
514 | (*cb_proc)(cb_arg); | 514 | (*cb_proc)(cb_arg); |
515 | UML_SIGLONGJMP(cb_back, 1); | 515 | UML_LONGJMP(cb_back, 1); |
516 | break; | 516 | break; |
517 | case INIT_JMP_HALT: | 517 | case INIT_JMP_HALT: |
518 | kmalloc_ok = 0; | 518 | kmalloc_ok = 0; |
@@ -523,12 +523,12 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) | |||
523 | default: | 523 | default: |
524 | panic("Bad sigsetjmp return in start_idle_thread - %d\n", n); | 524 | panic("Bad sigsetjmp return in start_idle_thread - %d\n", n); |
525 | } | 525 | } |
526 | UML_SIGLONGJMP(*switch_buf, 1); | 526 | UML_LONGJMP(*switch_buf, 1); |
527 | } | 527 | } |
528 | 528 | ||
529 | void initial_thread_cb_skas(void (*proc)(void *), void *arg) | 529 | void initial_thread_cb_skas(void (*proc)(void *), void *arg) |
530 | { | 530 | { |
531 | sigjmp_buf here; | 531 | jmp_buf here; |
532 | int enable; | 532 | int enable; |
533 | 533 | ||
534 | cb_proc = proc; | 534 | cb_proc = proc; |
@@ -536,8 +536,8 @@ void initial_thread_cb_skas(void (*proc)(void *), void *arg) | |||
536 | cb_back = &here; | 536 | cb_back = &here; |
537 | 537 | ||
538 | block_signals(); | 538 | block_signals(); |
539 | if(UML_SIGSETJMP(&here, enable) == 0) | 539 | if(UML_SETJMP(&here, enable) == 0) |
540 | UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK); | 540 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK); |
541 | unblock_signals(); | 541 | unblock_signals(); |
542 | 542 | ||
543 | cb_proc = NULL; | 543 | cb_proc = NULL; |
@@ -548,13 +548,13 @@ void initial_thread_cb_skas(void (*proc)(void *), void *arg) | |||
548 | void halt_skas(void) | 548 | void halt_skas(void) |
549 | { | 549 | { |
550 | block_signals(); | 550 | block_signals(); |
551 | UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_HALT); | 551 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_HALT); |
552 | } | 552 | } |
553 | 553 | ||
554 | void reboot_skas(void) | 554 | void reboot_skas(void) |
555 | { | 555 | { |
556 | block_signals(); | 556 | block_signals(); |
557 | UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); | 557 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); |
558 | } | 558 | } |
559 | 559 | ||
560 | void switch_mm_skas(struct mm_id *mm_idp) | 560 | void switch_mm_skas(struct mm_id *mm_idp) |
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c index 387e26af301a..503148504009 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c | |||
@@ -296,29 +296,7 @@ static void __init check_ptrace(void) | |||
296 | check_sysemu(); | 296 | check_sysemu(); |
297 | } | 297 | } |
298 | 298 | ||
299 | extern int create_tmp_file(unsigned long long len); | 299 | extern void check_tmpexec(void); |
300 | |||
301 | static void check_tmpexec(void) | ||
302 | { | ||
303 | void *addr; | ||
304 | int err, fd = create_tmp_file(UM_KERN_PAGE_SIZE); | ||
305 | |||
306 | addr = mmap(NULL, UM_KERN_PAGE_SIZE, | ||
307 | PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0); | ||
308 | printf("Checking PROT_EXEC mmap in /tmp..."); | ||
309 | fflush(stdout); | ||
310 | if(addr == MAP_FAILED){ | ||
311 | err = errno; | ||
312 | perror("failed"); | ||
313 | if(err == EPERM) | ||
314 | printf("/tmp must be not mounted noexec\n"); | ||
315 | exit(1); | ||
316 | } | ||
317 | printf("OK\n"); | ||
318 | munmap(addr, UM_KERN_PAGE_SIZE); | ||
319 | |||
320 | close(fd); | ||
321 | } | ||
322 | 300 | ||
323 | void os_early_checks(void) | 301 | void os_early_checks(void) |
324 | { | 302 | { |
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c index 7a6f6b99ceff..516f66dd87e3 100644 --- a/arch/um/os-Linux/sys-i386/registers.c +++ b/arch/um/os-Linux/sys-i386/registers.c | |||
@@ -104,7 +104,7 @@ void init_registers(int pid) | |||
104 | err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs); | 104 | err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs); |
105 | if(err) | 105 | if(err) |
106 | panic("check_ptrace : PTRACE_GETREGS failed, errno = %d", | 106 | panic("check_ptrace : PTRACE_GETREGS failed, errno = %d", |
107 | err); | 107 | errno); |
108 | 108 | ||
109 | errno = 0; | 109 | errno = 0; |
110 | err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs); | 110 | err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs); |
@@ -119,7 +119,7 @@ void init_registers(int pid) | |||
119 | err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs); | 119 | err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs); |
120 | if(err) | 120 | if(err) |
121 | panic("check_ptrace : PTRACE_GETFPREGS failed, errno = %d", | 121 | panic("check_ptrace : PTRACE_GETFPREGS failed, errno = %d", |
122 | err); | 122 | errno); |
123 | } | 123 | } |
124 | 124 | ||
125 | void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) | 125 | void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) |
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c index 001941fa1a1e..becd898d9398 100644 --- a/arch/um/os-Linux/sys-x86_64/registers.c +++ b/arch/um/os-Linux/sys-x86_64/registers.c | |||
@@ -62,12 +62,12 @@ void init_registers(int pid) | |||
62 | err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs); | 62 | err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs); |
63 | if(err) | 63 | if(err) |
64 | panic("check_ptrace : PTRACE_GETREGS failed, errno = %d", | 64 | panic("check_ptrace : PTRACE_GETREGS failed, errno = %d", |
65 | err); | 65 | errno); |
66 | 66 | ||
67 | err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs); | 67 | err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs); |
68 | if(err) | 68 | if(err) |
69 | panic("check_ptrace : PTRACE_GETFPREGS failed, errno = %d", | 69 | panic("check_ptrace : PTRACE_GETFPREGS failed, errno = %d", |
70 | err); | 70 | errno); |
71 | } | 71 | } |
72 | 72 | ||
73 | void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) | 73 | void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) |
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c index 6f7626775acb..280c4fb9b585 100644 --- a/arch/um/os-Linux/time.c +++ b/arch/um/os-Linux/time.c | |||
@@ -81,20 +81,12 @@ void uml_idle_timer(void) | |||
81 | set_interval(ITIMER_REAL); | 81 | set_interval(ITIMER_REAL); |
82 | } | 82 | } |
83 | 83 | ||
84 | extern void ktime_get_ts(struct timespec *ts); | ||
85 | #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) | ||
86 | |||
87 | void time_init(void) | 84 | void time_init(void) |
88 | { | 85 | { |
89 | struct timespec now; | ||
90 | |||
91 | if(signal(SIGVTALRM, boot_timer_handler) == SIG_ERR) | 86 | if(signal(SIGVTALRM, boot_timer_handler) == SIG_ERR) |
92 | panic("Couldn't set SIGVTALRM handler"); | 87 | panic("Couldn't set SIGVTALRM handler"); |
93 | set_interval(ITIMER_VIRTUAL); | 88 | set_interval(ITIMER_VIRTUAL); |
94 | 89 | time_init_kern(); | |
95 | do_posix_clock_monotonic_gettime(&now); | ||
96 | wall_to_monotonic.tv_sec = -now.tv_sec; | ||
97 | wall_to_monotonic.tv_nsec = -now.tv_nsec; | ||
98 | } | 90 | } |
99 | 91 | ||
100 | unsigned long long os_nsecs(void) | 92 | unsigned long long os_nsecs(void) |
diff --git a/arch/um/os-Linux/trap.c b/arch/um/os-Linux/trap.c index a9f6b26f9828..90b29ae9af46 100644 --- a/arch/um/os-Linux/trap.c +++ b/arch/um/os-Linux/trap.c | |||
@@ -35,7 +35,7 @@ void os_fill_handlinfo(struct kern_handlers h) | |||
35 | 35 | ||
36 | void do_longjmp(void *b, int val) | 36 | void do_longjmp(void *b, int val) |
37 | { | 37 | { |
38 | sigjmp_buf *buf = b; | 38 | jmp_buf *buf = b; |
39 | 39 | ||
40 | UML_SIGLONGJMP(buf, val); | 40 | UML_LONGJMP(buf, val); |
41 | } | 41 | } |
diff --git a/arch/um/os-Linux/uaccess.c b/arch/um/os-Linux/uaccess.c index 166fb66995df..e523719330b2 100644 --- a/arch/um/os-Linux/uaccess.c +++ b/arch/um/os-Linux/uaccess.c | |||
@@ -16,9 +16,9 @@ unsigned long __do_user_copy(void *to, const void *from, int n, | |||
16 | unsigned long *faddrp = (unsigned long *) fault_addr, ret; | 16 | unsigned long *faddrp = (unsigned long *) fault_addr, ret; |
17 | int enable; | 17 | int enable; |
18 | 18 | ||
19 | sigjmp_buf jbuf; | 19 | jmp_buf jbuf; |
20 | *fault_catcher = &jbuf; | 20 | *fault_catcher = &jbuf; |
21 | if(UML_SIGSETJMP(&jbuf, enable) == 0){ | 21 | if(UML_SETJMP(&jbuf, enable) == 0){ |
22 | (*op)(to, from, n); | 22 | (*op)(to, from, n); |
23 | ret = 0; | 23 | ret = 0; |
24 | *faulted_out = 0; | 24 | *faulted_out = 0; |
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c index 34bfc1bb9e38..362db059fe30 100644 --- a/arch/um/os-Linux/umid.c +++ b/arch/um/os-Linux/umid.c | |||
@@ -178,14 +178,14 @@ static void __init create_pid_file(void) | |||
178 | fd = open(file, O_RDWR | O_CREAT | O_EXCL, 0644); | 178 | fd = open(file, O_RDWR | O_CREAT | O_EXCL, 0644); |
179 | if(fd < 0){ | 179 | if(fd < 0){ |
180 | printk("Open of machine pid file \"%s\" failed: %s\n", | 180 | printk("Open of machine pid file \"%s\" failed: %s\n", |
181 | file, strerror(-fd)); | 181 | file, strerror(errno)); |
182 | return; | 182 | return; |
183 | } | 183 | } |
184 | 184 | ||
185 | snprintf(pid, sizeof(pid), "%d\n", getpid()); | 185 | snprintf(pid, sizeof(pid), "%d\n", getpid()); |
186 | n = write(fd, pid, strlen(pid)); | 186 | n = write(fd, pid, strlen(pid)); |
187 | if(n != strlen(pid)) | 187 | if(n != strlen(pid)) |
188 | printk("Write of pid file failed - err = %d\n", -n); | 188 | printk("Write of pid file failed - err = %d\n", errno); |
189 | 189 | ||
190 | close(fd); | 190 | close(fd); |
191 | } | 191 | } |
diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c index 2598158e1f53..3f33165ada68 100644 --- a/arch/um/os-Linux/user_syms.c +++ b/arch/um/os-Linux/user_syms.c | |||
@@ -96,6 +96,13 @@ EXPORT_SYMBOL_PROTO(getuid); | |||
96 | EXPORT_SYMBOL_PROTO(fsync); | 96 | EXPORT_SYMBOL_PROTO(fsync); |
97 | EXPORT_SYMBOL_PROTO(fdatasync); | 97 | EXPORT_SYMBOL_PROTO(fdatasync); |
98 | 98 | ||
99 | /* Export symbols used by GCC for the stack protector. */ | ||
100 | extern void __stack_smash_handler(void *) __attribute__((weak)); | ||
101 | EXPORT_SYMBOL(__stack_smash_handler); | ||
102 | |||
103 | extern long __guard __attribute__((weak)); | ||
104 | EXPORT_SYMBOL(__guard); | ||
105 | |||
99 | /* | 106 | /* |
100 | * Overrides for Emacs so that we follow Linus's tabbing style. | 107 | * Overrides for Emacs so that we follow Linus's tabbing style. |
101 | * Emacs will notice this stuff at the end of the file and automatically | 108 | * Emacs will notice this stuff at the end of the file and automatically |
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c index e32065e2fdc8..c47a2a7ce70e 100644 --- a/arch/um/os-Linux/util.c +++ b/arch/um/os-Linux/util.c | |||
@@ -104,7 +104,7 @@ void setup_hostinfo(void) | |||
104 | int setjmp_wrapper(void (*proc)(void *, void *), ...) | 104 | int setjmp_wrapper(void (*proc)(void *, void *), ...) |
105 | { | 105 | { |
106 | va_list args; | 106 | va_list args; |
107 | sigjmp_buf buf; | 107 | jmp_buf buf; |
108 | int n; | 108 | int n; |
109 | 109 | ||
110 | n = sigsetjmp(buf, 1); | 110 | n = sigsetjmp(buf, 1); |
diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules index 5e7a9c310aa5..1347dc6d5218 100644 --- a/arch/um/scripts/Makefile.rules +++ b/arch/um/scripts/Makefile.rules | |||
@@ -7,11 +7,19 @@ USER_SINGLE_OBJS := \ | |||
7 | USER_OBJS += $(filter %_user.o,$(obj-y) $(obj-m) $(USER_SINGLE_OBJS)) | 7 | USER_OBJS += $(filter %_user.o,$(obj-y) $(obj-m) $(USER_SINGLE_OBJS)) |
8 | USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) | 8 | USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) |
9 | 9 | ||
10 | $(USER_OBJS) $(USER_OBJS:.o=.i) $(USER_OBJS:.o=.s) $(USER_OBJS:.o=.lst): \ | 10 | $(USER_OBJS:.o=.%): \ |
11 | c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(notdir $@)) | 11 | c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(*F).o) |
12 | $(USER_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \ | 12 | $(USER_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \ |
13 | -Dunix -D__unix__ -D__$(SUBARCH)__ | 13 | -Dunix -D__unix__ -D__$(SUBARCH)__ |
14 | 14 | ||
15 | # These are like USER_OBJS but filter USER_CFLAGS through unprofile instead of | ||
16 | # using it directly. | ||
17 | UNPROFILE_OBJS := $(foreach file,$(UNPROFILE_OBJS),$(obj)/$(file)) | ||
18 | |||
19 | $(UNPROFILE_OBJS:.o=.%): \ | ||
20 | c_flags = -Wp,-MD,$(depfile) $(call unprofile,$(USER_CFLAGS)) $(CFLAGS_$(*F).o) | ||
21 | $(UNPROFILE_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \ | ||
22 | -Dunix -D__unix__ -D__$(SUBARCH)__ | ||
15 | 23 | ||
16 | # The stubs and unmap.o can't try to call mcount or update basic block data | 24 | # The stubs and unmap.o can't try to call mcount or update basic block data |
17 | define unprofile | 25 | define unprofile |
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile index 98b20b7bba4f..374d61a19439 100644 --- a/arch/um/sys-i386/Makefile +++ b/arch/um/sys-i386/Makefile | |||
@@ -8,11 +8,16 @@ subarch-obj-y = lib/bitops.o kernel/semaphore.o | |||
8 | subarch-obj-$(CONFIG_HIGHMEM) += mm/highmem.o | 8 | subarch-obj-$(CONFIG_HIGHMEM) += mm/highmem.o |
9 | subarch-obj-$(CONFIG_MODULES) += kernel/module.o | 9 | subarch-obj-$(CONFIG_MODULES) += kernel/module.o |
10 | 10 | ||
11 | USER_OBJS := bugs.o ptrace_user.o sigcontext.o fault.o stub_segv.o | 11 | USER_OBJS := bugs.o ptrace_user.o sigcontext.o fault.o |
12 | 12 | ||
13 | include arch/um/scripts/Makefile.rules | 13 | USER_OBJS += user-offsets.s |
14 | extra-y += user-offsets.s | ||
14 | 15 | ||
15 | extra-$(CONFIG_MODE_TT) += unmap.o | 16 | extra-$(CONFIG_MODE_TT) += unmap.o |
16 | 17 | ||
17 | $(obj)/stub_segv.o $(obj)/unmap.o: \ | 18 | UNPROFILE_OBJS := stub_segv.o |
18 | _c_flags = $(call unprofile,$(CFLAGS)) | 19 | CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING) |
20 | |||
21 | include arch/um/scripts/Makefile.rules | ||
22 | |||
23 | $(obj)/unmap.%: _c_flags = $(call unprofile,$(CFLAGS)) | ||
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c index 618fd8594643..0709fc6670c2 100644 --- a/arch/um/sys-i386/signal.c +++ b/arch/um/sys-i386/signal.c | |||
@@ -57,7 +57,7 @@ static int copy_sc_from_user_skas(struct pt_regs *regs, | |||
57 | return(0); | 57 | return(0); |
58 | } | 58 | } |
59 | 59 | ||
60 | int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate __user *to_fp, | 60 | int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *to_fp, |
61 | struct pt_regs *regs, unsigned long sp) | 61 | struct pt_regs *regs, unsigned long sp) |
62 | { | 62 | { |
63 | struct sigcontext sc; | 63 | struct sigcontext sc; |
@@ -132,7 +132,7 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from, | |||
132 | return(err); | 132 | return(err); |
133 | } | 133 | } |
134 | 134 | ||
135 | int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate __user *fp, | 135 | int copy_sc_to_user_tt(struct sigcontext __user *to, struct _fpstate __user *fp, |
136 | struct sigcontext *from, int fpsize, unsigned long sp) | 136 | struct sigcontext *from, int fpsize, unsigned long sp) |
137 | { | 137 | { |
138 | struct _fpstate __user *to_fp; | 138 | struct _fpstate __user *to_fp; |
@@ -167,7 +167,7 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from) | |||
167 | return(ret); | 167 | return(ret); |
168 | } | 168 | } |
169 | 169 | ||
170 | static int copy_sc_to_user(struct sigcontext *to, struct _fpstate __user *fp, | 170 | static int copy_sc_to_user(struct sigcontext __user *to, struct _fpstate __user *fp, |
171 | struct pt_regs *from, unsigned long sp) | 171 | struct pt_regs *from, unsigned long sp) |
172 | { | 172 | { |
173 | return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), | 173 | return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), |
diff --git a/arch/um/sys-i386/stub_segv.c b/arch/um/sys-i386/stub_segv.c index a37f672ec964..2355dc19c46c 100644 --- a/arch/um/sys-i386/stub_segv.c +++ b/arch/um/sys-i386/stub_segv.c | |||
@@ -27,6 +27,6 @@ stub_segv_handler(int sig) | |||
27 | * the stack in its original form when we do the sigreturn here, by | 27 | * the stack in its original form when we do the sigreturn here, by |
28 | * hand. | 28 | * hand. |
29 | */ | 29 | */ |
30 | __asm__("mov %0,%%esp ; movl %1, %%eax ; " | 30 | __asm__ __volatile__("mov %0,%%esp ; movl %1, %%eax ; " |
31 | "int $0x80" : : "a" (sc), "g" (__NR_sigreturn)); | 31 | "int $0x80" : : "a" (sc), "g" (__NR_sigreturn)); |
32 | } | 32 | } |
diff --git a/arch/um/sys-i386/syscalls.c b/arch/um/sys-i386/syscalls.c index 749dd1bfe60f..710d5fb807e1 100644 --- a/arch/um/sys-i386/syscalls.c +++ b/arch/um/sys-i386/syscalls.c | |||
@@ -99,11 +99,12 @@ long sys_ipc (uint call, int first, int second, | |||
99 | 99 | ||
100 | switch (call) { | 100 | switch (call) { |
101 | case SEMOP: | 101 | case SEMOP: |
102 | return sys_semtimedop(first, (struct sembuf *) ptr, second, | 102 | return sys_semtimedop(first, (struct sembuf __user *) ptr, |
103 | NULL); | 103 | second, NULL); |
104 | case SEMTIMEDOP: | 104 | case SEMTIMEDOP: |
105 | return sys_semtimedop(first, (struct sembuf *) ptr, second, | 105 | return sys_semtimedop(first, (struct sembuf __user *) ptr, |
106 | (const struct timespec *) fifth); | 106 | second, |
107 | (const struct timespec __user *) fifth); | ||
107 | case SEMGET: | 108 | case SEMGET: |
108 | return sys_semget (first, second, third); | 109 | return sys_semget (first, second, third); |
109 | case SEMCTL: { | 110 | case SEMCTL: { |
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile index b5fc22babddf..c19794d435d6 100644 --- a/arch/um/sys-x86_64/Makefile +++ b/arch/um/sys-x86_64/Makefile | |||
@@ -16,11 +16,16 @@ subarch-obj-$(CONFIG_MODULES) += kernel/module.o | |||
16 | 16 | ||
17 | ldt-y = ../sys-i386/ldt.o | 17 | ldt-y = ../sys-i386/ldt.o |
18 | 18 | ||
19 | USER_OBJS := ptrace_user.o sigcontext.o stub_segv.o | 19 | USER_OBJS := ptrace_user.o sigcontext.o |
20 | 20 | ||
21 | include arch/um/scripts/Makefile.rules | 21 | USER_OBJS += user-offsets.s |
22 | extra-y += user-offsets.s | ||
22 | 23 | ||
23 | extra-$(CONFIG_MODE_TT) += unmap.o | 24 | extra-$(CONFIG_MODE_TT) += unmap.o |
24 | 25 | ||
25 | $(obj)/stub_segv.o $(obj)/unmap.o: \ | 26 | UNPROFILE_OBJS := stub_segv.o |
26 | _c_flags = $(call unprofile,$(CFLAGS)) | 27 | CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING) |
28 | |||
29 | include arch/um/scripts/Makefile.rules | ||
30 | |||
31 | $(obj)/unmap.%: _c_flags = $(call unprofile,$(CFLAGS)) | ||
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c index a4c46a8af008..9edf114faf79 100644 --- a/arch/um/sys-x86_64/signal.c +++ b/arch/um/sys-x86_64/signal.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "skas.h" | 21 | #include "skas.h" |
22 | 22 | ||
23 | static int copy_sc_from_user_skas(struct pt_regs *regs, | 23 | static int copy_sc_from_user_skas(struct pt_regs *regs, |
24 | struct sigcontext *from) | 24 | struct sigcontext __user *from) |
25 | { | 25 | { |
26 | int err = 0; | 26 | int err = 0; |
27 | 27 | ||
@@ -54,7 +54,8 @@ static int copy_sc_from_user_skas(struct pt_regs *regs, | |||
54 | return(err); | 54 | return(err); |
55 | } | 55 | } |
56 | 56 | ||
57 | int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, | 57 | int copy_sc_to_user_skas(struct sigcontext __user *to, |
58 | struct _fpstate __user *to_fp, | ||
58 | struct pt_regs *regs, unsigned long mask, | 59 | struct pt_regs *regs, unsigned long mask, |
59 | unsigned long sp) | 60 | unsigned long sp) |
60 | { | 61 | { |
@@ -106,10 +107,11 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, | |||
106 | #endif | 107 | #endif |
107 | 108 | ||
108 | #ifdef CONFIG_MODE_TT | 109 | #ifdef CONFIG_MODE_TT |
109 | int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, | 110 | int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from, |
110 | int fpsize) | 111 | int fpsize) |
111 | { | 112 | { |
112 | struct _fpstate *to_fp, *from_fp; | 113 | struct _fpstate *to_fp; |
114 | struct _fpstate __user *from_fp; | ||
113 | unsigned long sigs; | 115 | unsigned long sigs; |
114 | int err; | 116 | int err; |
115 | 117 | ||
@@ -124,13 +126,14 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, | |||
124 | return(err); | 126 | return(err); |
125 | } | 127 | } |
126 | 128 | ||
127 | int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp, | 129 | int copy_sc_to_user_tt(struct sigcontext __user *to, struct _fpstate __user *fp, |
128 | struct sigcontext *from, int fpsize, unsigned long sp) | 130 | struct sigcontext *from, int fpsize, unsigned long sp) |
129 | { | 131 | { |
130 | struct _fpstate *to_fp, *from_fp; | 132 | struct _fpstate __user *to_fp; |
133 | struct _fpstate *from_fp; | ||
131 | int err; | 134 | int err; |
132 | 135 | ||
133 | to_fp = (fp ? fp : (struct _fpstate *) (to + 1)); | 136 | to_fp = (fp ? fp : (struct _fpstate __user *) (to + 1)); |
134 | from_fp = from->fpstate; | 137 | from_fp = from->fpstate; |
135 | err = copy_to_user(to, from, sizeof(*to)); | 138 | err = copy_to_user(to, from, sizeof(*to)); |
136 | /* The SP in the sigcontext is the updated one for the signal | 139 | /* The SP in the sigcontext is the updated one for the signal |
@@ -158,7 +161,8 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from) | |||
158 | return(ret); | 161 | return(ret); |
159 | } | 162 | } |
160 | 163 | ||
161 | static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp, | 164 | static int copy_sc_to_user(struct sigcontext __user *to, |
165 | struct _fpstate __user *fp, | ||
162 | struct pt_regs *from, unsigned long mask, | 166 | struct pt_regs *from, unsigned long mask, |
163 | unsigned long sp) | 167 | unsigned long sp) |
164 | { | 168 | { |
@@ -169,7 +173,7 @@ static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp, | |||
169 | 173 | ||
170 | struct rt_sigframe | 174 | struct rt_sigframe |
171 | { | 175 | { |
172 | char *pretcode; | 176 | char __user *pretcode; |
173 | struct ucontext uc; | 177 | struct ucontext uc; |
174 | struct siginfo info; | 178 | struct siginfo info; |
175 | }; | 179 | }; |
@@ -188,7 +192,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, | |||
188 | 192 | ||
189 | frame = (struct rt_sigframe __user *) | 193 | frame = (struct rt_sigframe __user *) |
190 | round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8; | 194 | round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8; |
191 | frame = (struct rt_sigframe *) ((unsigned long) frame - 128); | 195 | frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128); |
192 | 196 | ||
193 | if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) | 197 | if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) |
194 | goto out; | 198 | goto out; |
diff --git a/arch/um/sys-x86_64/stub_segv.c b/arch/um/sys-x86_64/stub_segv.c index a27099533198..1c967026c957 100644 --- a/arch/um/sys-x86_64/stub_segv.c +++ b/arch/um/sys-x86_64/stub_segv.c | |||
@@ -33,7 +33,7 @@ stub_segv_handler(int sig) | |||
33 | struct ucontext *uc; | 33 | struct ucontext *uc; |
34 | int pid; | 34 | int pid; |
35 | 35 | ||
36 | __asm__("movq %%rdx, %0" : "=g" (uc) :); | 36 | __asm__ __volatile__("movq %%rdx, %0" : "=g" (uc) :); |
37 | GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), | 37 | GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), |
38 | &uc->uc_mcontext); | 38 | &uc->uc_mcontext); |
39 | 39 | ||
@@ -44,8 +44,8 @@ stub_segv_handler(int sig) | |||
44 | * the signal frame. So, we use the ucontext pointer, which we know | 44 | * the signal frame. So, we use the ucontext pointer, which we know |
45 | * already, to get the signal frame pointer, and add 8 to that. | 45 | * already, to get the signal frame pointer, and add 8 to that. |
46 | */ | 46 | */ |
47 | __asm__("movq %0, %%rsp; movq %1, %%rax ; syscall": : | 47 | __asm__ __volatile__("movq %0, %%rsp; movq %1, %%rax ; syscall": : |
48 | "g" ((unsigned long) container_of(uc, struct rt_sigframe, | 48 | "g" ((unsigned long) |
49 | uc) + 8), | 49 | container_of(uc, struct rt_sigframe, uc) + 8), |
50 | "g" (__NR_rt_sigreturn)); | 50 | "g" (__NR_rt_sigreturn)); |
51 | } | 51 | } |
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c index 6acee5c4ada6..6fce9f45dfdc 100644 --- a/arch/um/sys-x86_64/syscalls.c +++ b/arch/um/sys-x86_64/syscalls.c | |||
@@ -45,7 +45,7 @@ static long arch_prctl_tt(int code, unsigned long addr) | |||
45 | case ARCH_GET_GS: | 45 | case ARCH_GET_GS: |
46 | ret = arch_prctl(code, (unsigned long) &tmp); | 46 | ret = arch_prctl(code, (unsigned long) &tmp); |
47 | if(!ret) | 47 | if(!ret) |
48 | ret = put_user(tmp, &addr); | 48 | ret = put_user(tmp, (long __user *)addr); |
49 | break; | 49 | break; |
50 | default: | 50 | default: |
51 | ret = -EINVAL; | 51 | ret = -EINVAL; |