diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-29 21:12:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-29 21:12:23 -0400 |
commit | a591afc01d9e48affbacb365558a31e53c85af45 (patch) | |
tree | 9bb91f4eb94ec69fc4706c4944788ec5f3586063 /kernel | |
parent | 820d41cf0cd0e94a5661e093821e2e5c6b36a9d8 (diff) | |
parent | 31796ac4e8f0e88f5c10f1ad6dab8f19bebe44a4 (diff) |
Merge branch 'x86-x32-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x32 support for x86-64 from Ingo Molnar:
"This tree introduces the X32 binary format and execution mode for x86:
32-bit data space binaries using 64-bit instructions and 64-bit kernel
syscalls.
This allows applications whose working set fits into a 32 bits address
space to make use of 64-bit instructions while using a 32-bit address
space with shorter pointers, more compressed data structures, etc."
Fix up trivial context conflicts in arch/x86/{Kconfig,vdso/vma.c}
* 'x86-x32-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (71 commits)
x32: Fix alignment fail in struct compat_siginfo
x32: Fix stupid ia32/x32 inversion in the siginfo format
x32: Add ptrace for x32
x32: Switch to a 64-bit clock_t
x32: Provide separate is_ia32_task() and is_x32_task() predicates
x86, mtrr: Use explicit sizing and padding for the 64-bit ioctls
x86/x32: Fix the binutils auto-detect
x32: Warn and disable rather than error if binutils too old
x32: Only clear TIF_X32 flag once
x32: Make sure TS_COMPAT is cleared for x32 tasks
fs: Remove missed ->fds_bits from cessation use of fd_set structs internally
fs: Fix close_on_exec pointer in alloc_fdtable
x32: Drop non-__vdso weak symbols from the x32 VDSO
x32: Fix coding style violations in the x32 VDSO code
x32: Add x32 VDSO support
x32: Allow x32 to be configured
x32: If configured, add x32 system calls to system call tables
x32: Handle process creation
x32: Signal-related system calls
x86: Add #ifdef CONFIG_COMPAT to <asm/sys_ia32.h>
...
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/compat.c | 68 | ||||
-rw-r--r-- | kernel/exit.c | 2 |
2 files changed, 61 insertions, 9 deletions
diff --git a/kernel/compat.c b/kernel/compat.c index f346cedfe24d..74ff8498809a 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -31,11 +31,10 @@ | |||
31 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
32 | 32 | ||
33 | /* | 33 | /* |
34 | * Note that the native side is already converted to a timespec, because | 34 | * Get/set struct timeval with struct timespec on the native side |
35 | * that's what we want anyway. | ||
36 | */ | 35 | */ |
37 | static int compat_get_timeval(struct timespec *o, | 36 | static int compat_get_timeval_convert(struct timespec *o, |
38 | struct compat_timeval __user *i) | 37 | struct compat_timeval __user *i) |
39 | { | 38 | { |
40 | long usec; | 39 | long usec; |
41 | 40 | ||
@@ -46,8 +45,8 @@ static int compat_get_timeval(struct timespec *o, | |||
46 | return 0; | 45 | return 0; |
47 | } | 46 | } |
48 | 47 | ||
49 | static int compat_put_timeval(struct compat_timeval __user *o, | 48 | static int compat_put_timeval_convert(struct compat_timeval __user *o, |
50 | struct timeval *i) | 49 | struct timeval *i) |
51 | { | 50 | { |
52 | return (put_user(i->tv_sec, &o->tv_sec) || | 51 | return (put_user(i->tv_sec, &o->tv_sec) || |
53 | put_user(i->tv_usec, &o->tv_usec)) ? -EFAULT : 0; | 52 | put_user(i->tv_usec, &o->tv_usec)) ? -EFAULT : 0; |
@@ -117,7 +116,7 @@ asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, | |||
117 | if (tv) { | 116 | if (tv) { |
118 | struct timeval ktv; | 117 | struct timeval ktv; |
119 | do_gettimeofday(&ktv); | 118 | do_gettimeofday(&ktv); |
120 | if (compat_put_timeval(tv, &ktv)) | 119 | if (compat_put_timeval_convert(tv, &ktv)) |
121 | return -EFAULT; | 120 | return -EFAULT; |
122 | } | 121 | } |
123 | if (tz) { | 122 | if (tz) { |
@@ -135,7 +134,7 @@ asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, | |||
135 | struct timezone ktz; | 134 | struct timezone ktz; |
136 | 135 | ||
137 | if (tv) { | 136 | if (tv) { |
138 | if (compat_get_timeval(&kts, tv)) | 137 | if (compat_get_timeval_convert(&kts, tv)) |
139 | return -EFAULT; | 138 | return -EFAULT; |
140 | } | 139 | } |
141 | if (tz) { | 140 | if (tz) { |
@@ -146,12 +145,29 @@ asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, | |||
146 | return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); | 145 | return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); |
147 | } | 146 | } |
148 | 147 | ||
148 | int get_compat_timeval(struct timeval *tv, const struct compat_timeval __user *ctv) | ||
149 | { | ||
150 | return (!access_ok(VERIFY_READ, ctv, sizeof(*ctv)) || | ||
151 | __get_user(tv->tv_sec, &ctv->tv_sec) || | ||
152 | __get_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0; | ||
153 | } | ||
154 | EXPORT_SYMBOL_GPL(get_compat_timeval); | ||
155 | |||
156 | int put_compat_timeval(const struct timeval *tv, struct compat_timeval __user *ctv) | ||
157 | { | ||
158 | return (!access_ok(VERIFY_WRITE, ctv, sizeof(*ctv)) || | ||
159 | __put_user(tv->tv_sec, &ctv->tv_sec) || | ||
160 | __put_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0; | ||
161 | } | ||
162 | EXPORT_SYMBOL_GPL(put_compat_timeval); | ||
163 | |||
149 | int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts) | 164 | int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts) |
150 | { | 165 | { |
151 | return (!access_ok(VERIFY_READ, cts, sizeof(*cts)) || | 166 | return (!access_ok(VERIFY_READ, cts, sizeof(*cts)) || |
152 | __get_user(ts->tv_sec, &cts->tv_sec) || | 167 | __get_user(ts->tv_sec, &cts->tv_sec) || |
153 | __get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; | 168 | __get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; |
154 | } | 169 | } |
170 | EXPORT_SYMBOL_GPL(get_compat_timespec); | ||
155 | 171 | ||
156 | int put_compat_timespec(const struct timespec *ts, struct compat_timespec __user *cts) | 172 | int put_compat_timespec(const struct timespec *ts, struct compat_timespec __user *cts) |
157 | { | 173 | { |
@@ -161,6 +177,42 @@ int put_compat_timespec(const struct timespec *ts, struct compat_timespec __user | |||
161 | } | 177 | } |
162 | EXPORT_SYMBOL_GPL(put_compat_timespec); | 178 | EXPORT_SYMBOL_GPL(put_compat_timespec); |
163 | 179 | ||
180 | int compat_get_timeval(struct timeval *tv, const void __user *utv) | ||
181 | { | ||
182 | if (COMPAT_USE_64BIT_TIME) | ||
183 | return copy_from_user(tv, utv, sizeof *tv) ? -EFAULT : 0; | ||
184 | else | ||
185 | return get_compat_timeval(tv, utv); | ||
186 | } | ||
187 | EXPORT_SYMBOL_GPL(compat_get_timeval); | ||
188 | |||
189 | int compat_put_timeval(const struct timeval *tv, void __user *utv) | ||
190 | { | ||
191 | if (COMPAT_USE_64BIT_TIME) | ||
192 | return copy_to_user(utv, tv, sizeof *tv) ? -EFAULT : 0; | ||
193 | else | ||
194 | return put_compat_timeval(tv, utv); | ||
195 | } | ||
196 | EXPORT_SYMBOL_GPL(compat_put_timeval); | ||
197 | |||
198 | int compat_get_timespec(struct timespec *ts, const void __user *uts) | ||
199 | { | ||
200 | if (COMPAT_USE_64BIT_TIME) | ||
201 | return copy_from_user(ts, uts, sizeof *ts) ? -EFAULT : 0; | ||
202 | else | ||
203 | return get_compat_timespec(ts, uts); | ||
204 | } | ||
205 | EXPORT_SYMBOL_GPL(compat_get_timespec); | ||
206 | |||
207 | int compat_put_timespec(const struct timespec *ts, void __user *uts) | ||
208 | { | ||
209 | if (COMPAT_USE_64BIT_TIME) | ||
210 | return copy_to_user(uts, ts, sizeof *ts) ? -EFAULT : 0; | ||
211 | else | ||
212 | return put_compat_timespec(ts, uts); | ||
213 | } | ||
214 | EXPORT_SYMBOL_GPL(compat_put_timespec); | ||
215 | |||
164 | static long compat_nanosleep_restart(struct restart_block *restart) | 216 | static long compat_nanosleep_restart(struct restart_block *restart) |
165 | { | 217 | { |
166 | struct compat_timespec __user *rmtp; | 218 | struct compat_timespec __user *rmtp; |
diff --git a/kernel/exit.c b/kernel/exit.c index 3db1909faed9..d8bd3b425fa7 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -474,7 +474,7 @@ static void close_files(struct files_struct * files) | |||
474 | i = j * __NFDBITS; | 474 | i = j * __NFDBITS; |
475 | if (i >= fdt->max_fds) | 475 | if (i >= fdt->max_fds) |
476 | break; | 476 | break; |
477 | set = fdt->open_fds->fds_bits[j++]; | 477 | set = fdt->open_fds[j++]; |
478 | while (set) { | 478 | while (set) { |
479 | if (set & 1) { | 479 | if (set & 1) { |
480 | struct file * file = xchg(&fdt->fd[i], NULL); | 480 | struct file * file = xchg(&fdt->fd[i], NULL); |