diff options
| author | Jeff Garzik <jeff@garzik.org> | 2006-04-12 17:52:52 -0400 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-04-12 17:52:52 -0400 |
| commit | 32ea89ecb25789b1b7db28146558587a42f3b372 (patch) | |
| tree | c5b3b33523b353f2eab2d8dcd2b3f069826cdc48 /arch/um | |
| parent | 58a7ce64426394a46e80cdc9440cc1e7c195e85d (diff) | |
| parent | a145410dccdb44f81d3b56763ef9b6f721f4e47c (diff) | |
Merge branch 'master'
Diffstat (limited to 'arch/um')
27 files changed, 146 insertions, 78 deletions
diff --git a/arch/um/Makefile b/arch/um/Makefile index 24790bed2054..a508e7a02891 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile | |||
| @@ -159,6 +159,7 @@ archclean: | |||
| 159 | $(SYMLINK_HEADERS): | 159 | $(SYMLINK_HEADERS): |
| 160 | @echo ' SYMLINK $@' | 160 | @echo ' SYMLINK $@' |
| 161 | ifneq ($(KBUILD_SRC),) | 161 | ifneq ($(KBUILD_SRC),) |
| 162 | $(Q)mkdir -p $(objtree)/include/asm-um | ||
| 162 | $(Q)ln -fsn $(srctree)/include/asm-um/$(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $@ | 163 | $(Q)ln -fsn $(srctree)/include/asm-um/$(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $@ |
| 163 | else | 164 | else |
| 164 | $(Q)cd $(TOPDIR)/$(dir $@) ; \ | 165 | $(Q)cd $(TOPDIR)/$(dir $@) ; \ |
| @@ -168,7 +169,7 @@ endif | |||
| 168 | include/asm-um/arch: | 169 | include/asm-um/arch: |
| 169 | @echo ' SYMLINK $@' | 170 | @echo ' SYMLINK $@' |
| 170 | ifneq ($(KBUILD_SRC),) | 171 | ifneq ($(KBUILD_SRC),) |
| 171 | $(Q)mkdir -p include/asm-um | 172 | $(Q)mkdir -p $(objtree)/include/asm-um |
| 172 | $(Q)ln -fsn $(srctree)/include/asm-$(SUBARCH) include/asm-um/arch | 173 | $(Q)ln -fsn $(srctree)/include/asm-$(SUBARCH) include/asm-um/arch |
| 173 | else | 174 | else |
| 174 | $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch | 175 | $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch |
diff --git a/arch/um/drivers/cow.h b/arch/um/drivers/cow.h index 04e3958266e0..dc36b222100b 100644 --- a/arch/um/drivers/cow.h +++ b/arch/um/drivers/cow.h | |||
| @@ -46,7 +46,7 @@ extern int file_reader(__u64 offset, char *buf, int len, void *arg); | |||
| 46 | extern int read_cow_header(int (*reader)(__u64, char *, int, void *), | 46 | extern int read_cow_header(int (*reader)(__u64, char *, int, void *), |
| 47 | void *arg, __u32 *version_out, | 47 | void *arg, __u32 *version_out, |
| 48 | char **backing_file_out, time_t *mtime_out, | 48 | char **backing_file_out, time_t *mtime_out, |
| 49 | __u64 *size_out, int *sectorsize_out, | 49 | unsigned long long *size_out, int *sectorsize_out, |
| 50 | __u32 *align_out, int *bitmap_offset_out); | 50 | __u32 *align_out, int *bitmap_offset_out); |
| 51 | 51 | ||
| 52 | extern int write_cow_header(char *cow_file, int fd, char *backing_file, | 52 | extern int write_cow_header(char *cow_file, int fd, char *backing_file, |
diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h index 94de4ead4f7a..7a5b4afde692 100644 --- a/arch/um/drivers/cow_sys.h +++ b/arch/um/drivers/cow_sys.h | |||
| @@ -28,7 +28,7 @@ static inline int cow_seek_file(int fd, __u64 offset) | |||
| 28 | return(os_seek_file(fd, offset)); | 28 | return(os_seek_file(fd, offset)); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | static inline int cow_file_size(char *file, __u64 *size_out) | 31 | static inline int cow_file_size(char *file, unsigned long long *size_out) |
| 32 | { | 32 | { |
| 33 | return(os_file_size(file, size_out)); | 33 | return(os_file_size(file, size_out)); |
| 34 | } | 34 | } |
diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c index 61951b721268..0ec4052db9c5 100644 --- a/arch/um/drivers/cow_user.c +++ b/arch/um/drivers/cow_user.c | |||
| @@ -17,30 +17,34 @@ | |||
| 17 | 17 | ||
| 18 | #define PATH_LEN_V1 256 | 18 | #define PATH_LEN_V1 256 |
| 19 | 19 | ||
| 20 | typedef __u32 time32_t; | ||
| 21 | |||
| 20 | struct cow_header_v1 { | 22 | struct cow_header_v1 { |
| 21 | int magic; | 23 | __s32 magic; |
| 22 | int version; | 24 | __s32 version; |
| 23 | char backing_file[PATH_LEN_V1]; | 25 | char backing_file[PATH_LEN_V1]; |
| 24 | time_t mtime; | 26 | time32_t mtime; |
| 25 | __u64 size; | 27 | __u64 size; |
| 26 | int sectorsize; | 28 | __s32 sectorsize; |
| 27 | }; | 29 | } __attribute__((packed)); |
| 28 | 30 | ||
| 29 | #define PATH_LEN_V2 MAXPATHLEN | 31 | /* Define PATH_LEN_V3 as the usual value of MAXPATHLEN, just hard-code it in |
| 32 | * case other systems have different values for MAXPATHLEN. | ||
| 33 | * | ||
| 34 | * The same must hold for V2 - we want file format compatibility, not anything | ||
| 35 | * else. | ||
| 36 | */ | ||
| 37 | #define PATH_LEN_V3 4096 | ||
| 38 | #define PATH_LEN_V2 PATH_LEN_V3 | ||
| 30 | 39 | ||
| 31 | struct cow_header_v2 { | 40 | struct cow_header_v2 { |
| 32 | __u32 magic; | 41 | __u32 magic; |
| 33 | __u32 version; | 42 | __u32 version; |
| 34 | char backing_file[PATH_LEN_V2]; | 43 | char backing_file[PATH_LEN_V2]; |
| 35 | time_t mtime; | 44 | time32_t mtime; |
| 36 | __u64 size; | 45 | __u64 size; |
| 37 | int sectorsize; | 46 | __s32 sectorsize; |
| 38 | }; | 47 | } __attribute__((packed)); |
| 39 | |||
| 40 | /* Define PATH_LEN_V3 as the usual value of MAXPATHLEN, just hard-code it in | ||
| 41 | * case other systems have different values for MAXPATHLEN | ||
| 42 | */ | ||
| 43 | #define PATH_LEN_V3 4096 | ||
| 44 | 48 | ||
| 45 | /* Changes from V2 - | 49 | /* Changes from V2 - |
| 46 | * PATH_LEN_V3 as described above | 50 | * PATH_LEN_V3 as described above |
| @@ -66,6 +70,15 @@ struct cow_header_v2 { | |||
| 66 | * Fixed (finally!) the rounding bug | 70 | * Fixed (finally!) the rounding bug |
| 67 | */ | 71 | */ |
| 68 | 72 | ||
| 73 | /* Until Dec2005, __attribute__((packed)) was left out from the below | ||
| 74 | * definition, leading on 64-bit systems to 4 bytes of padding after mtime, to | ||
| 75 | * align size to 8-byte alignment. This shifted all fields above (no padding | ||
| 76 | * was present on 32-bit, no other padding was added). | ||
| 77 | * | ||
| 78 | * However, this _can be detected_: it means that cow_format (always 0 until | ||
| 79 | * now) is shifted onto the first 4 bytes of backing_file, where it is otherwise | ||
| 80 | * impossible to find 4 zeros. -bb */ | ||
| 81 | |||
| 69 | struct cow_header_v3 { | 82 | struct cow_header_v3 { |
| 70 | __u32 magic; | 83 | __u32 magic; |
| 71 | __u32 version; | 84 | __u32 version; |
| @@ -75,6 +88,18 @@ struct cow_header_v3 { | |||
| 75 | __u32 alignment; | 88 | __u32 alignment; |
| 76 | __u32 cow_format; | 89 | __u32 cow_format; |
| 77 | char backing_file[PATH_LEN_V3]; | 90 | char backing_file[PATH_LEN_V3]; |
| 91 | } __attribute__((packed)); | ||
| 92 | |||
| 93 | /* This is the broken layout used by some 64-bit binaries. */ | ||
| 94 | struct cow_header_v3_broken { | ||
| 95 | __u32 magic; | ||
| 96 | __u32 version; | ||
| 97 | __s64 mtime; | ||
| 98 | __u64 size; | ||
| 99 | __u32 sectorsize; | ||
| 100 | __u32 alignment; | ||
| 101 | __u32 cow_format; | ||
| 102 | char backing_file[PATH_LEN_V3]; | ||
| 78 | }; | 103 | }; |
| 79 | 104 | ||
| 80 | /* COW format definitions - for now, we have only the usual COW bitmap */ | 105 | /* COW format definitions - for now, we have only the usual COW bitmap */ |
| @@ -84,6 +109,7 @@ union cow_header { | |||
| 84 | struct cow_header_v1 v1; | 109 | struct cow_header_v1 v1; |
| 85 | struct cow_header_v2 v2; | 110 | struct cow_header_v2 v2; |
| 86 | struct cow_header_v3 v3; | 111 | struct cow_header_v3 v3; |
| 112 | struct cow_header_v3_broken v3_b; | ||
| 87 | }; | 113 | }; |
| 88 | 114 | ||
| 89 | #define COW_MAGIC 0x4f4f4f4d /* MOOO */ | 115 | #define COW_MAGIC 0x4f4f4f4d /* MOOO */ |
| @@ -184,8 +210,9 @@ int write_cow_header(char *cow_file, int fd, char *backing_file, | |||
| 184 | 210 | ||
| 185 | err = -EINVAL; | 211 | err = -EINVAL; |
| 186 | if(strlen(backing_file) > sizeof(header->backing_file) - 1){ | 212 | if(strlen(backing_file) > sizeof(header->backing_file) - 1){ |
| 213 | /* Below, %zd is for a size_t value */ | ||
| 187 | cow_printf("Backing file name \"%s\" is too long - names are " | 214 | cow_printf("Backing file name \"%s\" is too long - names are " |
| 188 | "limited to %d characters\n", backing_file, | 215 | "limited to %zd characters\n", backing_file, |
| 189 | sizeof(header->backing_file) - 1); | 216 | sizeof(header->backing_file) - 1); |
| 190 | goto out_free; | 217 | goto out_free; |
| 191 | } | 218 | } |
| @@ -300,7 +327,8 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg, | |||
| 300 | *align_out = *sectorsize_out; | 327 | *align_out = *sectorsize_out; |
| 301 | file = header->v2.backing_file; | 328 | file = header->v2.backing_file; |
| 302 | } | 329 | } |
| 303 | else if(version == 3){ | 330 | /* This is very subtle - see above at union cow_header definition */ |
| 331 | else if(version == 3 && (*((int*)header->v3.backing_file) != 0)){ | ||
| 304 | if(n < sizeof(header->v3)){ | 332 | if(n < sizeof(header->v3)){ |
| 305 | cow_printf("read_cow_header - failed to read V3 " | 333 | cow_printf("read_cow_header - failed to read V3 " |
| 306 | "header\n"); | 334 | "header\n"); |
| @@ -310,9 +338,43 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg, | |||
| 310 | *size_out = ntohll(header->v3.size); | 338 | *size_out = ntohll(header->v3.size); |
| 311 | *sectorsize_out = ntohl(header->v3.sectorsize); | 339 | *sectorsize_out = ntohl(header->v3.sectorsize); |
| 312 | *align_out = ntohl(header->v3.alignment); | 340 | *align_out = ntohl(header->v3.alignment); |
| 341 | if (*align_out == 0) { | ||
| 342 | cow_printf("read_cow_header - invalid COW header, " | ||
| 343 | "align == 0\n"); | ||
| 344 | } | ||
| 313 | *bitmap_offset_out = ROUND_UP(sizeof(header->v3), *align_out); | 345 | *bitmap_offset_out = ROUND_UP(sizeof(header->v3), *align_out); |
| 314 | file = header->v3.backing_file; | 346 | file = header->v3.backing_file; |
| 315 | } | 347 | } |
| 348 | else if(version == 3){ | ||
| 349 | cow_printf("read_cow_header - broken V3 file with" | ||
| 350 | " 64-bit layout - recovering content.\n"); | ||
| 351 | |||
| 352 | if(n < sizeof(header->v3_b)){ | ||
| 353 | cow_printf("read_cow_header - failed to read V3 " | ||
| 354 | "header\n"); | ||
| 355 | goto out; | ||
| 356 | } | ||
| 357 | |||
| 358 | /* this was used until Dec2005 - 64bits are needed to represent | ||
| 359 | * 2038+. I.e. we can safely do this truncating cast. | ||
| 360 | * | ||
| 361 | * Additionally, we must use ntohl() instead of ntohll(), since | ||
| 362 | * the program used to use the former (tested - I got mtime | ||
| 363 | * mismatch "0 vs whatever"). | ||
| 364 | * | ||
| 365 | * Ever heard about bug-to-bug-compatibility ? ;-) */ | ||
| 366 | *mtime_out = (time32_t) ntohl(header->v3_b.mtime); | ||
| 367 | |||
| 368 | *size_out = ntohll(header->v3_b.size); | ||
| 369 | *sectorsize_out = ntohl(header->v3_b.sectorsize); | ||
| 370 | *align_out = ntohl(header->v3_b.alignment); | ||
| 371 | if (*align_out == 0) { | ||
| 372 | cow_printf("read_cow_header - invalid COW header, " | ||
| 373 | "align == 0\n"); | ||
| 374 | } | ||
| 375 | *bitmap_offset_out = ROUND_UP(sizeof(header->v3_b), *align_out); | ||
| 376 | file = header->v3_b.backing_file; | ||
| 377 | } | ||
| 316 | else { | 378 | else { |
| 317 | cow_printf("read_cow_header - invalid COW version\n"); | 379 | cow_printf("read_cow_header - invalid COW version\n"); |
| 318 | goto out; | 380 | goto out; |
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index 28e3760e8b98..6d7173fc55a3 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c | |||
| @@ -62,7 +62,7 @@ static void mc_work_proc(void *unused) | |||
| 62 | unsigned long flags; | 62 | unsigned long flags; |
| 63 | 63 | ||
| 64 | while(!list_empty(&mc_requests)){ | 64 | while(!list_empty(&mc_requests)){ |
| 65 | local_save_flags(flags); | 65 | local_irq_save(flags); |
| 66 | req = list_entry(mc_requests.next, struct mconsole_entry, | 66 | req = list_entry(mc_requests.next, struct mconsole_entry, |
| 67 | list); | 67 | list); |
| 68 | list_del(&req->list); | 68 | list_del(&req->list); |
| @@ -87,7 +87,7 @@ static irqreturn_t mconsole_interrupt(int irq, void *dev_id, | |||
| 87 | if(req.cmd->context == MCONSOLE_INTR) | 87 | if(req.cmd->context == MCONSOLE_INTR) |
| 88 | (*req.cmd->handler)(&req); | 88 | (*req.cmd->handler)(&req); |
| 89 | else { | 89 | else { |
| 90 | new = kmalloc(sizeof(*new), GFP_ATOMIC); | 90 | new = kmalloc(sizeof(*new), GFP_NOWAIT); |
| 91 | if(new == NULL) | 91 | if(new == NULL) |
| 92 | mconsole_reply(&req, "Out of memory", 1, 0); | 92 | mconsole_reply(&req, "Out of memory", 1, 0); |
| 93 | else { | 93 | else { |
| @@ -415,7 +415,6 @@ static int mem_config(char *str) | |||
| 415 | 415 | ||
| 416 | unplugged = page_address(page); | 416 | unplugged = page_address(page); |
| 417 | if(unplug_index == UNPLUGGED_PER_PAGE){ | 417 | if(unplug_index == UNPLUGGED_PER_PAGE){ |
| 418 | INIT_LIST_HEAD(&unplugged->list); | ||
| 419 | list_add(&unplugged->list, &unplugged_pages); | 418 | list_add(&unplugged->list, &unplugged_pages); |
| 420 | unplug_index = 0; | 419 | unplug_index = 0; |
| 421 | } | 420 | } |
| @@ -616,7 +615,7 @@ static void console_write(struct console *console, const char *string, | |||
| 616 | return; | 615 | return; |
| 617 | 616 | ||
| 618 | while(1){ | 617 | while(1){ |
| 619 | n = min((size_t)len, ARRAY_SIZE(console_buf) - console_index); | 618 | n = min((size_t) len, ARRAY_SIZE(console_buf) - console_index); |
| 620 | strncpy(&console_buf[console_index], string, n); | 619 | strncpy(&console_buf[console_index], string, n); |
| 621 | console_index += n; | 620 | console_index += n; |
| 622 | string += n; | 621 | string += n; |
| @@ -655,7 +654,6 @@ static void with_console(struct mc_request *req, void (*proc)(void *), | |||
| 655 | struct mconsole_entry entry; | 654 | struct mconsole_entry entry; |
| 656 | unsigned long flags; | 655 | unsigned long flags; |
| 657 | 656 | ||
| 658 | INIT_LIST_HEAD(&entry.list); | ||
| 659 | entry.request = *req; | 657 | entry.request = *req; |
| 660 | list_add(&entry.list, &clients); | 658 | list_add(&entry.list, &clients); |
| 661 | spin_lock_irqsave(&console_lock, flags); | 659 | spin_lock_irqsave(&console_lock, flags); |
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c index 0e2f06187ea7..0a7786e00cfb 100644 --- a/arch/um/drivers/net_user.c +++ b/arch/um/drivers/net_user.c | |||
| @@ -182,7 +182,9 @@ static int change_tramp(char **argv, char *output, int output_len) | |||
| 182 | pe_data.stdout = fds[1]; | 182 | pe_data.stdout = fds[1]; |
| 183 | pid = run_helper(change_pre_exec, &pe_data, argv, NULL); | 183 | pid = run_helper(change_pre_exec, &pe_data, argv, NULL); |
| 184 | 184 | ||
| 185 | read_output(fds[0], output, output_len); | 185 | if (pid > 0) /* Avoid hang as we won't get data in failure case. */ |
| 186 | read_output(fds[0], output, output_len); | ||
| 187 | |||
| 186 | os_close_file(fds[0]); | 188 | os_close_file(fds[0]); |
| 187 | os_close_file(fds[1]); | 189 | os_close_file(fds[1]); |
| 188 | 190 | ||
diff --git a/arch/um/drivers/slirp_user.c b/arch/um/drivers/slirp_user.c index b94c66114bc8..33c5f6e625e8 100644 --- a/arch/um/drivers/slirp_user.c +++ b/arch/um/drivers/slirp_user.c | |||
| @@ -104,7 +104,7 @@ static void slirp_close(int fd, void *data) | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | if(err == 0) { | 106 | if(err == 0) { |
| 107 | printk("slirp_close: process %d has not exited\n"); | 107 | printk("slirp_close: process %d has not exited\n", pri->pid); |
| 108 | return; | 108 | return; |
| 109 | } | 109 | } |
| 110 | 110 | ||
diff --git a/arch/um/include/kern_util.h b/arch/um/include/kern_util.h index 42557130a408..efa3d33c0be6 100644 --- a/arch/um/include/kern_util.h +++ b/arch/um/include/kern_util.h | |||
| @@ -117,10 +117,6 @@ extern struct task_struct *get_task(int pid, int require); | |||
| 117 | extern void machine_halt(void); | 117 | extern void machine_halt(void); |
| 118 | extern int is_syscall(unsigned long addr); | 118 | extern int is_syscall(unsigned long addr); |
| 119 | 119 | ||
| 120 | extern void arch_switch_to_tt(struct task_struct *from, struct task_struct *to); | ||
| 121 | |||
| 122 | extern void arch_switch_to_skas(struct task_struct *from, struct task_struct *to); | ||
| 123 | |||
| 124 | extern void free_irq(unsigned int, void *); | 120 | extern void free_irq(unsigned int, void *); |
| 125 | extern int cpu(void); | 121 | extern int cpu(void); |
| 126 | 122 | ||
diff --git a/arch/um/include/tt/tt.h b/arch/um/include/tt/tt.h index 808521980186..acb8356e1f98 100644 --- a/arch/um/include/tt/tt.h +++ b/arch/um/include/tt/tt.h | |||
| @@ -19,7 +19,8 @@ extern int fork_tramp(void *sig_stack); | |||
| 19 | extern int do_proc_op(void *t, int proc_id); | 19 | extern int do_proc_op(void *t, int proc_id); |
| 20 | extern int tracer(int (*init_proc)(void *), void *sp); | 20 | extern int tracer(int (*init_proc)(void *), void *sp); |
| 21 | extern void attach_process(int pid); | 21 | extern void attach_process(int pid); |
| 22 | extern void tracer_panic(char *format, ...); | 22 | extern void tracer_panic(char *format, ...) |
| 23 | __attribute__ ((format (printf, 1, 2))); | ||
| 23 | extern void set_init_pid(int pid); | 24 | extern void set_init_pid(int pid); |
| 24 | extern int set_user_mode(void *task); | 25 | extern int set_user_mode(void *task); |
| 25 | extern void set_tracing(void *t, int tracing); | 26 | extern void set_tracing(void *t, int tracing); |
diff --git a/arch/um/include/user.h b/arch/um/include/user.h index 91b0ac4ad88c..39f8c8801076 100644 --- a/arch/um/include/user.h +++ b/arch/um/include/user.h | |||
| @@ -6,8 +6,10 @@ | |||
| 6 | #ifndef __USER_H__ | 6 | #ifndef __USER_H__ |
| 7 | #define __USER_H__ | 7 | #define __USER_H__ |
| 8 | 8 | ||
| 9 | extern void panic(const char *fmt, ...); | 9 | extern void panic(const char *fmt, ...) |
| 10 | extern int printk(const char *fmt, ...); | 10 | __attribute__ ((format (printf, 1, 2))); |
| 11 | extern int printk(const char *fmt, ...) | ||
| 12 | __attribute__ ((format (printf, 1, 2))); | ||
| 11 | extern void schedule(void); | 13 | extern void schedule(void); |
| 12 | extern void *um_kmalloc(int size); | 14 | extern void *um_kmalloc(int size); |
| 13 | extern void *um_kmalloc_atomic(int size); | 15 | extern void *um_kmalloc_atomic(int size); |
diff --git a/arch/um/include/user_util.h b/arch/um/include/user_util.h index fe0c29b5144d..802d7842514d 100644 --- a/arch/um/include/user_util.h +++ b/arch/um/include/user_util.h | |||
| @@ -55,7 +55,8 @@ extern int get_pty(void); | |||
| 55 | extern void *um_kmalloc(int size); | 55 | extern void *um_kmalloc(int size); |
| 56 | extern int switcheroo(int fd, int prot, void *from, void *to, int size); | 56 | extern int switcheroo(int fd, int prot, void *from, void *to, int size); |
| 57 | extern void do_exec(int old_pid, int new_pid); | 57 | extern void do_exec(int old_pid, int new_pid); |
| 58 | extern void tracer_panic(char *msg, ...); | 58 | extern void tracer_panic(char *msg, ...) |
| 59 | __attribute__ ((format (printf, 1, 2))); | ||
| 59 | extern int detach(int pid, int sig); | 60 | extern int detach(int pid, int sig); |
| 60 | extern int attach(int pid); | 61 | extern int attach(int pid); |
| 61 | extern void kill_child_dead(int pid); | 62 | extern void kill_child_dead(int pid); |
diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c index 7713e7a6f476..432cf0b97a13 100644 --- a/arch/um/kernel/ksyms.c +++ b/arch/um/kernel/ksyms.c | |||
| @@ -39,7 +39,6 @@ EXPORT_SYMBOL(um_virt_to_phys); | |||
| 39 | EXPORT_SYMBOL(mode_tt); | 39 | EXPORT_SYMBOL(mode_tt); |
| 40 | EXPORT_SYMBOL(handle_page_fault); | 40 | EXPORT_SYMBOL(handle_page_fault); |
| 41 | EXPORT_SYMBOL(find_iomem); | 41 | EXPORT_SYMBOL(find_iomem); |
| 42 | EXPORT_SYMBOL(end_iomem); | ||
| 43 | 42 | ||
| 44 | #ifdef CONFIG_MODE_TT | 43 | #ifdef CONFIG_MODE_TT |
| 45 | EXPORT_SYMBOL(strncpy_from_user_tt); | 44 | EXPORT_SYMBOL(strncpy_from_user_tt); |
| @@ -89,12 +88,10 @@ EXPORT_SYMBOL(dump_thread); | |||
| 89 | EXPORT_SYMBOL(do_gettimeofday); | 88 | EXPORT_SYMBOL(do_gettimeofday); |
| 90 | EXPORT_SYMBOL(do_settimeofday); | 89 | EXPORT_SYMBOL(do_settimeofday); |
| 91 | 90 | ||
| 92 | /* This is here because UML expands open to sys_open, not to a system | 91 | /* This is here because UML expands lseek to sys_lseek, not to a system |
| 93 | * call instruction. | 92 | * call instruction. |
| 94 | */ | 93 | */ |
| 95 | EXPORT_SYMBOL(sys_open); | ||
| 96 | EXPORT_SYMBOL(sys_lseek); | 94 | EXPORT_SYMBOL(sys_lseek); |
| 97 | EXPORT_SYMBOL(sys_read); | ||
| 98 | EXPORT_SYMBOL(sys_wait4); | 95 | EXPORT_SYMBOL(sys_wait4); |
| 99 | 96 | ||
| 100 | #ifdef CONFIG_SMP | 97 | #ifdef CONFIG_SMP |
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c index 901b85e8a1c6..8f49507e64ef 100644 --- a/arch/um/os-Linux/drivers/ethertap_user.c +++ b/arch/um/os-Linux/drivers/ethertap_user.c | |||
| @@ -40,7 +40,7 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask, | |||
| 40 | int fd) | 40 | int fd) |
| 41 | { | 41 | { |
| 42 | struct addr_change change; | 42 | struct addr_change change; |
| 43 | void *output; | 43 | char *output; |
| 44 | int n; | 44 | int n; |
| 45 | 45 | ||
| 46 | change.what = op; | 46 | change.what = op; |
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c index 6490a4ff40ac..6987d1d247a2 100644 --- a/arch/um/os-Linux/helper.c +++ b/arch/um/os-Linux/helper.c | |||
| @@ -43,7 +43,7 @@ static int helper_child(void *arg) | |||
| 43 | (*data->pre_exec)(data->pre_data); | 43 | (*data->pre_exec)(data->pre_data); |
| 44 | execvp(argv[0], argv); | 44 | execvp(argv[0], argv); |
| 45 | errval = errno; | 45 | errval = errno; |
| 46 | printk("execvp of '%s' failed - errno = %d\n", argv[0], errno); | 46 | printk("helper_child - execve of '%s' failed - errno = %d\n", argv[0], errno); |
| 47 | os_write_file(data->fd, &errval, sizeof(errval)); | 47 | os_write_file(data->fd, &errval, sizeof(errval)); |
| 48 | kill(os_getpid(), SIGKILL); | 48 | kill(os_getpid(), SIGKILL); |
| 49 | return(0); | 49 | return(0); |
| @@ -92,15 +92,15 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, | |||
| 92 | close(fds[1]); | 92 | close(fds[1]); |
| 93 | fds[1] = -1; | 93 | fds[1] = -1; |
| 94 | 94 | ||
| 95 | /*Read the errno value from the child.*/ | 95 | /* Read the errno value from the child, if the exec failed, or get 0 if |
| 96 | * the exec succeeded because the pipe fd was set as close-on-exec. */ | ||
| 96 | n = os_read_file(fds[0], &ret, sizeof(ret)); | 97 | n = os_read_file(fds[0], &ret, sizeof(ret)); |
| 97 | if(n < 0){ | 98 | if (n < 0) { |
| 98 | printk("run_helper : read on pipe failed, ret = %d\n", -n); | 99 | printk("run_helper : read on pipe failed, ret = %d\n", -n); |
| 99 | ret = n; | 100 | ret = n; |
| 100 | kill(pid, SIGKILL); | 101 | kill(pid, SIGKILL); |
| 101 | CATCH_EINTR(waitpid(pid, NULL, 0)); | 102 | CATCH_EINTR(waitpid(pid, NULL, 0)); |
| 102 | } | 103 | } else if(n != 0){ |
| 103 | else if(n != 0){ | ||
| 104 | CATCH_EINTR(n = waitpid(pid, NULL, 0)); | 104 | CATCH_EINTR(n = waitpid(pid, NULL, 0)); |
| 105 | ret = -errno; | 105 | ret = -errno; |
| 106 | } else { | 106 | } else { |
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c index 6ab372da9657..71bb90a7606d 100644 --- a/arch/um/os-Linux/mem.c +++ b/arch/um/os-Linux/mem.c | |||
| @@ -53,33 +53,36 @@ static void __init find_tempdir(void) | |||
| 53 | */ | 53 | */ |
| 54 | int make_tempfile(const char *template, char **out_tempname, int do_unlink) | 54 | int make_tempfile(const char *template, char **out_tempname, int do_unlink) |
| 55 | { | 55 | { |
| 56 | char tempname[MAXPATHLEN]; | 56 | char *tempname; |
| 57 | int fd; | 57 | int fd; |
| 58 | 58 | ||
| 59 | tempname = malloc(MAXPATHLEN); | ||
| 60 | |||
| 59 | find_tempdir(); | 61 | find_tempdir(); |
| 60 | if (*template != '/') | 62 | if (template[0] != '/') |
| 61 | strcpy(tempname, tempdir); | 63 | strcpy(tempname, tempdir); |
| 62 | else | 64 | else |
| 63 | *tempname = 0; | 65 | tempname[0] = '\0'; |
| 64 | strcat(tempname, template); | 66 | strcat(tempname, template); |
| 65 | fd = mkstemp(tempname); | 67 | fd = mkstemp(tempname); |
| 66 | if(fd < 0){ | 68 | if(fd < 0){ |
| 67 | fprintf(stderr, "open - cannot create %s: %s\n", tempname, | 69 | fprintf(stderr, "open - cannot create %s: %s\n", tempname, |
| 68 | strerror(errno)); | 70 | strerror(errno)); |
| 69 | return -1; | 71 | goto out; |
| 70 | } | 72 | } |
| 71 | if(do_unlink && (unlink(tempname) < 0)){ | 73 | if(do_unlink && (unlink(tempname) < 0)){ |
| 72 | perror("unlink"); | 74 | perror("unlink"); |
| 73 | return -1; | 75 | goto out; |
| 74 | } | 76 | } |
| 75 | if(out_tempname){ | 77 | if(out_tempname){ |
| 76 | *out_tempname = strdup(tempname); | 78 | *out_tempname = tempname; |
| 77 | if(*out_tempname == NULL){ | 79 | } else { |
| 78 | perror("strdup"); | 80 | free(tempname); |
| 79 | return -1; | ||
| 80 | } | ||
| 81 | } | 81 | } |
| 82 | return(fd); | 82 | return(fd); |
| 83 | out: | ||
| 84 | free(tempname); | ||
| 85 | return -1; | ||
| 83 | } | 86 | } |
| 84 | 87 | ||
| 85 | #define TEMPNAME_TEMPLATE "vm_file-XXXXXX" | 88 | #define TEMPNAME_TEMPLATE "vm_file-XXXXXX" |
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c index 9ba942947146..00e9388e947a 100644 --- a/arch/um/os-Linux/sigio.c +++ b/arch/um/os-Linux/sigio.c | |||
| @@ -304,8 +304,8 @@ out_clear_poll: | |||
| 304 | .size = 0, | 304 | .size = 0, |
| 305 | .used = 0 }); | 305 | .used = 0 }); |
| 306 | out_free: | 306 | out_free: |
| 307 | kfree(p); | ||
| 308 | sigio_unlock(); | 307 | sigio_unlock(); |
| 308 | kfree(p); | ||
| 309 | out_close2: | 309 | out_close2: |
| 310 | close(l_sigio_private[0]); | 310 | close(l_sigio_private[0]); |
| 311 | close(l_sigio_private[1]); | 311 | close(l_sigio_private[1]); |
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c index fbb080c2fc26..b3c11cfa995a 100644 --- a/arch/um/os-Linux/skas/mem.c +++ b/arch/um/os-Linux/skas/mem.c | |||
| @@ -82,8 +82,8 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) | |||
| 82 | if (offset) { | 82 | if (offset) { |
| 83 | data = (unsigned long *)(mm_idp->stack + | 83 | data = (unsigned long *)(mm_idp->stack + |
| 84 | offset - UML_CONFIG_STUB_DATA); | 84 | offset - UML_CONFIG_STUB_DATA); |
| 85 | printk("do_syscall_stub : ret = %d, offset = %d, " | 85 | printk("do_syscall_stub : ret = %ld, offset = %ld, " |
| 86 | "data = 0x%x\n", ret, offset, data); | 86 | "data = %p\n", ret, offset, data); |
| 87 | syscall = (unsigned long *)((unsigned long)data + data[0]); | 87 | syscall = (unsigned long *)((unsigned long)data + data[0]); |
| 88 | printk("do_syscall_stub: syscall %ld failed, return value = " | 88 | printk("do_syscall_stub: syscall %ld failed, return value = " |
| 89 | "0x%lx, expected return value = 0x%lx\n", | 89 | "0x%lx, expected return value = 0x%lx\n", |
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index bbf34cb91ce1..045ae0037456 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
| @@ -265,7 +265,7 @@ void userspace(union uml_pt_regs *regs) | |||
| 265 | if(err) | 265 | if(err) |
| 266 | panic("userspace - could not resume userspace process, " | 266 | panic("userspace - could not resume userspace process, " |
| 267 | "pid=%d, ptrace operation = %d, errno = %d\n", | 267 | "pid=%d, ptrace operation = %d, errno = %d\n", |
| 268 | op, errno); | 268 | pid, op, errno); |
| 269 | 269 | ||
| 270 | CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED)); | 270 | CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED)); |
| 271 | if(err < 0) | 271 | if(err < 0) |
| @@ -369,7 +369,7 @@ int copy_context_skas0(unsigned long new_stack, int pid) | |||
| 369 | */ | 369 | */ |
| 370 | wait_stub_done(pid, -1, "copy_context_skas0"); | 370 | wait_stub_done(pid, -1, "copy_context_skas0"); |
| 371 | if (child_data->err != UML_CONFIG_STUB_DATA) | 371 | if (child_data->err != UML_CONFIG_STUB_DATA) |
| 372 | panic("copy_context_skas0 - stub-child reports error %d\n", | 372 | panic("copy_context_skas0 - stub-child reports error %ld\n", |
| 373 | child_data->err); | 373 | child_data->err); |
| 374 | 374 | ||
| 375 | if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, | 375 | if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, |
diff --git a/arch/um/os-Linux/sys-i386/tls.c b/arch/um/os-Linux/sys-i386/tls.c index ba21f0e04a2f..120abbe4e3ce 100644 --- a/arch/um/os-Linux/sys-i386/tls.c +++ b/arch/um/os-Linux/sys-i386/tls.c | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | #include <errno.h> | ||
| 1 | #include <linux/unistd.h> | 2 | #include <linux/unistd.h> |
| 2 | #include "sysdep/tls.h" | 3 | #include "sysdep/tls.h" |
| 3 | #include "user_util.h" | 4 | #include "user_util.h" |
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c index 198e59163288..34bfc1bb9e38 100644 --- a/arch/um/os-Linux/umid.c +++ b/arch/um/os-Linux/umid.c | |||
| @@ -120,7 +120,8 @@ static int not_dead_yet(char *dir) | |||
| 120 | 120 | ||
| 121 | dead = 0; | 121 | dead = 0; |
| 122 | fd = open(file, O_RDONLY); | 122 | fd = open(file, O_RDONLY); |
| 123 | if(fd < 0){ | 123 | if(fd < 0) { |
| 124 | fd = -errno; | ||
| 124 | if(fd != -ENOENT){ | 125 | if(fd != -ENOENT){ |
| 125 | printk("not_dead_yet : couldn't open pid file '%s', " | 126 | printk("not_dead_yet : couldn't open pid file '%s', " |
| 126 | "err = %d\n", file, -fd); | 127 | "err = %d\n", file, -fd); |
| @@ -130,9 +131,13 @@ static int not_dead_yet(char *dir) | |||
| 130 | 131 | ||
| 131 | err = 0; | 132 | err = 0; |
| 132 | n = read(fd, pid, sizeof(pid)); | 133 | n = read(fd, pid, sizeof(pid)); |
| 133 | if(n <= 0){ | 134 | if(n < 0){ |
| 135 | printk("not_dead_yet : couldn't read pid file '%s', " | ||
| 136 | "err = %d\n", file, errno); | ||
| 137 | goto out_close; | ||
| 138 | } else if(n == 0){ | ||
| 134 | printk("not_dead_yet : couldn't read pid file '%s', " | 139 | printk("not_dead_yet : couldn't read pid file '%s', " |
| 135 | "err = %d\n", file, -n); | 140 | "0-byte read\n", file); |
| 136 | goto out_close; | 141 | goto out_close; |
| 137 | } | 142 | } |
| 138 | 143 | ||
| @@ -155,9 +160,9 @@ static int not_dead_yet(char *dir) | |||
| 155 | 160 | ||
| 156 | return err; | 161 | return err; |
| 157 | 162 | ||
| 158 | out_close: | 163 | out_close: |
| 159 | close(fd); | 164 | close(fd); |
| 160 | out: | 165 | out: |
| 161 | return 0; | 166 | return 0; |
| 162 | } | 167 | } |
| 163 | 168 | ||
diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c index 8da6ab31152a..2598158e1f53 100644 --- a/arch/um/os-Linux/user_syms.c +++ b/arch/um/os-Linux/user_syms.c | |||
| @@ -18,14 +18,19 @@ extern void *memmove(void *, const void *, size_t); | |||
| 18 | extern void *memset(void *, int, size_t); | 18 | extern void *memset(void *, int, size_t); |
| 19 | extern int printf(const char *, ...); | 19 | extern int printf(const char *, ...); |
| 20 | 20 | ||
| 21 | /* If they're not defined, the export is included in lib/string.c.*/ | ||
| 22 | #ifdef __HAVE_ARCH_STRLEN | ||
| 21 | EXPORT_SYMBOL(strlen); | 23 | EXPORT_SYMBOL(strlen); |
| 24 | #endif | ||
| 25 | #ifdef __HAVE_ARCH_STRSTR | ||
| 26 | EXPORT_SYMBOL(strstr); | ||
| 27 | #endif | ||
| 28 | |||
| 22 | EXPORT_SYMBOL(memcpy); | 29 | EXPORT_SYMBOL(memcpy); |
| 23 | EXPORT_SYMBOL(memmove); | 30 | EXPORT_SYMBOL(memmove); |
| 24 | EXPORT_SYMBOL(memset); | 31 | EXPORT_SYMBOL(memset); |
| 25 | EXPORT_SYMBOL(printf); | 32 | EXPORT_SYMBOL(printf); |
| 26 | 33 | ||
| 27 | EXPORT_SYMBOL(strstr); | ||
| 28 | |||
| 29 | /* Here, instead, I can provide a fake prototype. Yes, someone cares: genksyms. | 34 | /* Here, instead, I can provide a fake prototype. Yes, someone cares: genksyms. |
| 30 | * However, the modules will use the CRC defined *here*, no matter if it is | 35 | * However, the modules will use the CRC defined *here*, no matter if it is |
| 31 | * good; so the versions of these symbols will always match | 36 | * good; so the versions of these symbols will always match |
diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules index b696b451774c..5e7a9c310aa5 100644 --- a/arch/um/scripts/Makefile.rules +++ b/arch/um/scripts/Makefile.rules | |||
| @@ -9,10 +9,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) $(USER_OBJS:.o=.i) $(USER_OBJS:.o=.s) $(USER_OBJS:.o=.lst): \ |
| 11 | c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(notdir $@)) | 11 | c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(notdir $@)) |
| 12 | $(USER_OBJS): cmd_checksrc = | 12 | $(USER_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \ |
| 13 | $(USER_OBJS): quiet_cmd_checksrc = | 13 | -Dunix -D__unix__ -D__$(SUBARCH)__ |
| 14 | $(USER_OBJS): cmd_force_checksrc = | ||
| 15 | $(USER_OBJS): quiet_cmd_force_checksrc = | ||
| 16 | 14 | ||
| 17 | 15 | ||
| 18 | # The stubs and unmap.o can't try to call mcount or update basic block data | 16 | # The stubs and unmap.o can't try to call mcount or update basic block data |
diff --git a/arch/um/sys-i386/ksyms.c b/arch/um/sys-i386/ksyms.c index db524ab3f743..2a1eac1859ce 100644 --- a/arch/um/sys-i386/ksyms.c +++ b/arch/um/sys-i386/ksyms.c | |||
| @@ -15,7 +15,3 @@ EXPORT_SYMBOL(__up_wakeup); | |||
| 15 | 15 | ||
| 16 | /* Networking helper routines. */ | 16 | /* Networking helper routines. */ |
| 17 | EXPORT_SYMBOL(csum_partial); | 17 | EXPORT_SYMBOL(csum_partial); |
| 18 | |||
| 19 | /* delay core functions */ | ||
| 20 | EXPORT_SYMBOL(__const_udelay); | ||
| 21 | EXPORT_SYMBOL(__udelay); | ||
diff --git a/arch/um/sys-i386/ptrace_user.c b/arch/um/sys-i386/ptrace_user.c index 9f3bd8ed78f5..40aa88531446 100644 --- a/arch/um/sys-i386/ptrace_user.c +++ b/arch/um/sys-i386/ptrace_user.c | |||
| @@ -57,7 +57,7 @@ static void write_debugregs(int pid, unsigned long *regs) | |||
| 57 | if(ptrace(PTRACE_POKEUSR, pid, &dummy->u_debugreg[i], | 57 | if(ptrace(PTRACE_POKEUSR, pid, &dummy->u_debugreg[i], |
| 58 | regs[i]) < 0) | 58 | regs[i]) < 0) |
| 59 | printk("write_debugregs - ptrace failed on " | 59 | printk("write_debugregs - ptrace failed on " |
| 60 | "register %d, value = 0x%x, errno = %d\n", i, | 60 | "register %d, value = 0x%lx, errno = %d\n", i, |
| 61 | regs[i], errno); | 61 | regs[i], errno); |
| 62 | } | 62 | } |
| 63 | } | 63 | } |
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c index f5d0e1c37ea2..618fd8594643 100644 --- a/arch/um/sys-i386/signal.c +++ b/arch/um/sys-i386/signal.c | |||
| @@ -147,7 +147,7 @@ int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate __user *fp, | |||
| 147 | * delivery. The sp passed in is the original, and this needs | 147 | * delivery. The sp passed in is the original, and this needs |
| 148 | * to be restored, so we stick it in separately. | 148 | * to be restored, so we stick it in separately. |
| 149 | */ | 149 | */ |
| 150 | err |= copy_to_user(&SC_SP(to), sp, sizeof(sp)); | 150 | err |= copy_to_user(&SC_SP(to), &sp, sizeof(sp)); |
| 151 | 151 | ||
| 152 | if(from_fp != NULL){ | 152 | if(from_fp != NULL){ |
| 153 | err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate)); | 153 | err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate)); |
diff --git a/arch/um/sys-i386/tls.c b/arch/um/sys-i386/tls.c index a3188e861cc7..71b9796258ef 100644 --- a/arch/um/sys-i386/tls.c +++ b/arch/um/sys-i386/tls.c | |||
| @@ -378,7 +378,7 @@ static int __init __setup_host_supports_tls(void) { | |||
| 378 | } else | 378 | } else |
| 379 | printk(KERN_ERR " Host TLS support NOT detected! " | 379 | printk(KERN_ERR " Host TLS support NOT detected! " |
| 380 | "TLS support inside UML will not work\n"); | 380 | "TLS support inside UML will not work\n"); |
| 381 | return 1; | 381 | return 0; |
| 382 | } | 382 | } |
| 383 | 383 | ||
| 384 | __initcall(__setup_host_supports_tls); | 384 | __initcall(__setup_host_supports_tls); |
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c index e75c4e1838b0..a4c46a8af008 100644 --- a/arch/um/sys-x86_64/signal.c +++ b/arch/um/sys-x86_64/signal.c | |||
| @@ -137,7 +137,7 @@ int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp, | |||
| 137 | * delivery. The sp passed in is the original, and this needs | 137 | * delivery. The sp passed in is the original, and this needs |
| 138 | * to be restored, so we stick it in separately. | 138 | * to be restored, so we stick it in separately. |
| 139 | */ | 139 | */ |
| 140 | err |= copy_to_user(&SC_SP(to), sp, sizeof(sp)); | 140 | err |= copy_to_user(&SC_SP(to), &sp, sizeof(sp)); |
| 141 | 141 | ||
| 142 | if(from_fp != NULL){ | 142 | if(from_fp != NULL){ |
| 143 | err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate)); | 143 | err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate)); |
