summary refs log tree commit diff stats
path: root/results/classifier/118/files/2238
blob: 6293d8d715d9e514f3109cf6b89d48556e503147 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
files: 0.921
register: 0.919
graphic: 0.878
PID: 0.838
performance: 0.832
ppc: 0.816
TCG: 0.775
device: 0.770
semantic: 0.766
network: 0.766
kernel: 0.759
arm: 0.749
socket: 0.747
architecture: 0.746
VMM: 0.709
vnc: 0.692
permissions: 0.675
debug: 0.672
peripherals: 0.670
assembly: 0.654
x86: 0.650
i386: 0.636
KVM: 0.627
mistranslation: 0.621
boot: 0.620
risc-v: 0.595
hypervisor: 0.568
user-level: 0.502
virtual: 0.466

The `rw` parameter of `qemu_plugin_register_vcpu_mem_cb()` is not properly honored
Description of problem:
The `rw` parameter of `qemu_plugin_register_vcpu_mem_cb()` is not properly honored.
Steps to reproduce:
1. Register a callback with `qemu_plugin_register_vcpu_mem_cb()`
2. In the callback, print the return of `qemu_plugin_mem_is_store()` (either `true` or `false`)
3. Change the value of `rw` parameter of `qemu_plugin_register_vcpu_mem_cb()` and look whether the callback prints `true` and/or `false` to determine if this is inline with `rw`.

In the callback, we don't we get what we asked for.

| Requested with rw   | Observed in the callback   |
|---------------------|----------------------------|
| QEMU_PLUGIN_MEM_R   | Only writes                |
| QEMU_PLUGIN_MEM_W   | Both reads and writes      |
| QEMU_PLUGIN_MEM_RW  | Both reads and writes      |
Additional information:
In `plugin-gen.c`, line 497, there is the following function:

```cpp
static bool op_rw(const TCGOp *op, const struct qemu_plugin_dyn_cb *cb)
{
    int w;

    w = op->args[2];
    return !!(cb->rw & (w + 1));
}
```

The issue described above seems to be caused by the `+ 1`. I removed it and got the expected results.

This function is used in the same file, line 526, like this:

```cpp
        if (!ok(begin_op, cb)) {
            continue;
        }
```

This isn't consistent with `core.c`, line 509, where the same flag is checked like this:

```cpp
        if (!(rw & cb->rw)) {
                break;
        }
```

Inconsistent because of the `+1` and also because of `break`/`continue`.