From: Yao Qi <qiyaoltc@gmail.com>
To: Wei-min Pan <weimin.pan@oracle.com>
Cc: "gdb-patches\@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PING][PATCH PR gdb/21870] aarch64: Leftover uncleared debug registers
Date: Fri, 27 Oct 2017 09:05:00 -0000 [thread overview]
Message-ID: <86she53qqc.fsf@gmail.com> (raw)
In-Reply-To: <c32a1848-3654-d0b8-d48b-539a162d4785@oracle.com> (Wei-min Pan's message of "Mon, 23 Oct 2017 09:38:01 -0700")
Wei-min Pan <weimin.pan@oracle.com> writes:
> The most likely explanation is that ptrace() (1) does not validate contents
> in either address or control register, and (2) uses some default
> control values
> when setting hardware breakpoints. (2) is the main reason that contents in
> control register becomes non-zero after the aarch64_linux_set_debug_regs()
> call. BTW the value of 0x1fc in control register is not random but can be
> decoded as:
>
> "a watchpoint which is disabled, priv 2, 8-bytes, and of type hw_access"
The test case we got from Jan (in PR 21870) is that parent forks a
child, and read hw debug registers. The parent asserts on some bits of
debug registers read from child process. They are zero when the program
runs standalone, but they aren't zero after it runs within GDB. When it
runs in GDB, GDB is the grand-parent, in default, follow-fork-mode is
parent, and detach-on-fork is on, IOW, GDB (as a grandparent) only
attaches to the parent process, and leaves the child process run
freely. Then, the parent process reads some "unexpected" value from
child process, why is it a bug in the grandparent process?
Secondly, why is it valid to expect 'length' is zero when the debug
register is disabled?
assert (DR_CONTROL_LENGTH (dreg_state.dbg_regs[0].ctrl) == 0);
GDB thinks if debug register is disabled, then, it can be used. Now,
the observation is that when a debug register is disabled, the 'length'
can be different values in case that the process has tracer grandparent
or not. We may need to look into Linux kernel.
--
Yao (齐尧)
next prev parent reply other threads:[~2017-10-27 9:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1507328314-114545-1-git-send-email-weimin.pan@oracle.com>
2017-10-21 0:58 ` Wei-min Pan
2017-10-22 21:15 ` Yao Qi
2017-10-23 16:38 ` Wei-min Pan
2017-10-27 9:05 ` Yao Qi [this message]
2017-10-28 0:20 ` Weimin Pan
2017-11-10 1:07 ` [PING 2][PATCH " Wei-min Pan
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=86she53qqc.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=weimin.pan@oracle.com \
/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