Bug 10601

Summary: user-space deref/registers in loc2c
Product: systemtap Reporter: Frank Ch. Eigler <fche>
Component: runtimeAssignee: Frank Ch. Eigler <fche>
Severity: normal CC: jistone, mjw
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 10289, 10318, 10762, 10907    

Description Frank Ch. Eigler 2009-09-03 21:05:08 IST
For secure/robust memory and register access for user-space $target expressions,
the translator must parametrize loc2c to emit different calls for user-space
probes than for kernel-space ones.  This is partly so that user-space $pointers
can't poke at kernel memories, and vice versa.

Related, the user-space register/memory access logic must become aware of
32-bit vs. 64-bit user-space processes on a 64-bit host.  For registers,
this appears to require use of the proper utrace regset machinery instead
of poking at pt_regs.
Comment 1 Josh Stone 2009-09-03 21:11:05 IST
Likewise, @cast will need to learn whether its type should be treated as a user
or kernel.  This can't come from probe context, since @cast can appear in any
probe or function.
Comment 2 Mark Wielaard 2009-09-04 07:05:24 IST
This is the root cause of bug #10318 "Bad address reading arg from mark probe"
which also contains some discussions about the implementation of this in loc2c.
The register mapping disparity also seems to be the root cause of some of the
exelib.exp mark.tcl tests failing (currently disabled) on 32-on-64 bit systems,
bug #10289 "stap probes user space markers don't work with 32-on-64
executables". On i386 some sdt_misc.exp sdt_types tests are failing, which most
likely can also be attributed to the register fetch mismatch in user space.

It might be good to make comment #1 into its own bug.
Comment 3 Frank Ch. Eigler 2009-12-21 19:21:56 IST
The basic function for loc2c purposes ($-variables) is done for i386 and x86-64.
Further work needed: interfacing unwinding logic, porting to other architectures,
and working on the tapset/**/register* widgets to interface to the same.
Comment 4 Mark Wielaard 2011-07-20 21:19:29 IST
*** Bug 10318 has been marked as a duplicate of this bug. ***