Bug 14409

Summary: Delay inode-uprobes registration until after buildid checks
Product: systemtap Reporter: Josh Stone <jistone>
Component: runtimeAssignee: David Smith <dsmith>
Status: RESOLVED FIXED    
Severity: normal CC: dsmith
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Josh Stone 2012-07-26 17:52:44 UTC
The old utrace-uprobes operated on a per-process model.  We would use task_finder to locate processes with the interesting module, then after verifying the buildid, register a uprobe in that process.

The new inode-uprobes operates on an inode model, systemwide.  I argued that it doesn't make sense to force the per-process model on this, because you can't really register a uprobe for just one process.  So instead we're looking up and registering on inodes when stap.ko starts.  But the downside is that the buildid check doesn't have any chance to validate this, since the inode may not even be in memory yet.

So here's a proposed compromise -- delay registration, but still treat it as systemwide.  This may look roughly like:
(1) On stap.ko start, just register task_finder for each stapiu_target.
(2) The first time a target is seen, check its buildid.  If it matches, then igrab that inode and register every stapiu_consumer for that target.
(3) Every time the target is seen, still need to manipulate any semaphores.
(4) On stap.ko unload, unregister whatever consumers came alive, and iput all the targets we did igrab.

Note we don't need to unregister+iput targets when individual processes go away, because the registration is systemwide, and we know that we have an inode* with a good buildid.
Comment 1 David Smith 2012-08-02 15:47:07 UTC
Fixed in commit 509b6dd.