Fails to run as unprivileged user

Bug #953892 reported by Hernando Torque
8
This bug affects 2 people
Affects Status Importance Assigned to Milestone
systemtap (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

[Originally posted to the systemtap mailing list: http://sourceware.org/ml/systemtap/2012-q1/msg00239.html]

I have a problem with running SystemTap as unprivileged user.

Executing the following probe as root works fine[0]:

    stap -e 'probe vfs.read {printf("read performed\n"); exit()}'

However, running it as user (in 'stapusr' and stapdev' groups) fails[1]. Doing the same in Fedora 17 Alpha succeeds.

The module gets loaded, but 'stapio' is never run, and the removal of the module seems to fail as well, as it's still loaded when 'stap' exits.

All the suggested config options are set in the Ubuntu kernel[2] (except of CONFIG_UTRACE, though that's not necessary for that test I guess).

There are no dmesg errors (see working[3] and failing[4] -DDEBUG_TRANS output).

What I tried:
* A tailored 3.3-rc5 vanilla kernel with UTRACE patched in, same result.
* Disabled AppArmor, no joy.
* Tested the 3/3/2012 snapshot of SystemTap. That slightly changed the output but not the end result[5].
* Tested a vanilla 3.3-rc5 kernel with the Fedora 17 Alpha kernel config[6], which failed too.

Colin King's first idea: "I suspect it is some user space foo config that we're missing" - would be interesting to reveal that foo. :-)

0: Working as root: http://paste.ubuntu.com/871163/
1: Failing as user: http://paste.ubuntu.com/871165/
2: Ubuntu kernel config: http://paste.ubuntu.com/871166/
3: 1.6 dmesg working: http://paste.ubuntu.com/871168/
   Snapshot dmesg working: http://paste.ubuntu.com/871169/
4: 1.6 dmesg failing: http://paste.ubuntu.com/871172/
   Snapshot dmesg failing: http://paste.ubuntu.com/871173/
5: Ubuntu with snapshot: http://paste.ubuntu.com/871190/
6: Fedora kernel config: http://paste.ubuntu.com/871175/

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: systemtap (not installed)
ProcVersionSignature: Ubuntu 3.2.0-18.29-generic 3.2.9
Uname: Linux 3.2.0-18-generic x86_64
ApportVersion: 1.94.1-0ubuntu2
Architecture: amd64
Date: Tue Mar 13 11:15:38 2012
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Beta amd64 (20110901)
SourcePackage: systemtap
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Hernando Torque (htorque) wrote :
Revision history for this message
Hernando Torque (htorque) wrote :

Just for the sake of completeness: this is still happening in the final release of Ubuntu 12.04.

Revision history for this message
Ritesh Raj Sarraf (rrs) wrote : Re: [Bug 953892] Re: Fails to run as unprivileged user

On Saturday 28 April 2012 10:18 PM, Hernando Torque wrote:
> Just for the sake of completeness: this is still happening in the final
> release of Ubuntu 12.04.

This works fine on Debian. If you look at the divergence of Ubuntu from
Debian:

* Kernel - You already verified it and that it has all infrastructure in
place.
* MAC - You say AppArmor is disabled.

What you could check is if the stapusr/stapdev groups were managed
proper in Ubuntu.

--
Ritesh Raj Sarraf
RESEARCHUT - http://www.researchut.com
"Necessity is the mother of invention."

Revision history for this message
Hernando Torque (htorque) wrote :

Thanks for the info about this working in Debian! Will test it there and then re-check the groups in Ubuntu.

Revision history for this message
Hernando Torque (htorque) wrote :

I can confirm that this works in Debian testing. I made sure to set up the groups the same way as in Ubuntu and it worked like expected. I then tried Debian's packages in Ubuntu without luck.

I'm afraid figuring this out is out of my league. ;-)

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in systemtap (Ubuntu):
status: New → Confirmed
Revision history for this message
Timo Juhani Lindfors (timo-lindfors) wrote :

This might be debian bug #706817 that was fixed in systemtap 1.7-1+deb7u1.

To confirm, please paste the output of

ls -ld /sys/kernel/debug

Thanks!

Revision history for this message
Emanuele Rocca (ema) wrote :

Warnings aside, the example mentioned here works when running stap as an unprivileged user on focal:

vagrant@ubuntu-focal:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu Focal Fossa (development branch)
Release: 20.04
Codename: focal
vagrant@ubuntu-focal:~$ id
uid=1000(vagrant) gid=1000(vagrant) groups=1000(vagrant),120(stapdev),121(stapusr)
vagrant@ubuntu-focal:~$ stap -e 'probe vfs.read {printf("read performed\n"); exit()}'
WARNING: Kernel function symbol table missing [man warning::symbols]
WARNING: Potential type mismatch in reassignment: identifier 'root_dentry' at /usr/share/systemtap/tapset/linux/dentry.stp:246:3
 source: root_dentry = @cast(task, "task_struct")->fs->root->dentry
                        ^
read performed
Number of similar warning messages suppressed: 1.
Rerun with -v to see them.
vagrant@ubuntu-focal:~$

Changed in systemtap (Ubuntu):
status: Confirmed → Fix Committed
Emanuele Rocca (ema)
Changed in systemtap (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.