GDB no workie? Permission problem?

Polytropon freebsd at edvax.de
Mon Aug 10 18:41:45 UTC 2020


On Mon, 10 Aug 2020 10:01:03 -0700, Ronald F. Guilmette wrote:
> Just ran gdb, which I haven't done for awhile, to find a small
> bug in one of my own C programs.
> 
> Set two breakpoints successfully and then tried to r(un) the
> program to be debugged.  (This was all being done under my
> own personal non-priviliged account.)
> 
> Immediately got something very unexpected:
> 
>     warning: Could not trace the inferior process.
>     Error: 
>     warning: ptrace: Operation not permitted
>     During startup program exited with code 127.
> 
> I su'd to root and tried again, and of course now it works.
> 
> So, um, what the hay? What goes on here?
> 
> I seem to vaguely recall some "security" options being presented
> at system install time, and I do believe one of these had to do
> with ptrace.  So I guess that I must have made the Wrong Choice
> with respect to that one. OK. Fine.  Now how do I fix that misake
> on my part, short of re-installing the whole bloody system?

Yes, that seems to be the case here. At installation stage,
certain options would have been set in the relevant configuraiton
files, but there's noting requiring a re-installation - you can
undo those changes with a simple text editor. :-)

Check the following files:

	/boot/loader.conf
	/etc/sysctl.conf	<--- probably this one
	/etc/rc.conf

I'm sure you'll find something related to security restrictions,
such as those:

	security.bsd.unprivileged_read_msgbuf=0
	security.bsd.unprivileged_proc_debug=0
	security.bsd.see_other_uids=0

As suggested by Yasuhiro Kimura, there are several settings that
could have been applied. See the following file to find their
names and settings:

	/usr/libexec/bsdinstall/hardening

You can use sysctl interactively, or just edit the files and
reboot the system so they take effect.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list