summaryrefslogtreecommitdiffstats
path: root/results/classifier/zero-shot-user-mode/output/instruction/1915327
diff options
context:
space:
mode:
authorChristian Krinitsin <mail@krinitsin.com>2025-07-07 17:23:11 +0000
committerChristian Krinitsin <mail@krinitsin.com>2025-07-07 17:23:11 +0000
commitc50b0c4da17b6e83640e4ed2380fffb5f507c846 (patch)
treeb4f203fce1380e2ea3578a784bb8ee060fe42cbd /results/classifier/zero-shot-user-mode/output/instruction/1915327
parent61361f925d4914a6608a0076e64cc2399311ed5f (diff)
downloademulator-bug-study-c50b0c4da17b6e83640e4ed2380fffb5f507c846.tar.gz
emulator-bug-study-c50b0c4da17b6e83640e4ed2380fffb5f507c846.zip
add zero-shot results
Diffstat (limited to 'results/classifier/zero-shot-user-mode/output/instruction/1915327')
-rw-r--r--results/classifier/zero-shot-user-mode/output/instruction/191532740
1 files changed, 40 insertions, 0 deletions
diff --git a/results/classifier/zero-shot-user-mode/output/instruction/1915327 b/results/classifier/zero-shot-user-mode/output/instruction/1915327
new file mode 100644
index 00000000..5d19395c
--- /dev/null
+++ b/results/classifier/zero-shot-user-mode/output/instruction/1915327
@@ -0,0 +1,40 @@
+instruction: 0.532
+runtime: 0.277
+syscall: 0.191
+
+
+
+x86_64 cmpxchg behavior in qemu tcg does not match the real CPU
+
+QEMU version:
+1214d55d1c (HEAD, origin/master, origin/HEAD) Merge remote-tracking branch 'remotes/nvme/tags/nvme-next-pull-request' into staging
+
+Consider the following little program:
+
+$ cat 1.c
+#include <stdio.h>
+int main() {
+ int mem = 0x12345678;
+ register long rax asm("rax") = 0x1234567812345678;
+ register int edi asm("edi") = 0x77777777;
+ asm("cmpxchg %[edi],%[mem]"
+ : [ mem ] "+m"(mem), [ rax ] "+r"(rax)
+ : [ edi ] "r"(edi));
+ long rax2 = rax;
+ printf("rax2 = %lx\n", rax2);
+}
+
+According to the Intel Manual, cmpxchg should not touch the accumulator in case the values are equal, which is indeed the case on the real CPU:
+
+$ gcc 1.c
+$ ./a.out
+rax2 = 1234567812345678
+
+However, QEMU appears to zero extend EAX to RAX:
+
+$ qemu-x86_64 ./a.out
+rax2 = 12345678
+
+This is also the case for lock cmpxchg.
+
+Found in BPF development context: https://lore<email address hidden> \ No newline at end of file