From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 71991388A41A; Fri, 22 Jan 2021 04:42:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 71991388A41A From: "craig.ringer at 2ndquadrant dot com" To: systemtap@sourceware.org Subject: [Bug runtime/27224] stap 4.4 'cannot attach to module' in debugfs mode as non-root Date: Fri, 22 Jan 2021 04:42:36 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: runtime X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: craig.ringer at 2ndquadrant dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 04:42:36 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27224 --- Comment #3 from Craig Ringer --- OK, bit more digging done. If I build the module with $stap -m test_transport -p4 -DSTAP_TRANS_DEBUGFS \ -e 'probe begin { printf("started\n"); exit(); }' then on default mount mode: $ sudo mount /sys/kernel/debug -o remount,mode=3D700 running staprun as non-root fails: $ staprun -R -v test_transport.ko staprun:insert_module:191 Module test_tr_380170 inserted from file /home/craig/projects/2Q/systemtap/test_transport.ko ERROR: Cannot attach to module test_tr_380170 control channel; not runn= ing? ERROR: Cannot attach to module test_tr_380170 control channel; not runn= ing? ERROR: 'test_tr_380170' is not a zombie systemtap module. but as root works: $ sudo staprun -R -v test_transport.ko staprun:insert_module:191 Module test_tr_380194 inserted from file /home/craig/projects/2Q/systemtap/test_transport.ko started stapio:cleanup_and_exit:536 detach=3D0 stapio:cleanup_and_exit:553 closing control channel staprun:remove_module:284 Module test_tr_380194 removed. And I see the same behaviour from running stap itself: $ stap -vp 00005 -DSTAP_TRANS_DEBUGFS -e 'probe begin { printf("started\n"); exit(); }'=20 Pass 1: parsed user script and 496 library scripts using 337684virt/95784res/12788shr/82644data kb, in 140usr/30sys/176real ms. Pass 2: analyzed script: 1 probe, 1 function, 0 embeds, 0 globals using 339268virt/97432res/12860shr/84228data kb, in 10usr/0sys/6real ms. Pass 3: using cached /home/craig/.systemtap/cache/67/stap_67a78d650b7aca78a67c0155dbf23b64_1010.c Pass 4: using cached /home/craig/.systemtap/cache/67/stap_67a78d650b7aca78a67c0155dbf23b64_1010.= ko Pass 5: starting run. ERROR: Cannot attach to module stap_67a78d650b7aca78a67c0155dbf23b_3802= 55 control channel; not running? ERROR: Cannot attach to module stap_67a78d650b7aca78a67c0155dbf23b_3802= 55 control channel; not running? ERROR: 'stap_67a78d650b7aca78a67c0155dbf23b_380255' is not a zombie systemtap module. WARNING: /usr/bin/staprun exited with status: 1 Pass 5: run completed in 0usr/0sys/3real ms. Pass 5: run failed. [man error::pass5] $ sudo stap -vp 00005 -DSTAP_TRANS_DEBUGFS -e 'probe begin { printf("started\n"); exit(); }'=20 Pass 1: parsed user script and 496 library scripts using 330692virt/95728res/12740shr/82480data kb, in 150usr/20sys/172real ms. Pass 2: analyzed script: 1 probe, 1 function, 0 embeds, 0 globals using 332276virt/97376res/12812shr/84064data kb, in 10usr/0sys/6real ms. Pass 3: translated to C into "/tmp/stapDRx9sx/stap_df533545ae591f1f9eca48caaf372255_1007_src.c" using 332408virt/97376res/12812shr/84196data kb, in 0usr/0sys/0real ms. Pass 4: compiled C into "stap_df533545ae591f1f9eca48caaf372255_1007.ko"= in 1800usr/620sys/2244real ms. Pass 5: starting run. started Pass 5: run completed in 10usr/30sys/377real ms. Repeating the same with debugfs mode 755, I see that the non-root runs now = work too: $ sudo mount /sys/kernel/debug -o remount,mode=3D700 $ staprun -R -v test_transport.ko staprun:insert_module:191 Module test_tr_381074 inserted from file /home/craig/projects/2Q/systemtap/test_transport.ko started stapio:cleanup_and_exit:536 detach=3D0 stapio:cleanup_and_exit:553 closing control channel staprun:remove_module:284 Module test_tr_381074 removed. $ sudo stap -vp 00005 -DSTAP_TRANS_DEBUGFS -e 'probe begin { printf("started\n"); exit(); }' Pass 1: parsed user script and 496 library scripts using 330692virt/95384res/12400shr/82480data kb, in 150usr/10sys/172real ms. Pass 2: analyzed script: 1 probe, 1 function, 0 embeds, 0 globals using 332276virt/97032res/12472shr/84064data kb, in 10usr/0sys/5real ms. Pass 3: using cached /root/.systemtap/cache/df/stap_df533545ae591f1f9eca48caaf372255_1007.c Pass 4: using cached /root/.systemtap/cache/df/stap_df533545ae591f1f9eca48caaf372255_1007.ko Pass 5: starting run. started Pass 5: run completed in 0usr/20sys/377real ms. --=20 You are receiving this mail because: You are the assignee for the bug.=