Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml

Pull UML updates from Richard Weinberger:
"Mostly fixes for UML:

- First round of fixes for PTRACE_GETRESET/SETREGSET

- A printf vs printk cleanup

- Minor improvements"

* 'for-linus-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
um: Correctly check for PTRACE_GETRESET/SETREGSET
um: v2: Use generic NOTES macro
um: Add kerneldoc for userspace_tramp() and start_userspace()
um: Add kerneldoc for segv_handler
um: stub-data.h: remove superfluous include
um: userspace - be more verbose in ptrace set regs error
um: add dummy ioremap and iounmap functions
um: Allow building and running on older hosts
um: Avoid longjmp/setjmp symbol clashes with libpthread.a
um: console: Ignore console= option
um: Use os_warn to print out pre-boot warning/error messages
um: Add os_warn() for pre-boot warning/error messages
um: Use os_info for the messages on normal path
um: Add os_info() for pre-boot information messages
um: Use printk instead of printf in make_uml_dir

+201 -82
+4
arch/um/Makefile
··· 59 59 # Same things for in6addr_loopback and mktime - found in libc. For these two we 60 60 # only get link-time error, luckily. 61 61 # 62 + # -Dlongjmp=kernel_longjmp prevents anything from referencing the libpthread.a 63 + # embedded copy of longjmp, same thing for setjmp. 64 + # 62 65 # These apply to USER_CFLAGS to. 63 66 64 67 KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \ 65 68 $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \ 69 + -Dlongjmp=kernel_longjmp -Dsetjmp=kernel_setjmp \ 66 70 -Din6addr_loopback=kernel_in6addr_loopback \ 67 71 -Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr 68 72
+3
arch/um/drivers/stdio_console.c
··· 192 192 193 193 static int console_chan_setup(char *str) 194 194 { 195 + if (!strncmp(str, "sole=", 5)) /* console= option specifies tty */ 196 + return 0; 197 + 195 198 line_setup(vt_conf, MAX_TTYS, &def_conf, str, "console"); 196 199 return 1; 197 200 }
+1 -1
arch/um/include/asm/common.lds.S
··· 15 15 PROVIDE (_unprotected_end = .); 16 16 17 17 . = ALIGN(4096); 18 - .note : { *(.note.*) } 18 + NOTES 19 19 EXCEPTION_TABLE(0) 20 20 21 21 BUG_TABLE
+17
arch/um/include/asm/io.h
··· 1 + #ifndef _ASM_UM_IO_H 2 + #define _ASM_UM_IO_H 3 + 4 + #define ioremap ioremap 5 + static inline void __iomem *ioremap(phys_addr_t offset, size_t size) 6 + { 7 + return (void __iomem *)(unsigned long)offset; 8 + } 9 + 10 + #define iounmap iounmap 11 + static inline void iounmap(void __iomem *addr) 12 + { 13 + } 14 + 15 + #include <asm-generic/io.h> 16 + 17 + #endif
+4
arch/um/include/shared/os.h
··· 242 242 extern void os_dump_core(void) __attribute__ ((noreturn)); 243 243 extern void um_early_printk(const char *s, unsigned int n); 244 244 extern void os_fix_helper_signals(void); 245 + extern void os_info(const char *fmt, ...) 246 + __attribute__ ((format (printf, 1, 2))); 247 + extern void os_warn(const char *fmt, ...) 248 + __attribute__ ((format (printf, 1, 2))); 245 249 246 250 /* time.c */ 247 251 extern void os_idle_sleep(unsigned long long nsecs);
-2
arch/um/include/shared/skas/stub-data.h
··· 8 8 #ifndef __STUB_DATA_H 9 9 #define __STUB_DATA_H 10 10 11 - #include <time.h> 12 - 13 11 struct stub_data { 14 12 unsigned long offset; 15 13 int fd;
+5 -5
arch/um/kernel/physmem.c
··· 89 89 offset = uml_reserved - uml_physmem; 90 90 map_size = len - offset; 91 91 if(map_size <= 0) { 92 - printf("Too few physical memory! Needed=%d, given=%d\n", 93 - offset, len); 92 + os_warn("Too few physical memory! Needed=%lu, given=%lu\n", 93 + offset, len); 94 94 exit(1); 95 95 } 96 96 ··· 99 99 err = os_map_memory((void *) uml_reserved, physmem_fd, offset, 100 100 map_size, 1, 1, 1); 101 101 if (err < 0) { 102 - printf("setup_physmem - mapping %ld bytes of memory at 0x%p " 103 - "failed - errno = %d\n", map_size, 104 - (void *) uml_reserved, err); 102 + os_warn("setup_physmem - mapping %ld bytes of memory at 0x%p " 103 + "failed - errno = %d\n", map_size, 104 + (void *) uml_reserved, err); 105 105 exit(1); 106 106 } 107 107
+10
arch/um/kernel/trap.c
··· 183 183 os_dump_core(); 184 184 } 185 185 186 + /** 187 + * segv_handler() - the SIGSEGV handler 188 + * @sig: the signal number 189 + * @unused_si: the signal info struct; unused in this handler 190 + * @regs: the ptrace register information 191 + * 192 + * The handler first extracts the faultinfo from the UML ptrace regs struct. 193 + * If the userfault did not happen in an UML userspace process, bad_segv is called. 194 + * Otherwise the signal did happen in a cloned userspace process, handle it. 195 + */ 186 196 void segv_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs) 187 197 { 188 198 struct faultinfo * fi = UPT_FAULTINFO(regs);
+9 -7
arch/um/kernel/um_arch.c
··· 34 34 static void __init add_arg(char *arg) 35 35 { 36 36 if (strlen(command_line) + strlen(arg) + 1 > COMMAND_LINE_SIZE) { 37 - printf("add_arg: Too many command line arguments!\n"); 37 + os_warn("add_arg: Too many command line arguments!\n"); 38 38 exit(1); 39 39 } 40 40 if (strlen(command_line) > 0) ··· 120 120 121 121 static int __init uml_version_setup(char *line, int *add) 122 122 { 123 + /* Explicitly use printf() to show version in stdout */ 123 124 printf("%s\n", init_utsname()->release); 124 125 exit(0); 125 126 ··· 149 148 150 149 static int __init no_skas_debug_setup(char *line, int *add) 151 150 { 152 - printf("'debug' is not necessary to gdb UML in skas mode - run \n"); 153 - printf("'gdb linux'\n"); 151 + os_warn("'debug' is not necessary to gdb UML in skas mode - run\n"); 152 + os_warn("'gdb linux'\n"); 154 153 155 154 return 0; 156 155 } ··· 166 165 167 166 printf(usage_string, init_utsname()->release); 168 167 p = &__uml_help_start; 168 + /* Explicitly use printf() to show help in stdout */ 169 169 while (p < &__uml_help_end) { 170 170 printf("%s", *p); 171 171 p++; ··· 285 283 286 284 diff = UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end); 287 285 if (diff > 1024 * 1024) { 288 - printf("Adding %ld bytes to physical memory to account for " 289 - "exec-shield gap\n", diff); 286 + os_info("Adding %ld bytes to physical memory to account for " 287 + "exec-shield gap\n", diff); 290 288 physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end); 291 289 } 292 290 ··· 326 324 end_vm = start_vm + virtmem_size; 327 325 328 326 if (virtmem_size < physmem_size) 329 - printf("Kernel virtual memory size shrunk to %lu bytes\n", 330 - virtmem_size); 327 + os_info("Kernel virtual memory size shrunk to %lu bytes\n", 328 + virtmem_size); 331 329 332 330 os_flush_stdout(); 333 331
+2 -2
arch/um/kernel/umid.c
··· 16 16 int err; 17 17 18 18 if (umid_inited) { 19 - printf("umid already set\n"); 19 + os_warn("umid already set\n"); 20 20 return 0; 21 21 } 22 22 23 23 *add = 0; 24 24 err = set_umid(name); 25 25 if (err == -EEXIST) 26 - printf("umid '%s' already in use\n", name); 26 + os_warn("umid '%s' already in use\n", name); 27 27 else if (!err) 28 28 umid_inited = 1; 29 29
+1 -1
arch/um/os-Linux/execvp.c
··· 136 136 int ret; 137 137 argc--; 138 138 if (!argc) { 139 - fprintf(stderr, "Not enough arguments\n"); 139 + os_warn("Not enough arguments\n"); 140 140 return 1; 141 141 } 142 142 argv++;
+4 -5
arch/um/os-Linux/main.c
··· 74 74 action.sa_restorer = NULL; 75 75 action.sa_handler = last_ditch_exit; 76 76 if (sigaction(sig, &action, NULL) < 0) { 77 - printf("failed to install handler for signal %d - errno = %d\n", 78 - sig, errno); 77 + os_warn("failed to install handler for signal %d " 78 + "- errno = %d\n", sig, errno); 79 79 exit(1); 80 80 } 81 81 } ··· 175 175 /* disable SIGIO for the fds and set SIGIO to be ignored */ 176 176 err = deactivate_all_fds(); 177 177 if (err) 178 - printf("deactivate_all_fds failed, errno = %d\n", -err); 178 + os_warn("deactivate_all_fds failed, errno = %d\n", -err); 179 179 180 180 /* 181 181 * Let any pending signals fire now. This ensures ··· 184 184 */ 185 185 unblock_signals(); 186 186 187 + os_info("\n"); 187 188 /* Reboot */ 188 189 if (ret) { 189 - printf("\n"); 190 190 execvp(new_argv[0], new_argv); 191 191 perror("Failed to exec kernel"); 192 192 ret = 1; 193 193 } 194 - printf("\n"); 195 194 return uml_exitcode; 196 195 } 197 196
+14 -14
arch/um/os-Linux/mem.c
··· 25 25 { 26 26 struct statfs st; 27 27 28 - printf("Checking if %s is on tmpfs...", dir); 28 + os_info("Checking if %s is on tmpfs...", dir); 29 29 if (statfs(dir, &st) < 0) { 30 - printf("%s\n", strerror(errno)); 30 + os_info("%s\n", strerror(errno)); 31 31 } else if (st.f_type != TMPFS_MAGIC) { 32 - printf("no\n"); 32 + os_info("no\n"); 33 33 } else { 34 - printf("OK\n"); 34 + os_info("OK\n"); 35 35 return 0; 36 36 } 37 37 return -1; ··· 61 61 int i; 62 62 const char *dir; 63 63 64 - printf("Checking environment variables for a tempdir..."); 64 + os_info("Checking environment variables for a tempdir..."); 65 65 for (i = 0; vars[i]; i++) { 66 66 dir = getenv(vars[i]); 67 67 if ((dir != NULL) && (*dir != '\0')) { 68 - printf("%s\n", dir); 68 + os_info("%s\n", dir); 69 69 if (check_tmpfs(dir) >= 0) 70 70 goto done; 71 71 else 72 72 goto warn; 73 73 } 74 74 } 75 - printf("none found\n"); 75 + os_info("none found\n"); 76 76 77 77 for (i = 0; tmpfs_dirs[i]; i++) { 78 78 dir = tmpfs_dirs[i]; ··· 82 82 83 83 dir = fallback_dir; 84 84 warn: 85 - printf("Warning: tempdir %s is not on tmpfs\n", dir); 85 + os_warn("Warning: tempdir %s is not on tmpfs\n", dir); 86 86 done: 87 87 /* Make a copy since getenv results may not remain valid forever. */ 88 88 return strdup(dir); ··· 100 100 if (tempdir == NULL) { 101 101 tempdir = choose_tempdir(); 102 102 if (tempdir == NULL) { 103 - fprintf(stderr, "Failed to choose tempdir: %s\n", 103 + os_warn("Failed to choose tempdir: %s\n", 104 104 strerror(errno)); 105 105 return -1; 106 106 } ··· 125 125 strcat(tempname, template); 126 126 fd = mkstemp(tempname); 127 127 if (fd < 0) { 128 - fprintf(stderr, "open - cannot create %s: %s\n", tempname, 128 + os_warn("open - cannot create %s: %s\n", tempname, 129 129 strerror(errno)); 130 130 goto out; 131 131 } ··· 194 194 195 195 addr = mmap(NULL, UM_KERN_PAGE_SIZE, 196 196 PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0); 197 - printf("Checking PROT_EXEC mmap in %s...", tempdir); 197 + os_info("Checking PROT_EXEC mmap in %s...", tempdir); 198 198 if (addr == MAP_FAILED) { 199 199 err = errno; 200 - printf("%s\n", strerror(err)); 200 + os_warn("%s\n", strerror(err)); 201 201 close(fd); 202 202 if (err == EPERM) 203 - printf("%s must be not mounted noexec\n", tempdir); 203 + os_warn("%s must be not mounted noexec\n", tempdir); 204 204 exit(1); 205 205 } 206 - printf("OK\n"); 206 + os_info("OK\n"); 207 207 munmap(addr, UM_KERN_PAGE_SIZE); 208 208 209 209 close(fd);
+38 -3
arch/um/os-Linux/skas/process.c
··· 108 108 wait_stub_done(pid); 109 109 110 110 /* 111 - * faultinfo is prepared by the stub-segv-handler at start of 111 + * faultinfo is prepared by the stub_segv_handler at start of 112 112 * the stub stack page. We just have to copy it. 113 113 */ 114 114 memcpy(fi, (void *)current_stub_stack(), sizeof(*fi)); ··· 175 175 176 176 extern char __syscall_stub_start[]; 177 177 178 + /** 179 + * userspace_tramp() - userspace trampoline 180 + * @stack: pointer to the new userspace stack page, can be NULL, if? FIXME: 181 + * 182 + * The userspace trampoline is used to setup a new userspace process in start_userspace() after it was clone()'ed. 183 + * This function will run on a temporary stack page. 184 + * It ptrace()'es itself, then 185 + * Two pages are mapped into the userspace address space: 186 + * - STUB_CODE (with EXEC), which contains the skas stub code 187 + * - STUB_DATA (with R/W), which contains a data page that is used to transfer certain data between the UML userspace process and the UML kernel. 188 + * Also for the userspace process a SIGSEGV handler is installed to catch pagefaults in the userspace process. 189 + * And last the process stops itself to give control to the UML kernel for this userspace process. 190 + * 191 + * Return: Always zero, otherwise the current userspace process is ended with non null exit() call 192 + */ 178 193 static int userspace_tramp(void *stack) 179 194 { 180 195 void *addr; ··· 251 236 252 237 int userspace_pid[NR_CPUS]; 253 238 239 + /** 240 + * start_userspace() - prepare a new userspace process 241 + * @stub_stack: pointer to the stub stack. Can be NULL, if? FIXME: 242 + * 243 + * Setups a new temporary stack page that is used while userspace_tramp() runs 244 + * Clones the kernel process into a new userspace process, with FDs only. 245 + * 246 + * Return: When positive: the process id of the new userspace process, 247 + * when negative: an error number. 248 + * FIXME: can PIDs become negative?! 249 + */ 254 250 int start_userspace(unsigned long stub_stack) 255 251 { 256 252 void *stack; 257 253 unsigned long sp; 258 254 int pid, status, n, flags, err; 259 255 256 + /* setup a temporary stack page */ 260 257 stack = mmap(NULL, UM_KERN_PAGE_SIZE, 261 258 PROT_READ | PROT_WRITE | PROT_EXEC, 262 259 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); ··· 279 252 return err; 280 253 } 281 254 255 + /* set stack pointer to the end of the stack page, so it can grow downwards */ 282 256 sp = (unsigned long) stack + UM_KERN_PAGE_SIZE - sizeof(void *); 283 257 284 258 flags = CLONE_FILES | SIGCHLD; 285 259 260 + /* clone into new userspace process */ 286 261 pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack); 287 262 if (pid < 0) { 288 263 err = -errno; ··· 352 323 * fail. In this case, there is nothing to do but 353 324 * just kill the process. 354 325 */ 355 - if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) 326 + if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) { 327 + printk(UM_KERN_ERR "userspace - ptrace set regs " 328 + "failed, errno = %d\n", errno); 356 329 fatal_sigsegv(); 330 + } 357 331 358 - if (put_fp_registers(pid, regs->fp)) 332 + if (put_fp_registers(pid, regs->fp)) { 333 + printk(UM_KERN_ERR "userspace - ptrace set fp regs " 334 + "failed, errno = %d\n", errno); 359 335 fatal_sigsegv(); 336 + } 360 337 361 338 /* Now we set local_using_sysemu to be used for one loop */ 362 339 local_using_sysemu = get_using_sysemu();
+15 -13
arch/um/os-Linux/start_up.c
··· 166 166 unsigned long regs[MAX_REG_NR]; 167 167 int pid, n, status, count=0; 168 168 169 - non_fatal("Checking syscall emulation patch for ptrace..."); 169 + os_info("Checking syscall emulation patch for ptrace..."); 170 170 sysemu_supported = 0; 171 171 pid = start_ptraced_child(); 172 172 ··· 199 199 goto fail_stopped; 200 200 201 201 sysemu_supported = 1; 202 - non_fatal("OK\n"); 202 + os_info("OK\n"); 203 203 set_using_sysemu(!force_sysemu_disabled); 204 204 205 - non_fatal("Checking advanced syscall emulation patch for ptrace..."); 205 + os_info("Checking advanced syscall emulation patch for ptrace..."); 206 206 pid = start_ptraced_child(); 207 207 208 208 if ((ptrace(PTRACE_OLDSETOPTIONS, pid, 0, ··· 244 244 goto fail_stopped; 245 245 246 246 sysemu_supported = 2; 247 - non_fatal("OK\n"); 247 + os_info("OK\n"); 248 248 249 249 if (!force_sysemu_disabled) 250 250 set_using_sysemu(sysemu_supported); ··· 260 260 { 261 261 int pid, syscall, n, status; 262 262 263 - non_fatal("Checking that ptrace can change system call numbers..."); 263 + os_info("Checking that ptrace can change system call numbers..."); 264 264 pid = start_ptraced_child(); 265 265 266 266 if ((ptrace(PTRACE_OLDSETOPTIONS, pid, 0, ··· 292 292 } 293 293 } 294 294 stop_ptraced_child(pid, 0, 1); 295 - non_fatal("OK\n"); 295 + os_info("OK\n"); 296 296 check_sysemu(); 297 297 } 298 298 ··· 308 308 return; 309 309 } 310 310 311 - printf("Core dump limits :\n\tsoft - "); 311 + os_info("Core dump limits :\n\tsoft - "); 312 312 if (lim.rlim_cur == RLIM_INFINITY) 313 - printf("NONE\n"); 314 - else printf("%lu\n", lim.rlim_cur); 313 + os_info("NONE\n"); 314 + else 315 + os_info("%llu\n", (unsigned long long)lim.rlim_cur); 315 316 316 - printf("\thard - "); 317 + os_info("\thard - "); 317 318 if (lim.rlim_max == RLIM_INFINITY) 318 - printf("NONE\n"); 319 - else printf("%lu\n", lim.rlim_max); 319 + os_info("NONE\n"); 320 + else 321 + os_info("%llu\n", (unsigned long long)lim.rlim_max); 320 322 } 321 323 322 324 void __init os_early_checks(void) ··· 351 349 driver = str; 352 350 file = strchr(str,','); 353 351 if (file == NULL) { 354 - fprintf(stderr, "parse_iomem : failed to parse iomem\n"); 352 + os_warn("parse_iomem : failed to parse iomem\n"); 355 353 goto out; 356 354 } 357 355 *file = '\0';
+11 -8
arch/um/os-Linux/umid.c
··· 35 35 36 36 err = -ENOENT; 37 37 if (home == NULL) { 38 - printk(UM_KERN_ERR "make_uml_dir : no value in " 39 - "environment for $HOME\n"); 38 + printk(UM_KERN_ERR 39 + "%s: no value in environment for $HOME\n", 40 + __func__); 40 41 goto err; 41 42 } 42 43 strlcpy(dir, home, sizeof(dir)); ··· 51 50 err = -ENOMEM; 52 51 uml_dir = malloc(strlen(dir) + 1); 53 52 if (uml_dir == NULL) { 54 - printf("make_uml_dir : malloc failed, errno = %d\n", errno); 53 + printk(UM_KERN_ERR "%s : malloc failed, errno = %d\n", 54 + __func__, errno); 55 55 goto err; 56 56 } 57 57 strcpy(uml_dir, dir); 58 58 59 59 if ((mkdir(uml_dir, 0777) < 0) && (errno != EEXIST)) { 60 - printf("Failed to mkdir '%s': %s\n", uml_dir, strerror(errno)); 60 + printk(UM_KERN_ERR "Failed to mkdir '%s': %s\n", 61 + uml_dir, strerror(errno)); 61 62 err = -errno; 62 63 goto err_free; 63 64 } ··· 354 351 static int __init set_uml_dir(char *name, int *add) 355 352 { 356 353 if (*name == '\0') { 357 - printf("uml_dir can't be an empty string\n"); 354 + os_warn("uml_dir can't be an empty string\n"); 358 355 return 0; 359 356 } 360 357 ··· 365 362 366 363 uml_dir = malloc(strlen(name) + 2); 367 364 if (uml_dir == NULL) { 368 - printf("Failed to malloc uml_dir - error = %d\n", errno); 365 + os_warn("Failed to malloc uml_dir - error = %d\n", errno); 369 366 370 367 /* 371 368 * Return 0 here because do_initcalls doesn't look at ··· 390 387 sprintf(dir, "%s%s", uml_dir, umid); 391 388 err = remove_files_and_dir(dir); 392 389 if (err) 393 - printf("remove_umid_dir - remove_files_and_dir failed with " 394 - "err = %d\n", err); 390 + os_warn("%s - remove_files_and_dir failed with err = %d\n", 391 + __func__, err); 395 392 } 396 393 397 394 __uml_exitcall(remove_umid_dir);
+34
arch/um/os-Linux/util.c
··· 13 13 #include <wait.h> 14 14 #include <sys/mman.h> 15 15 #include <sys/utsname.h> 16 + #include <init.h> 16 17 #include <os.h> 17 18 18 19 void stack_protections(unsigned long address) ··· 152 151 void um_early_printk(const char *s, unsigned int n) 153 152 { 154 153 printf("%.*s", n, s); 154 + } 155 + 156 + static int quiet_info; 157 + 158 + static int __init quiet_cmd_param(char *str, int *add) 159 + { 160 + quiet_info = 1; 161 + return 0; 162 + } 163 + 164 + __uml_setup("quiet", quiet_cmd_param, 165 + "quiet\n" 166 + " Turns off information messages during boot.\n\n"); 167 + 168 + void os_info(const char *fmt, ...) 169 + { 170 + va_list list; 171 + 172 + if (quiet_info) 173 + return; 174 + 175 + va_start(list, fmt); 176 + vfprintf(stderr, fmt, list); 177 + va_end(list); 178 + } 179 + 180 + void os_warn(const char *fmt, ...) 181 + { 182 + va_list list; 183 + 184 + va_start(list, fmt); 185 + vfprintf(stderr, fmt, list); 186 + va_end(list); 155 187 }
+8 -4
arch/x86/um/os-Linux/registers.c
··· 26 26 27 27 int save_fp_registers(int pid, unsigned long *fp_regs) 28 28 { 29 + #ifdef PTRACE_GETREGSET 29 30 struct iovec iov; 30 31 31 32 if (have_xstate_support) { ··· 35 34 if (ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, &iov) < 0) 36 35 return -errno; 37 36 return 0; 38 - } else { 37 + } else 38 + #endif 39 39 return save_i387_registers(pid, fp_regs); 40 - } 41 40 } 42 41 43 42 int restore_i387_registers(int pid, unsigned long *fp_regs) ··· 49 48 50 49 int restore_fp_registers(int pid, unsigned long *fp_regs) 51 50 { 51 + #ifdef PTRACE_SETREGSET 52 52 struct iovec iov; 53 53 54 54 if (have_xstate_support) { ··· 58 56 if (ptrace(PTRACE_SETREGSET, pid, NT_X86_XSTATE, &iov) < 0) 59 57 return -errno; 60 58 return 0; 61 - } else { 59 + } else 60 + #endif 62 61 return restore_i387_registers(pid, fp_regs); 63 - } 64 62 } 65 63 66 64 #ifdef __i386__ ··· 124 122 125 123 void arch_init_registers(int pid) 126 124 { 125 + #ifdef PTRACE_GETREGSET 127 126 struct _xstate fp_regs; 128 127 struct iovec iov; 129 128 ··· 132 129 iov.iov_len = sizeof(struct _xstate); 133 130 if (ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, &iov) == 0) 134 131 have_xstate_support = 1; 132 + #endif 135 133 } 136 134 #endif 137 135
+8 -8
arch/x86/um/setjmp_32.S
··· 16 16 17 17 .text 18 18 .align 4 19 - .globl setjmp 20 - .type setjmp, @function 21 - setjmp: 19 + .globl kernel_setjmp 20 + .type kernel_setjmp, @function 21 + kernel_setjmp: 22 22 #ifdef _REGPARM 23 23 movl %eax,%edx 24 24 #else ··· 35 35 movl %ecx,20(%edx) # Return address 36 36 ret 37 37 38 - .size setjmp,.-setjmp 38 + .size kernel_setjmp,.-kernel_setjmp 39 39 40 40 .text 41 41 .align 4 42 - .globl longjmp 43 - .type longjmp, @function 44 - longjmp: 42 + .globl kernel_longjmp 43 + .type kernel_longjmp, @function 44 + kernel_longjmp: 45 45 #ifdef _REGPARM 46 46 xchgl %eax,%edx 47 47 #else ··· 55 55 movl 16(%edx),%edi 56 56 jmp *20(%edx) 57 57 58 - .size longjmp,.-longjmp 58 + .size kernel_longjmp,.-kernel_longjmp
+8 -8
arch/x86/um/setjmp_64.S
··· 18 18 19 19 .text 20 20 .align 4 21 - .globl setjmp 22 - .type setjmp, @function 23 - setjmp: 21 + .globl kernel_setjmp 22 + .type kernel_setjmp, @function 23 + kernel_setjmp: 24 24 pop %rsi # Return address, and adjust the stack 25 25 xorl %eax,%eax # Return value 26 26 movq %rbx,(%rdi) ··· 34 34 movq %rsi,56(%rdi) # Return address 35 35 ret 36 36 37 - .size setjmp,.-setjmp 37 + .size kernel_setjmp,.-kernel_setjmp 38 38 39 39 .text 40 40 .align 4 41 - .globl longjmp 42 - .type longjmp, @function 43 - longjmp: 41 + .globl kernel_longjmp 42 + .type kernel_longjmp, @function 43 + kernel_longjmp: 44 44 movl %esi,%eax # Return value (int) 45 45 movq (%rdi),%rbx 46 46 movq 8(%rdi),%rsp ··· 51 51 movq 48(%rdi),%r15 52 52 jmp *56(%rdi) 53 53 54 - .size longjmp,.-longjmp 54 + .size kernel_longjmp,.-kernel_longjmp
+5 -1
arch/x86/um/user-offsets.c
··· 5 5 #include <sys/mman.h> 6 6 #include <sys/user.h> 7 7 #define __FRAME_OFFSETS 8 - #include <asm/ptrace.h> 8 + #include <linux/ptrace.h> 9 9 #include <asm/types.h> 10 10 11 11 #ifdef __i386__ ··· 50 50 DEFINE(HOST_GS, GS); 51 51 DEFINE(HOST_ORIG_AX, ORIG_EAX); 52 52 #else 53 + #if defined(PTRACE_GETREGSET) && defined(PTRACE_SETREGSET) 53 54 DEFINE(HOST_FP_SIZE, sizeof(struct _xstate) / sizeof(unsigned long)); 55 + #else 56 + DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long)); 57 + #endif 54 58 DEFINE_LONGS(HOST_BX, RBX); 55 59 DEFINE_LONGS(HOST_CX, RCX); 56 60 DEFINE_LONGS(HOST_DI, RDI);