diff options
Diffstat (limited to 'results/classifier/105/semantic/1299190')
| -rw-r--r-- | results/classifier/105/semantic/1299190 | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/results/classifier/105/semantic/1299190 b/results/classifier/105/semantic/1299190 new file mode 100644 index 00000000..b79560b1 --- /dev/null +++ b/results/classifier/105/semantic/1299190 @@ -0,0 +1,76 @@ +semantic: 0.700 +other: 0.582 +mistranslation: 0.574 +instruction: 0.522 +device: 0.396 +graphic: 0.335 +network: 0.333 +boot: 0.296 +vnc: 0.276 +socket: 0.269 +assembly: 0.224 +KVM: 0.173 + +Access to /proc/self/exe in linux-user mode + +This is based on a recent bug in GCC Bugzilla: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60681 + +It looks like libbacktrace (GCC runtime library used for obtaining stack traces) uses /proc/self/exe for error reporting. Currently this is mapped to qemu-arm which effectively disables libbacktrace on linux-user. + +It seems that QEMU already supports /proc/self/{maps,stat,auxv} so addition of /proc/self/exe may be trivial. + +This tiny patch seems to work. + +I think the problem is not in libbacktrace per se but rather libsanitizer initializing libbacktrace with contents of /proc/self/exe. Patch is still relevant though. + +Looks good, I'll get this to linux-user que once QEMU 2.0 is released. + +That patch will copy the whole of the target executable into a temporary file without changing any of it -- the fake_open mechanism is really intended for cases where we need to return modified results. Wouldn't it be easier to just have something in do_open() that said: + if (is_proc_myself(pathname, "exe")) { + return get_errno(open(exec_path), flags, mode); + } + +That will then give the right behaviour for read-only executables and other error-related corner cases. + +(See also the logic in the readlink/readlinkat handling which already specialcases /proc/self/exe using exec_path.) + + +(I got the bracket placement wrong there so as you can tell the code is untested :-)) + + +Yes, it works. Here is updated patch. + +Some nits: + The "(CPUArchState *)" cast isn't necessary + We should use exec_path, not ts->bprm->argv[0] (the guest argv[0] isn't necessarily the executable path) + We don't want to call path() here -- exec_path is a host path, and only guest filename paths need to go through path(). + +Looking a little more closely at the logic in main.c I wonder if we actually want: + + if (is_proc_myself(pathname, "exe")) { + execfd = qemu_getauxval(AT_EXECFD); + if (execfd) { + return execfd; + } + return get_errno(open(exec_path, flags, mode)); + } + +Also if you'd like us to apply your patches we'll need at least a "Signed-off-by: " line from you. + + +Ok, fixed. + +Thanks. That version +Reviewed-by: Peter Maydell <email address hidden> + + +Hi, + +Is this patch deployed in new version of QEMU? + +Thanks, +Maxim + +This bug was fixed by commit aa07f5ecf9828 in 2014 and has been released in QEMU. + + |