Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Aug 2020 20:41:40 +0200
From:      Polytropon <freebsd@edvax.de>
To:        "Ronald F. Guilmette" <rfg@tristatelogic.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: GDB no workie?  Permission problem?
Message-ID:  <20200810204140.62390ec3.freebsd@edvax.de>
In-Reply-To: <62605.1597078863@segfault.tristatelogic.com>
References:  <62605.1597078863@segfault.tristatelogic.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200810204140.62390ec3.freebsd>