From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: david@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 4/8] exec: Factor out cpu_watchpoint_address_matches
Date: Thu, 29 Aug 2019 18:32:48 -0700 [thread overview]
Message-ID: <8b5b1247-cd77-d890-b15c-3e0a6db00afd@linaro.org> (raw)
In-Reply-To: <dc2d396f-d1ac-1c45-0bf8-16acc7421647@redhat.com>
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~
next prev parent reply other threads:[~2019-08-30 1:35 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-28 23:16 [Qemu-devel] [PATCH v2 0/8] exec: Cleanup watchpoints Richard Henderson
2019-08-28 23:16 ` [Qemu-devel] [PATCH v2 1/8] exec: Move user-only watchpoint stubs inline Richard Henderson
2019-08-29 16:58 ` Philippe Mathieu-Daudé
2019-08-28 23:16 ` [Qemu-devel] [PATCH v2 2/8] exec: Factor out core logic of check_watchpoint() Richard Henderson
2019-08-29 17:26 ` Philippe Mathieu-Daudé
2019-08-30 1:21 ` Richard Henderson
2019-08-30 17:52 ` Philippe Mathieu-Daudé
2019-08-28 23:16 ` [Qemu-devel] [PATCH v2 3/8] cputlb: Fold TLB_RECHECK into TLB_INVALID_MASK Richard Henderson
2019-08-28 23:16 ` [Qemu-devel] [PATCH v2 4/8] exec: Factor out cpu_watchpoint_address_matches Richard Henderson
2019-08-29 17:20 ` Philippe Mathieu-Daudé
2019-08-30 1:32 ` Richard Henderson [this message]
2019-08-28 23:16 ` [Qemu-devel] [PATCH v2 5/8] cputlb: Fix size operand for tlb_fill on unaligned store Richard Henderson
2019-08-29 6:57 ` David Hildenbrand
2019-08-29 16:59 ` Philippe Mathieu-Daudé
2019-08-28 23:16 ` [Qemu-devel] [PATCH v2 6/8] cputlb: Remove double-alignment in store_helper Richard Henderson
2019-08-29 6:57 ` David Hildenbrand
2019-08-29 17:00 ` Philippe Mathieu-Daudé
2019-08-28 23:16 ` [Qemu-devel] [PATCH v2 7/8] cputlb: Handle watchpoints via TLB_WATCHPOINT Richard Henderson
2019-08-29 6:57 ` David Hildenbrand
2019-08-29 17:15 ` Philippe Mathieu-Daudé
2019-08-28 23:16 ` [Qemu-devel] [PATCH v2 8/8] tcg: Check for watchpoints in probe_write() Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8b5b1247-cd77-d890-b15c-3e0a6db00afd@linaro.org \
--to=richard.henderson@linaro.org \
--cc=david@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).