From 0a351e77e8881bc5be3129d7521ccd1368e9903dcc0bf294d460e6a70b9d815f Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 10 Nov 2011 13:06:55 +0000 Subject: [PATCH] Accepting request 90739 from openSUSE:Tools - only ignore specific timer_create syscall, no all of them (forwarded request 90590 from algraf) OBS-URL: https://build.opensuse.org/request/show/90739 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=28 --- 0017-S-390-build-fix.patch | 39 ++-- 0025-add-syscall-numbers-from-2.6.39.2.patch | 128 +++++----- ...ux-user_fake-some-_proc_self-entries.patch | 218 ++++++++++++++++++ 0027-ignore-timer-create.patch | 16 ++ qemu.changes | 16 ++ qemu.spec | 4 + 6 files changed, 337 insertions(+), 84 deletions(-) create mode 100644 0026-linux-user_fake-some-_proc_self-entries.patch create mode 100644 0027-ignore-timer-create.patch diff --git a/0017-S-390-build-fix.patch b/0017-S-390-build-fix.patch index cc7f3935..fb33b5ce 100644 --- a/0017-S-390-build-fix.patch +++ b/0017-S-390-build-fix.patch @@ -8,11 +8,11 @@ Subject: [PATCH 17/17] S/390 build fix target-s390x/translate.c | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) -diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c -index 20c83c5..46b71fc 100644 ---- a/target-s390x/op_helper.c -+++ b/target-s390x/op_helper.c -@@ -738,7 +738,7 @@ uint32_t HELPER(tmxx)(uint64_t val, uint32_t mask) +Index: qemu-0.14.1/target-s390x/op_helper.c +=================================================================== +--- qemu-0.14.1.orig/target-s390x/op_helper.c ++++ qemu-0.14.1/target-s390x/op_helper.c +@@ -738,7 +738,7 @@ uint32_t HELPER(tmxx)(uint64_t val, uint uint32_t HELPER(abs_i32)(uint32_t reg, int32_t val) { uint32_t cc; @@ -21,7 +21,7 @@ index 20c83c5..46b71fc 100644 else if (val) cc = 1; else cc = 0; -@@ -996,7 +996,7 @@ uint32_t HELPER(slbg)(uint32_t cc, uint32_t r1, uint64_t v1, uint64_t v2) +@@ -996,7 +996,7 @@ uint32_t HELPER(slbg)(uint32_t cc, uint3 /* condition codes for binary FP ops */ static uint32_t set_cc_f32(float32 v1, float32 v2) { @@ -30,7 +30,7 @@ index 20c83c5..46b71fc 100644 else if (float32_eq(v1, v2, &env->fpu_status)) return 0; else if (float32_lt(v1, v2, &env->fpu_status)) return 1; else return 2; -@@ -1004,7 +1004,7 @@ static uint32_t set_cc_f32(float32 v1, float32 v2) +@@ -1004,7 +1004,7 @@ static uint32_t set_cc_f32(float32 v1, f static uint32_t set_cc_f64(float64 v1, float64 v2) { @@ -39,7 +39,7 @@ index 20c83c5..46b71fc 100644 else if (float64_eq(v1, v2, &env->fpu_status)) return 0; else if (float64_lt(v1, v2, &env->fpu_status)) return 1; else return 2; -@@ -1013,7 +1013,7 @@ static uint32_t set_cc_f64(float64 v1, float64 v2) +@@ -1013,7 +1013,7 @@ static uint32_t set_cc_f64(float64 v1, f /* condition codes for unary FP ops */ static uint32_t set_cc_nz_f32(float32 v) { @@ -66,7 +66,7 @@ index 20c83c5..46b71fc 100644 else if (float128_is_zero(v)) return 0; else if (float128_is_neg(v)) return 1; else return 2; -@@ -1350,7 +1350,7 @@ uint32_t HELPER(cxbr)(uint32_t f1, uint32_t f2) +@@ -1350,7 +1350,7 @@ uint32_t HELPER(cxbr)(uint32_t f1, uint3 CPU_QuadU v2; v2.ll.upper = env->fregs[f2].ll; v2.ll.lower = env->fregs[f2 + 2].ll; @@ -75,7 +75,7 @@ index 20c83c5..46b71fc 100644 else if (float128_eq(v1.q, v2.q, &env->fpu_status)) return 0; else if (float128_lt(v1.q, v2.q, &env->fpu_status)) return 1; else return 2; -@@ -1463,7 +1463,7 @@ uint32_t HELPER(cgxbr)(uint32_t r1, uint32_t f2, uint32_t m3) +@@ -1463,7 +1463,7 @@ uint32_t HELPER(cgxbr)(uint32_t r1, uint v2.ll.lower = env->fregs[f2 + 2].ll; set_round_mode(m3); env->regs[r1] = float128_to_int64(v2.q, &env->fpu_status); @@ -84,7 +84,7 @@ index 20c83c5..46b71fc 100644 else if (float128_is_zero(v2.q)) return 0; else if (float128_is_neg(v2.q)) return 1; else return 2; -@@ -1611,7 +1611,7 @@ uint32_t HELPER(tceb)(uint32_t f1, uint64_t m2) +@@ -1611,7 +1611,7 @@ uint32_t HELPER(tceb)(uint32_t f1, uint6 HELPER_LOG("%s: v1 0x%lx m2 0x%lx neg %d\n", __FUNCTION__, v1, m2, neg); if (float32_is_zero(v1) && (m2 & (1 << (11-neg)))) cc = 1; else if (float32_is_infinity(v1) && (m2 & (1 << (5-neg)))) cc = 1; @@ -93,7 +93,7 @@ index 20c83c5..46b71fc 100644 else if (float32_is_signaling_nan(v1) && (m2 & (1 << (1-neg)))) cc = 1; else /* assume normalized number */ if (m2 & (1 << (9-neg))) cc = 1; /* FIXME: denormalized? */ -@@ -1627,7 +1627,7 @@ uint32_t HELPER(tcdb)(uint32_t f1, uint64_t m2) +@@ -1627,7 +1627,7 @@ uint32_t HELPER(tcdb)(uint32_t f1, uint6 HELPER_LOG("%s: v1 0x%lx m2 0x%lx neg %d\n", __FUNCTION__, v1, m2, neg); if (float64_is_zero(v1) && (m2 & (1 << (11-neg)))) cc = 1; else if (float64_is_infinity(v1) && (m2 & (1 << (5-neg)))) cc = 1; @@ -102,7 +102,7 @@ index 20c83c5..46b71fc 100644 else if (float64_is_signaling_nan(v1) && (m2 & (1 << (1-neg)))) cc = 1; else /* assume normalized number */ if (m2 & (1 << (9-neg))) cc = 1; /* FIXME: denormalized? */ -@@ -1645,7 +1645,7 @@ uint32_t HELPER(tcxb)(uint32_t f1, uint64_t m2) +@@ -1645,7 +1645,7 @@ uint32_t HELPER(tcxb)(uint32_t f1, uint6 int neg = float128_is_neg(v1.q); if (float128_is_zero(v1.q) && (m2 & (1 << (11-neg)))) cc = 1; else if (float128_is_infinity(v1.q) && (m2 & (1 << (5-neg)))) cc = 1; @@ -111,11 +111,11 @@ index 20c83c5..46b71fc 100644 else if (float128_is_signaling_nan(v1.q) && (m2 & (1 << (1-neg)))) cc = 1; else /* assume normalized number */ if (m2 & (1 << (9-neg))) cc = 1; /* FIXME: denormalized? */ -diff --git a/target-s390x/translate.c b/target-s390x/translate.c -index e08dcf4..189a60b 100644 ---- a/target-s390x/translate.c -+++ b/target-s390x/translate.c -@@ -67,7 +67,7 @@ void cpu_dump_state(CPUState *env, FILE *f, fprintf_function cpu_fprintf, +Index: qemu-0.14.1/target-s390x/translate.c +=================================================================== +--- qemu-0.14.1.orig/target-s390x/translate.c ++++ qemu-0.14.1/target-s390x/translate.c +@@ -67,7 +67,7 @@ void cpu_dump_state(CPUState *env, FILE } } for (i = 0; i < 16; i++) { @@ -124,6 +124,3 @@ index e08dcf4..189a60b 100644 if ((i % 4) == 3) { cpu_fprintf(f, "\n"); } else { --- -1.7.1 - diff --git a/0025-add-syscall-numbers-from-2.6.39.2.patch b/0025-add-syscall-numbers-from-2.6.39.2.patch index 9b0e5ea7..4a9be244 100644 --- a/0025-add-syscall-numbers-from-2.6.39.2.patch +++ b/0025-add-syscall-numbers-from-2.6.39.2.patch @@ -12,15 +12,14 @@ Date: Mon Jun 27 17:44:51 2011 +0100 Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio -diff --git a/linux-user/alpha/syscall_nr.h b/linux-user/alpha/syscall_nr.h -index e3127df..f6284db 100644 ---- a/linux-user/alpha/syscall_nr.h -+++ b/linux-user/alpha/syscall_nr.h -@@ -411,4 +411,25 @@ +Index: qemu-0.14.1/linux-user/alpha/syscall_nr.h +=================================================================== +--- qemu-0.14.1.orig/linux-user/alpha/syscall_nr.h ++++ qemu-0.14.1/linux-user/alpha/syscall_nr.h +@@ -411,6 +411,28 @@ #define TARGET_NR_signalfd 476 #define TARGET_NR_timerfd 477 #define TARGET_NR_eventfd 478 -- +#define TARGET_NR_recvmmsg 479 +#define TARGET_NR_fallocate 480 +#define TARGET_NR_timerfd_create 481 @@ -43,10 +42,13 @@ index e3127df..f6284db 100644 +#define TARGET_NR_open_by_handle_at 498 +#define TARGET_NR_clock_adjtime 499 +#define TARGET_NR_syncfs 500 -diff --git a/linux-user/arm/syscall_nr.h b/linux-user/arm/syscall_nr.h -index 79a216a..7f05879 100644 ---- a/linux-user/arm/syscall_nr.h -+++ b/linux-user/arm/syscall_nr.h + + /* The following aliases are defined in order to match up with the + standard i386 syscalls implemented in syscalls.c. */ +Index: qemu-0.14.1/linux-user/arm/syscall_nr.h +=================================================================== +--- qemu-0.14.1.orig/linux-user/arm/syscall_nr.h ++++ qemu-0.14.1/linux-user/arm/syscall_nr.h @@ -365,3 +365,16 @@ #define TARGET_NR_dup3 (358) #define TARGET_NR_pipe2 (359) @@ -64,20 +66,20 @@ index 79a216a..7f05879 100644 +#define TARGET_NR_open_by_handle_at (371) +#define TARGET_NR_clock_adjtime (372) +#define TARGET_NR_syncfs (373) -diff --git a/linux-user/cris/syscall_nr.h b/linux-user/cris/syscall_nr.h -index 6132817..98f1a0b 100644 ---- a/linux-user/cris/syscall_nr.h -+++ b/linux-user/cris/syscall_nr.h +Index: qemu-0.14.1/linux-user/cris/syscall_nr.h +=================================================================== +--- qemu-0.14.1.orig/linux-user/cris/syscall_nr.h ++++ qemu-0.14.1/linux-user/cris/syscall_nr.h @@ -333,3 +333,5 @@ #define TARGET_NR_dup3 330 #define TARGET_NR_pipe2 331 #define TARGET_NR_inotify_init1 332 +#define TARGET_NR_preadv 333 +#define TARGET_NR_pwritev 334 -diff --git a/linux-user/i386/syscall_nr.h b/linux-user/i386/syscall_nr.h -index 3ef71ce..74abfca 100644 ---- a/linux-user/i386/syscall_nr.h -+++ b/linux-user/i386/syscall_nr.h +Index: qemu-0.14.1/linux-user/i386/syscall_nr.h +=================================================================== +--- qemu-0.14.1.orig/linux-user/i386/syscall_nr.h ++++ qemu-0.14.1/linux-user/i386/syscall_nr.h @@ -335,3 +335,15 @@ #define TARGET_NR_dup3 330 #define TARGET_NR_pipe2 331 @@ -94,10 +96,10 @@ index 3ef71ce..74abfca 100644 +#define TARGET_NR_open_by_handle_at 342 +#define TARGET_NR_clock_adjtime 343 +#define TARGET_NR_syncfs 344 -diff --git a/linux-user/m68k/syscall_nr.h b/linux-user/m68k/syscall_nr.h -index 1c0ba07..4d0937e 100644 ---- a/linux-user/m68k/syscall_nr.h -+++ b/linux-user/m68k/syscall_nr.h +Index: qemu-0.14.1/linux-user/m68k/syscall_nr.h +=================================================================== +--- qemu-0.14.1.orig/linux-user/m68k/syscall_nr.h ++++ qemu-0.14.1/linux-user/m68k/syscall_nr.h @@ -328,3 +328,19 @@ #define TARGET_NR_dup3 326 #define TARGET_NR_pipe2 327 @@ -118,11 +120,11 @@ index 1c0ba07..4d0937e 100644 +#define TARGET_NR_open_by_handle_at 341 +#define TARGET_NR_clock_adjtime 342 +#define TARGET_NR_syncfs 343 -diff --git a/linux-user/main.c b/linux-user/main.c -index 289054b..48f0443 100644 ---- a/linux-user/main.c -+++ b/linux-user/main.c -@@ -1985,6 +1985,33 @@ static const uint8_t mips_syscall_args[] = { +Index: qemu-0.14.1/linux-user/main.c +=================================================================== +--- qemu-0.14.1.orig/linux-user/main.c ++++ qemu-0.14.1/linux-user/main.c +@@ -1922,6 +1922,33 @@ static const uint8_t mips_syscall_args[] MIPS_SYS(sys_epoll_pwait, 6) MIPS_SYS(sys_ioprio_set, 3) MIPS_SYS(sys_ioprio_get, 2) @@ -156,10 +158,10 @@ index 289054b..48f0443 100644 }; #undef MIPS_SYS -diff --git a/linux-user/microblaze/syscall_nr.h b/linux-user/microblaze/syscall_nr.h -index 3e641cd..f1fe0e7 100644 ---- a/linux-user/microblaze/syscall_nr.h -+++ b/linux-user/microblaze/syscall_nr.h +Index: qemu-0.14.1/linux-user/microblaze/syscall_nr.h +=================================================================== +--- qemu-0.14.1.orig/linux-user/microblaze/syscall_nr.h ++++ qemu-0.14.1/linux-user/microblaze/syscall_nr.h @@ -364,6 +364,16 @@ #define TARGET_NR_sendmsg 360 /* new */ #define TARGET_NR_recvmsg 361 /* new */ @@ -179,10 +181,10 @@ index 3e641cd..f1fe0e7 100644 +#define TARGET_NR_clock_adjtime 373 +#define TARGET_NR_syncfs 374 -diff --git a/linux-user/mips/syscall_nr.h b/linux-user/mips/syscall_nr.h -index 0595308..fbdc348 100644 ---- a/linux-user/mips/syscall_nr.h -+++ b/linux-user/mips/syscall_nr.h +Index: qemu-0.14.1/linux-user/mips/syscall_nr.h +=================================================================== +--- qemu-0.14.1.orig/linux-user/mips/syscall_nr.h ++++ qemu-0.14.1/linux-user/mips/syscall_nr.h @@ -332,3 +332,16 @@ #define TARGET_NR_dup3 (TARGET_NR_Linux + 327) #define TARGET_NR_pipe2 (TARGET_NR_Linux + 328) @@ -200,10 +202,10 @@ index 0595308..fbdc348 100644 +#define TARGET_NR_open_by_handle_at (TARGET_NR_Linux + 340) +#define TARGET_NR_clock_adjtime (TARGET_NR_Linux + 341) +#define TARGET_NR_syncfs (TARGET_NR_Linux + 342) -diff --git a/linux-user/mips64/syscall_nr.h b/linux-user/mips64/syscall_nr.h -index ee1d134..36d27b5 100644 ---- a/linux-user/mips64/syscall_nr.h -+++ b/linux-user/mips64/syscall_nr.h +Index: qemu-0.14.1/linux-user/mips64/syscall_nr.h +=================================================================== +--- qemu-0.14.1.orig/linux-user/mips64/syscall_nr.h ++++ qemu-0.14.1/linux-user/mips64/syscall_nr.h @@ -291,3 +291,16 @@ #define TARGET_NR_dup3 (TARGET_NR_Linux + 286) #define TARGET_NR_pipe2 (TARGET_NR_Linux + 287) @@ -221,10 +223,10 @@ index ee1d134..36d27b5 100644 +#define TARGET_NR_open_by_handle_at (TARGET_NR_Linux + 299) +#define TARGET_NR_clock_adjtime (TARGET_NR_Linux + 300) +#define TARGET_NR_syncfs (TARGET_NR_Linux + 301) -diff --git a/linux-user/mipsn32/syscall_nr.h b/linux-user/mipsn32/syscall_nr.h -index 60a99dd..4e1aca3 100644 ---- a/linux-user/mipsn32/syscall_nr.h -+++ b/linux-user/mipsn32/syscall_nr.h +Index: qemu-0.14.1/linux-user/mipsn32/syscall_nr.h +=================================================================== +--- qemu-0.14.1.orig/linux-user/mipsn32/syscall_nr.h ++++ qemu-0.14.1/linux-user/mipsn32/syscall_nr.h @@ -295,3 +295,17 @@ #define TARGET_NR_dup3 (TARGET_NR_Linux + 290) #define TARGET_NR_pipe2 (TARGET_NR_Linux + 291) @@ -243,10 +245,10 @@ index 60a99dd..4e1aca3 100644 +#define TARGET_NR_open_by_handle_at (TARGET_NR_Linux + 304) +#define TARGET_NR_clock_adjtime (TARGET_NR_Linux + 305) +#define TARGET_NR_syncfs (TARGET_NR_Linux + 306) -diff --git a/linux-user/ppc/syscall_nr.h b/linux-user/ppc/syscall_nr.h -index cc84a4c..0673b7d 100644 ---- a/linux-user/ppc/syscall_nr.h -+++ b/linux-user/ppc/syscall_nr.h +Index: qemu-0.14.1/linux-user/ppc/syscall_nr.h +=================================================================== +--- qemu-0.14.1.orig/linux-user/ppc/syscall_nr.h ++++ qemu-0.14.1/linux-user/ppc/syscall_nr.h @@ -332,3 +332,33 @@ #define TARGET_NR_dup3 316 #define TARGET_NR_pipe2 317 @@ -281,10 +283,10 @@ index cc84a4c..0673b7d 100644 +#define TARGET_NR_open_by_handle_at 346 +#define TARGET_NR_clock_adjtime 347 +#define TARGET_NR_syncfs 348 -diff --git a/linux-user/sh4/syscall_nr.h b/linux-user/sh4/syscall_nr.h -index 262b236..6173a7c 100644 ---- a/linux-user/sh4/syscall_nr.h -+++ b/linux-user/sh4/syscall_nr.h +Index: qemu-0.14.1/linux-user/sh4/syscall_nr.h +=================================================================== +--- qemu-0.14.1.orig/linux-user/sh4/syscall_nr.h ++++ qemu-0.14.1/linux-user/sh4/syscall_nr.h @@ -334,3 +334,35 @@ #define TARGET_NR_dup3 330 #define TARGET_NR_pipe2 331 @@ -321,10 +323,10 @@ index 262b236..6173a7c 100644 +#define TARGET_NR_open_by_handle_at 360 +#define TARGET_NR_clock_adjtime 361 +#define TARGET_NR_syncfs 362 -diff --git a/linux-user/sparc/syscall_nr.h b/linux-user/sparc/syscall_nr.h -index 5d1ac21..be503f2 100644 ---- a/linux-user/sparc/syscall_nr.h -+++ b/linux-user/sparc/syscall_nr.h +Index: qemu-0.14.1/linux-user/sparc/syscall_nr.h +=================================================================== +--- qemu-0.14.1.orig/linux-user/sparc/syscall_nr.h ++++ qemu-0.14.1/linux-user/sparc/syscall_nr.h @@ -285,3 +285,15 @@ #define TARGET_NR_pipe2 321 #define TARGET_NR_inotify_init1 322 @@ -341,10 +343,10 @@ index 5d1ac21..be503f2 100644 +#define TARGET_NR_open_by_handle_at 333 +#define TARGET_NR_clock_adjtime 334 +#define TARGET_NR_syncfs 335 -diff --git a/linux-user/sparc64/syscall_nr.h b/linux-user/sparc64/syscall_nr.h -index bdca2a7..70988b2 100644 ---- a/linux-user/sparc64/syscall_nr.h -+++ b/linux-user/sparc64/syscall_nr.h +Index: qemu-0.14.1/linux-user/sparc64/syscall_nr.h +=================================================================== +--- qemu-0.14.1.orig/linux-user/sparc64/syscall_nr.h ++++ qemu-0.14.1/linux-user/sparc64/syscall_nr.h @@ -322,3 +322,15 @@ #define TARGET_NR_pipe2 321 #define TARGET_NR_inotify_init1 322 @@ -361,10 +363,10 @@ index bdca2a7..70988b2 100644 +#define TARGET_NR_open_by_handle_at 333 +#define TARGET_NR_clock_adjtime 334 +#define TARGET_NR_syncfs 335 -diff --git a/linux-user/x86_64/syscall_nr.h b/linux-user/x86_64/syscall_nr.h -index 568a901..947e961 100644 ---- a/linux-user/x86_64/syscall_nr.h -+++ b/linux-user/x86_64/syscall_nr.h +Index: qemu-0.14.1/linux-user/x86_64/syscall_nr.h +=================================================================== +--- qemu-0.14.1.orig/linux-user/x86_64/syscall_nr.h ++++ qemu-0.14.1/linux-user/x86_64/syscall_nr.h @@ -293,3 +293,15 @@ #define TARGET_NR_dup3 292 #define TARGET_NR_pipe2 293 diff --git a/0026-linux-user_fake-some-_proc_self-entries.patch b/0026-linux-user_fake-some-_proc_self-entries.patch new file mode 100644 index 00000000..5330ec0e --- /dev/null +++ b/0026-linux-user_fake-some-_proc_self-entries.patch @@ -0,0 +1,218 @@ +diff --git a/linux-user/elfload.c b/linux-user/elfload.c +index 8677bba..2a1adf1 100644 +--- a/linux-user/elfload.c ++++ b/linux-user/elfload.c +@@ -1246,6 +1246,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, + struct image_info *interp_info) + { + abi_ulong sp; ++ abi_ulong sp_auxv; + int size; + int i; + abi_ulong u_rand_bytes; +@@ -1317,6 +1318,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, + sp -= n; put_user_ual(id, sp); \ + } while(0) + ++ sp_auxv = sp; + NEW_AUX_ENT (AT_NULL, 0); + + /* There must be exactly DLINFO_ITEMS entries here. */ +@@ -1347,6 +1349,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, + #undef NEW_AUX_ENT + + info->saved_auxv = sp; ++ info->auxv_len = sp_auxv - sp; + + sp = loader_build_argptr(envc, argc, sp, p, 0); + return sp; +@@ -2330,9 +2333,8 @@ static void fill_auxv_note(struct memelfnote *note, const TaskState *ts) + { + elf_addr_t auxv = (elf_addr_t)ts->info->saved_auxv; + elf_addr_t orig_auxv = auxv; +- abi_ulong val; + void *ptr; +- int i, len; ++ int len = ts->info->auxv_len; + + /* + * Auxiliary vector is stored in target process stack. It contains +@@ -2340,15 +2342,6 @@ static void fill_auxv_note(struct memelfnote *note, const TaskState *ts) + * strictly necessary but we do it here for sake of completeness. + */ + +- /* find out lenght of the vector, AT_NULL is terminator */ +- i = len = 0; +- do { +- get_user_ual(val, auxv); +- i += 2; +- auxv += 2 * sizeof (elf_addr_t); +- } while (val != AT_NULL); +- len = i * sizeof (elf_addr_t); +- + /* read in whole auxv vector and copy it to memelfnote */ + ptr = lock_user(VERIFY_READ, orig_auxv, len, 0); + if (ptr != NULL) { +diff --git a/linux-user/qemu.h b/linux-user/qemu.h +index 55ad9d8..ef08d39 100644 +--- a/linux-user/qemu.h ++++ b/linux-user/qemu.h +@@ -48,6 +48,7 @@ struct image_info { + abi_ulong code_offset; + abi_ulong data_offset; + abi_ulong saved_auxv; ++ abi_ulong auxv_len; + abi_ulong arg_start; + abi_ulong arg_end; + int personality; +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 7735008..e71550c 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -4608,6 +4608,125 @@ int get_osversion(void) + return osversion; + } + ++ ++static int open_self_maps(void *cpu_env, int fd) ++{ ++#if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_UNICORE32) ++ TaskState *ts = ((CPUState *)cpu_env)->opaque; ++ ++ dprintf(fd, "%08llx-%08llx rw-p %08llx 00:00 0 [stack]\n", ++ (unsigned long long)ts->info->stack_limit, ++ (unsigned long long)(ts->stack_base + (TARGET_PAGE_SIZE - 1)) ++ & TARGET_PAGE_MASK, ++ (unsigned long long)ts->stack_base); ++#endif ++ ++ return 0; ++} ++ ++static int open_self_stat(void *cpu_env, int fd) ++{ ++ TaskState *ts = ((CPUState *)cpu_env)->opaque; ++ abi_ulong start_stack = ts->info->start_stack; ++ int i; ++ ++ for (i = 0; i < 44; i++) { ++ char buf[128]; ++ int len; ++ uint64_t val = 0; ++ ++ if (i == 27) { ++ /* stack bottom */ ++ val = start_stack; ++ } ++ snprintf(buf, sizeof(buf), "%"PRId64 "%c", val, i == 43 ? '\n' : ' '); ++ len = strlen(buf); ++ if (write(fd, buf, len) != len) { ++ return -1; ++ } ++ } ++ ++ return 0; ++} ++ ++static int open_self_auxv(void *cpu_env, int fd) ++{ ++ TaskState *ts = ((CPUState *)cpu_env)->opaque; ++ abi_ulong auxv = ts->info->saved_auxv; ++ abi_ulong len = ts->info->auxv_len; ++ char *ptr; ++ ++ /* ++ * Auxiliary vector is stored in target process stack. ++ * read in whole auxv vector and copy it to file ++ */ ++ ptr = lock_user(VERIFY_READ, auxv, len, 0); ++ if (ptr != NULL) { ++ while (len > 0) { ++ ssize_t r; ++ r = write(fd, ptr, len); ++ if (r <= 0) { ++ break; ++ } ++ len -= r; ++ ptr += r; ++ } ++ lseek(fd, 0, SEEK_SET); ++ unlock_user(ptr, auxv, len); ++ } ++ ++ return 0; ++} ++ ++static int do_open(void *cpu_env, const char *pathname, int flags, mode_t mode) ++{ ++ struct fake_open { ++ const char *filename; ++ int (*fill)(void *cpu_env, int fd); ++ }; ++ const struct fake_open *fake_open; ++ static const struct fake_open fakes[] = { ++ { "/proc/self/maps", open_self_maps }, ++ { "/proc/self/stat", open_self_stat }, ++ { "/proc/self/auxv", open_self_auxv }, ++ { NULL, NULL } ++ }; ++ ++ for (fake_open = fakes; fake_open->filename; fake_open++) { ++ if (!strncmp(pathname, fake_open->filename, ++ strlen(fake_open->filename))) { ++ break; ++ } ++ } ++ ++ if (fake_open->filename) { ++ const char *tmpdir; ++ char filename[PATH_MAX]; ++ int fd, r; ++ ++ /* create temporary file to map stat to */ ++ tmpdir = getenv("TMPDIR"); ++ if (!tmpdir) ++ tmpdir = "/tmp"; ++ snprintf(filename, sizeof(filename), "%s/qemu-open.XXXXXX", tmpdir); ++ fd = mkstemp(filename); ++ if (fd < 0) { ++ return fd; ++ } ++ unlink(filename); ++ ++ if ((r = fake_open->fill(cpu_env, fd))) { ++ close(fd); ++ return r; ++ } ++ lseek(fd, 0, SEEK_SET); ++ ++ return fd; ++ } ++ ++ return get_errno(open(path(pathname), flags, mode)); ++} ++ + /* do_syscall() should always have a single exit point at the end so + that actions, such as logging of syscall results, can be performed. + All errnos that do_syscall() returns must be -TARGET_. */ +@@ -4693,9 +4812,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, + case TARGET_NR_open: + if (!(p = lock_user_string(arg1))) + goto efault; +- ret = get_errno(open(path(p), +- target_to_host_bitmask(arg2, fcntl_flags_tbl), +- arg3)); ++ ret = get_errno(do_open(cpu_env, p, ++ target_to_host_bitmask(arg2, fcntl_flags_tbl), ++ arg3)); + unlock_user(p, arg1, 0); + break; + #if defined(TARGET_NR_openat) && defined(__NR_openat) +@@ -5937,6 +6056,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, + if ((arg3 & PROT_GROWSDOWN) + && arg1 >= ts->info->stack_limit + && arg1 <= ts->info->start_stack) { ++typedef struct sPAPREnvironment sPAPREnvironment; + arg3 &= ~PROT_GROWSDOWN; + arg2 = arg2 + arg1 - ts->info->stack_limit; + arg1 = ts->info->stack_limit; diff --git a/0027-ignore-timer-create.patch b/0027-ignore-timer-create.patch new file mode 100644 index 00000000..31bbef3c --- /dev/null +++ b/0027-ignore-timer-create.patch @@ -0,0 +1,16 @@ +Index: qemu-0.14.1/linux-user/syscall.c +=================================================================== +--- qemu-0.14.1.orig/linux-user/syscall.c ++++ qemu-0.14.1/linux-user/syscall.c +@@ -7423,6 +7423,11 @@ typedef struct sPAPREnvironment sPAPREnv + break; + #endif + ++#if defined(TARGET_NR_timer_create) ++ case TARGET_NR_set_tid_address: ++ goto unimplemented_nowarn; ++#endif ++ + #if defined(TARGET_NR_tkill) && defined(__NR_tkill) + case TARGET_NR_tkill: + ret = get_errno(sys_tkill((int)arg1, target_to_host_signal(arg2))); diff --git a/qemu.changes b/qemu.changes index 1404645c..ceea488a 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,19 @@ +------------------------------------------------------------------- +Tue Nov 8 14:53:19 UTC 2011 - agraf@suse.com + +- only ignore specific timer_create syscall, no all of them + +------------------------------------------------------------------- +Sun Nov 6 14:33:42 UTC 2011 - agraf@suse.com + +- don't print out unsupported syscalls but rather silently ignore + them - some programs catch stderr and get confused + +------------------------------------------------------------------- +Thu Nov 3 18:48:47 UTC 2011 - adrian@suse.de + +- add a number of patches to fake /proc entries (from Alex) + ------------------------------------------------------------------- Fri Oct 28 08:55:39 UTC 2011 - adrian@suse.de diff --git a/qemu.spec b/qemu.spec index 6e43bdb4..dcb3aef0 100644 --- a/qemu.spec +++ b/qemu.spec @@ -50,6 +50,8 @@ Patch22: 0022-fixing-smp-races.patch Patch23: 0023-linux-user-add-binfmt-wrapper-for-argv-0-handling.patch Patch24: 0024-fix-glibc-install-locales.patch Patch25: 0025-add-syscall-numbers-from-2.6.39.2.patch +Patch26: 0026-linux-user_fake-some-_proc_self-entries.patch +Patch27: 0027-ignore-timer-create.patch # this is to make lint happy Source300: rpmlintrc BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -127,6 +129,8 @@ run cross architectures builds %patch23 -p1 %patch24 -p1 -R %patch25 -p1 -F 3 +%patch26 -p1 -F 3 +%patch27 -p1 %ifarch s390x ppc64 x86_64 # s390 target only builds on 64-bit machines %patch15 -p1