[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 4/8] exec: Factor out cpu_watchpoint_address_
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH v2 4/8] exec: Factor out cpu_watchpoint_address_matches |
Date: |
Thu, 29 Aug 2019 18:32:48 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 8/29/19 10:20 AM, Philippe Mathieu-Daudé wrote:
>> + /* Avoid trapping reads of pages with a write breakpoint. */
>> + match = (prot & PAGE_READ ? BP_MEM_READ : 0)
>> + | (prot & PAGE_WRITE ? BP_MEM_WRITE : 0);
>
> Isn't it cheaper to do here:
>
> if (!match) {
> return iotlb;
> }
>
> or
>
> if (match) {
Note that PROT_NONE pages never reach here; they always trap in tlb_fill.
The only way we can get match == 0 here is for the case of an execute-only
page. Which is possible, but extremely unlikely. Almost all targets merge the
text and rodata sections, which means that virtually all executable pages are
also readable.
(Although I must say that in this age of ROP-gadgets, leaving the rodata
section executable is probably a mistake, and tools should be updated to *not*
merge them. That's still not necessarily execute-only for the text section,
but I don't see anything in principal that would prevent it.)
r~
- [Qemu-devel] [PATCH v2 0/8] exec: Cleanup watchpoints, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v2 1/8] exec: Move user-only watchpoint stubs inline, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v2 2/8] exec: Factor out core logic of check_watchpoint(), Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v2 3/8] cputlb: Fold TLB_RECHECK into TLB_INVALID_MASK, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v2 4/8] exec: Factor out cpu_watchpoint_address_matches, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v2 5/8] cputlb: Fix size operand for tlb_fill on unaligned store, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v2 6/8] cputlb: Remove double-alignment in store_helper, Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v2 8/8] tcg: Check for watchpoints in probe_write(), Richard Henderson, 2019/08/28
- [Qemu-devel] [PATCH v2 7/8] cputlb: Handle watchpoints via TLB_WATCHPOINT, Richard Henderson, 2019/08/28