summary refs log tree commit diff stats
path: root/results/classifier/zero-shot-user-mode/output/syscall/1926521
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/syscall/1926521
parent61361f925d4914a6608a0076e64cc2399311ed5f (diff)
downloadqemu-analysis-c50b0c4da17b6e83640e4ed2380fffb5f507c846.tar.gz
qemu-analysis-c50b0c4da17b6e83640e4ed2380fffb5f507c846.zip
add zero-shot results
Diffstat (limited to 'results/classifier/zero-shot-user-mode/output/syscall/1926521')
-rw-r--r--results/classifier/zero-shot-user-mode/output/syscall/192652168
1 files changed, 68 insertions, 0 deletions
diff --git a/results/classifier/zero-shot-user-mode/output/syscall/1926521 b/results/classifier/zero-shot-user-mode/output/syscall/1926521
new file mode 100644
index 000000000..515d8a61b
--- /dev/null
+++ b/results/classifier/zero-shot-user-mode/output/syscall/1926521
@@ -0,0 +1,68 @@
+syscall: 0.535
+instruction: 0.287
+runtime: 0.178
+
+
+
+QEMU-user ignores MADV_DONTNEED
+
+There is comment int the code "This is a hint, so ignoring and returning success is ok"
+https://github.com/qemu/qemu/blob/b1cffefa1b163bce9aebc3416f562c1d3886eeaa/linux-user/syscall.c#L11941
+
+But it seems incorrect with the current state of Linux
+
+"man madvise" or https://man7.org/linux/man-pages/man2/madvise.2.html
+says the following:
+>>  These advice values do not influence the semantics
+>>       of the application (except in the case of MADV_DONTNEED)
+
+>> After a successful MADV_DONTNEED operation, the semantics
+>> of memory access in the specified region are changed:
+>> subsequent accesses of pages in the range will succeed,
+>> but will result in either repopulating the memory contents
+>> from the up-to-date contents of the underlying mapped file
+>> (for shared file mappings, shared anonymous mappings, and
+>> shmem-based techniques such as System V shared memory
+>> segments) or zero-fill-on-demand pages for anonymous
+>> private mappings.
+
+Some applications use this behavior clear memory and it
+would be nice to be able to run them on QEMU without
+workarounds.
+
+Reproducer on "Debian 5.10.24 x86_64 GNU/Linux" as a host.
+
+
+```
+#include "assert.h"
+#include "stdio.h"
+#include <sys/mman.h>
+#include <errno.h>
+
+int main() {
+  char *P = (char *)mmap(0, 4096, PROT_READ | PROT_WRITE,
+                         MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+  assert(P);
+  *P = 'A';
+  while (madvise(P, 4096, MADV_DONTNEED) == -1 && errno == EAGAIN) {
+  }
+  assert(*P == 0);
+
+  printf("OK\n");
+}
+
+/*
+gcc /tmp/madvice.c -o /tmp/madvice
+
+qemu-x86_64 /tmp/madvice
+madvice: /tmp/madvice.c:13: main: Assertion `*P == 0' failed.
+qemu: uncaught target signal 6 (Aborted) - core dumped
+Aborted
+
+/tmp/madvice
+OK
+
+
+*/
+
+```
\ No newline at end of file