Re: [Qt-creator] Debugging as super-user
So does anyone have any other bright ideas for debugging as super-user? Please? If there are any pointers in the right direction, I'm not afraid of poking around in the source myself. On Thu, Apr 15, 2010 at 11:00 AM, Bryce Schober bryce.scho...@gmail.comwrote: Actually, that doesn't work either. Qt Creator launches my application under the gdb-su, but it can't communicate for some reason. When I try to pause the app, it fails to pause, and the debugger window shows: State changed from InferiorRunning(10) to InferiorStopping(11). sStop requested... dTRYING TO INTERRUPT INFERIOR dCANNOT INTERRUPT 32147 My reference is that if I launch qt creator as root, all the debugging runs smoothly. On Thu, Apr 15, 2010 at 8:39 AM, Bryce Schober bryce.scho...@gmail.comwrote: Thanks for educating the Linux newbie! So here's what I got to work well for me. I added this line to my /etc/sudoers, using visudo: user machine= NOPASSWD: /usr/bin/gdb Then I created this bash script wrapper as /usr/bin/gdb-su: #!/bin/bash sudo gdb $@ Finally, I set qt-creator to use gdb-su as its gdb, and presto, happiness! -- Bryce Schober On Wed, Apr 14, 2010 at 6:26 PM, Coda Highland c...@bobandgeorge.comwrote: And for that matter you could use that technique to restrict it to your own user, too, so services couldn't get free root via gdb. /s/ Adam On Wed, Apr 14, 2010 at 8:25 PM, Coda Highland c...@bobandgeorge.com wrote: You could always modify /etc/sudoers to allow gdb to be run without a password. /s/ Adam -- Bryce Schober -- Bryce Schober ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] Debugging as super-user
On Thursday 15 April 2010 01:56:52 ext Bryce Schober wrote: yep. The problem is that I can't figure out how to get qt-creator to allow any wrapper to do the interactive stuff necessary to get through sudo, or preferrably gksu. That's strange. Does mlockall() depend on group permissions rather than user permissions? If so, try running echo ' #include stdio.h #include unistd.h #include grp.h int main(int argc, char *argv[]) { setreuid(geteuid(), geteuid()); setregid(getegid(), getegid()); gid_t zero = 0; setgroups(1, zero); return execvp(/usr/bin/gdb, argv); } ' | gcc -xc - -o /tmp/gdb-su chmod +s /tmp/gdb-su as root. Running the resulting executable as ordinary user produces here: a...@...:~$ /tmp/gdb-su -quiet -ex 'shell id' -ex quit warning: not using untrusted file /home/ap/.gdbinit uid=0(root) gid=0(root) groups=0(root) This looks pretty 'root-ish' to me... Andre' ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] Debugging as super-user
Still no good. On Thu, Apr 15, 2010 at 1:28 AM, André Pönitz andre.poen...@nokia.comwrote: echo ' #include stdio.h #include unistd.h #include grp.h int main(int argc, char *argv[]) { setreuid(geteuid(), geteuid()); setregid(getegid(), getegid()); gid_t zero = 0; setgroups(1, zero); return execvp(/usr/bin/gdb, argv); } ' | gcc -xc - -o /tmp/gdb-su chmod +s /tmp/gdb-su -- Bryce Schober ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] Debugging as super-user
On Tue, Apr 13, 2010 at 09:12:07AM -0700, Bryce Schober wrote: Is there a way to get Qt Creator to launch gdb as super-user? Obviously, I can start Qt Creator as super-user, but that leaves all the modified source and outputs with superuser perms, which screws up normal-user operations like svn, etc. I tried several different ways of wrapping gdb, and specifying the wrapper in Qt creator's gdb settings, but have had no success. Not sure this can be completed to a 'full solution', but if you make a copy of your /bin/sh chmod +s and export SHELL=/path/to/this/shell then 'shell id' within gdb gives you an euid of 0. And then there's setreuid()... Andre' ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] Debugging as super-user
On Tue, Apr 13, 2010 at 09:12:07AM -0700, Bryce Schober wrote: Is there a way to get Qt Creator to launch gdb as super-user? Obviously, I can start Qt Creator as super-user, but that leaves all the modified source and outputs with superuser perms, which screws up normal-user operations like svn, etc. I tried several different ways of wrapping gdb, and specifying the wrapper in Qt creator's gdb settings, but have had no success. Would echo ' #include stdio.h #include unistd.h int main(int argc, char *argv[]) { setreuid(geteuid(), geteuid()); setregid(getegid(), getegid()); return execvp(/usr/bin/gdb, argv); } ' | gcc -xc - -o /tmp/gdb-su chmod +s /tmp/gdb-su as root and pointing Qt Creator to /tmp/gdb-su in the 'gdb Location' setting do the trick? Note that this would give anyone on the system a root shell. Andre' ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] Debugging as super-user
Neither option works for me. Our application, which is a PC-build-variant of our embedded application, calls mlockall(), which fails with EPERM. Normal command-line usage of sudo works great, either for running or debugging with gdb, but I'm not sure how I would get equivalent permissions through qt-creator. On Wed, Apr 14, 2010 at 12:42 PM, Andre Poenitz andre.poen...@mathematik.tu-chemnitz.de wrote: On Tue, Apr 13, 2010 at 09:12:07AM -0700, Bryce Schober wrote: Is there a way to get Qt Creator to launch gdb as super-user? Obviously, I can start Qt Creator as super-user, but that leaves all the modified source and outputs with superuser perms, which screws up normal-user operations like svn, etc. I tried several different ways of wrapping gdb, and specifying the wrapper in Qt creator's gdb settings, but have had no success. Would echo ' #include stdio.h #include unistd.h int main(int argc, char *argv[]) { setreuid(geteuid(), geteuid()); setregid(getegid(), getegid()); return execvp(/usr/bin/gdb, argv); } ' | gcc -xc - -o /tmp/gdb-su chmod +s /tmp/gdb-su as root and pointing Qt Creator to /tmp/gdb-su in the 'gdb Location' setting do the trick? Note that this would give anyone on the system a root shell. Andre' ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator -- Bryce Schober ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] Debugging as super-user
On Wed, Apr 14, 2010 at 02:28:27PM -0700, Bryce Schober wrote: Neither option works for me. Our application, which is a PC-build-variant of our embedded application, calls mlockall(), which fails with EPERM. Normal command-line usage of sudo works great, either for running or debugging with gdb, but I'm not sure how I would get equivalent permissions through qt-creator. How do you invoke gdb as a user in that case? Plain 'sudo gdb'? Andre' ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] Debugging as super-user
You could always modify /etc/sudoers to allow gdb to be run without a password. /s/ Adam On Wed, Apr 14, 2010 at 6:56 PM, Bryce Schober bryce.scho...@gmail.com wrote: yep. The problem is that I can't figure out how to get qt-creator to allow any wrapper to do the interactive stuff necessary to get through sudo, or preferrably gksu. That said, I'm pretty much a newb. On Wed, Apr 14, 2010 at 2:54 PM, Andre Poenitz andre.poen...@mathematik.tu-chemnitz.de wrote: On Wed, Apr 14, 2010 at 02:28:27PM -0700, Bryce Schober wrote: Neither option works for me. Our application, which is a PC-build-variant of our embedded application, calls mlockall(), which fails with EPERM. Normal command-line usage of sudo works great, either for running or debugging with gdb, but I'm not sure how I would get equivalent permissions through qt-creator. How do you invoke gdb as a user in that case? Plain 'sudo gdb'? Andre' ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator -- Bryce Schober ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator