diff options
Diffstat (limited to 'results/classifier/118/permissions/1689')
| -rw-r--r-- | results/classifier/118/permissions/1689 | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/results/classifier/118/permissions/1689 b/results/classifier/118/permissions/1689 new file mode 100644 index 00000000..42f6bafc --- /dev/null +++ b/results/classifier/118/permissions/1689 @@ -0,0 +1,41 @@ +permissions: 0.983 +mistranslation: 0.968 +boot: 0.943 +files: 0.933 +performance: 0.922 +device: 0.890 +graphic: 0.882 +semantic: 0.851 +peripherals: 0.814 +architecture: 0.809 +debug: 0.699 +ppc: 0.647 +user-level: 0.601 +x86: 0.579 +i386: 0.568 +network: 0.560 +PID: 0.557 +vnc: 0.547 +risc-v: 0.539 +hypervisor: 0.483 +register: 0.477 +VMM: 0.470 +kernel: 0.434 +arm: 0.427 +TCG: 0.412 +socket: 0.305 +assembly: 0.287 +virtual: 0.282 +KVM: 0.270 + +memory backend file unnecessarily requires write permission while it is only mapped privately +Description of problem: +One day I wanted to boot the machine with physical memory initialized with a file, in a copy-on-write style. That is why I tried out `-mem-path` and `-object memory-backend-file`. Actually `-mem-path` already works if not considering that qemu dislikes the backing file being readonly and requires it to be writeable even when only private mappings are used here. + +I sadly found out that when using memory-backend-file, and when `share=off`, if `readonly=on`, then file is `open`ed with `O_RDONLY` and mmap prot is `PROT_READ`; if `readonly=off`, then the file is `open`ed with `O_RDWR` and mmap prot is `PROT_READ|PROT_WRITE`. I want `O_RDONLY` and `PROT_READ|PROT_WRITE` but I cannot find it anywhere. + +In my opinion, expected behavior should be that if `share=off`, the file can already be opened with `O_RDONLY` no matter what prot the mmap is. That is how linux `MAP_PRIVATE` works - basically copy on write. When I only need copy on write for the content of file, why do I require write permission for it? + +Now I cannot find a setup that opens the file with `fd=open(*, O_RDONLY)` and mmap it with `mmap(*, *, PROT_READ|PROT_WRITE, MAP_PRIVATE|*, fd, *)`. + +Tell me if I misunderstood linux (for example certain file behave differently if one open with O_RDONLY and this behavior is necessary) or qemu or other posix systems where copy-on-write does not work like this. |