public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/15688] New: Accessing globals in DSO or PIE results in read faults
@ 2013-06-27  2:02 agentzh at gmail dot com
  2013-06-27 16:05 ` [Bug translator/15688] " jistone at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: agentzh at gmail dot com @ 2013-06-27  2:02 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=15688

            Bug ID: 15688
           Summary: Accessing globals in DSO or PIE results in read faults
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
          Assignee: systemtap at sourceware dot org
          Reporter: agentzh at gmail dot com

I've noticed that use of @var("foo") or $foo in either probe process.function
or probe process.mark could lead to the following error when there is a global
variable named "foo" in the current userspace DSO or PIE module:

  ERROR: read fault [man error::fault] at 0x          (null) (addr) near
operator '@var'

It seems that dwarf_var_expanding_visitor::visit_target_symbol can resolve the
variable into a global variable but does not enable the VMA tracker for the
current module accordingly.

I can always reproduce this with trivial example on the current master (commit
5883b785fa)

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug translator/15688] Accessing globals in DSO or PIE results in read faults
  2013-06-27  2:02 [Bug translator/15688] New: Accessing globals in DSO or PIE results in read faults agentzh at gmail dot com
@ 2013-06-27 16:05 ` jistone at redhat dot com
  2013-06-27 19:37 ` agentzh at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jistone at redhat dot com @ 2013-06-27 16:05 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=15688

Josh Stone <jistone at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jistone at redhat dot com

--- Comment #1 from Josh Stone <jistone at redhat dot com> ---
(In reply to agentzh from comment #0)
> I can always reproduce this with trivial example on the current master

Can you state such an example here?

dwflpp::emit_address already calls enable_task_finder for cases which use
_stp_umodule_relocate, but it may be more specific to its needs to call
enable_vma_tracker.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug translator/15688] Accessing globals in DSO or PIE results in read faults
  2013-06-27  2:02 [Bug translator/15688] New: Accessing globals in DSO or PIE results in read faults agentzh at gmail dot com
  2013-06-27 16:05 ` [Bug translator/15688] " jistone at redhat dot com
@ 2013-06-27 19:37 ` agentzh at gmail dot com
  2013-06-27 22:17 ` jistone at redhat dot com
  2013-06-27 22:51 ` jistone at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: agentzh at gmail dot com @ 2013-06-27 19:37 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=15688

--- Comment #2 from agentzh <agentzh at gmail dot com> ---
Included the corresponding tests in the test file
systemtap.base/sdt_global_var.exp included in my patch here:

http://sourceware.org/ml/systemtap/2013-q2/msg00389.html

Thanks!

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug translator/15688] Accessing globals in DSO or PIE results in read faults
  2013-06-27  2:02 [Bug translator/15688] New: Accessing globals in DSO or PIE results in read faults agentzh at gmail dot com
  2013-06-27 16:05 ` [Bug translator/15688] " jistone at redhat dot com
  2013-06-27 19:37 ` agentzh at gmail dot com
@ 2013-06-27 22:17 ` jistone at redhat dot com
  2013-06-27 22:51 ` jistone at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: jistone at redhat dot com @ 2013-06-27 22:17 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=15688

--- Comment #3 from Josh Stone <jistone at redhat dot com> ---
(In reply to Josh Stone from comment #1)
> dwflpp::emit_address already calls enable_task_finder for cases which use
> _stp_umodule_relocate, but it may be more specific to its needs to call
> enable_vma_tracker.

I tried this suggestion with your testcase, and it did the trick.  I think it
will also make this hack from parse_cmdline unnecessary:

  // PR10228: trigger vma tracker logic early if -d /USER-MODULE/
  // given. XXX This is actually too early. Having a user module
  // is a good indicator that something will need vma tracking.
  // But it is not 100%, this really should only trigger through
  // a user mode tapset /* pragma:vma */ or a probe doing a
  // variable lookup through a dynamic module.
  if (mpath[0] == '/')
    enable_vma_tracker (*this);

... because we already have pragma:vma, and I believe my suggestion addresses
the variable lookup.  I think this will also make it so the @var patch doesn't
need to manually enable_vma_tracker(), since dwflpp can enable it as needed.

Another way to handle this is to let dwflpp::emit_address() just insert a
pragma:vma in the generated code.  This will allow the optimizer a chance to
remove unused references before the vma is actually enabled.  We can hopefully
get to a state where the only place calling enable_vma_tracker() is
embeddedcode_info::visit_embeddedcode(), based on pragma:vma.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug translator/15688] Accessing globals in DSO or PIE results in read faults
  2013-06-27  2:02 [Bug translator/15688] New: Accessing globals in DSO or PIE results in read faults agentzh at gmail dot com
                   ` (2 preceding siblings ...)
  2013-06-27 22:17 ` jistone at redhat dot com
@ 2013-06-27 22:51 ` jistone at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: jistone at redhat dot com @ 2013-06-27 22:51 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=15688

Josh Stone <jistone at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|systemtap at sourceware dot org    |jistone at redhat dot com

--- Comment #4 from Josh Stone <jistone at redhat dot com> ---
Created attachment 7099
  --> http://sourceware.org/bugzilla/attachment.cgi?id=7099&action=edit
Set pragma:vma when dwflpp uses _stp_umodule_relocate

This patch seems to do the trick.  It's based on agentzh's v3 @var patch plus
the addendum he linked in comment #2.  I'm running a full installcheck now.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-06-27 22:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-27  2:02 [Bug translator/15688] New: Accessing globals in DSO or PIE results in read faults agentzh at gmail dot com
2013-06-27 16:05 ` [Bug translator/15688] " jistone at redhat dot com
2013-06-27 19:37 ` agentzh at gmail dot com
2013-06-27 22:17 ` jistone at redhat dot com
2013-06-27 22:51 ` jistone at redhat dot com

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 read-only IMAP folder(s) and NNTP newsgroup(s).