public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "Michael Potter" <pottmi@gmail.com>
To: "Andreas Schwab" <schwab@suse.de>
Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>, gdb@sourceware.org
Subject: Re: unable to attach to setuid program that as reverted it privilege
Date: Thu, 24 Jan 2008 05:05:00 -0000	[thread overview]
Message-ID: <2379dacc0801232105r4afecc19r90a4a2f10f2d5054@mail.gmail.com> (raw)
In-Reply-To: <je8x2g8eav.fsf@sykes.suse.de>

Andreas,

works great.

Here are a few notes in case someone else has this same problem....

To turn this on, do this:
1) log in as root
2) echo 2 >/proc/sys/kernel/suid_dumpable

To turn this off, do this:
1) log in as root
2) echo 0 >/proc/sys/kernel/suid_dumpable

On some systems the target file might be in /proc/sys/fs

It will not work to just use sudo in front of echo.  You must log in
as root because the redirection has the user's privilege.

I do not know what echo 1 would do.

This is documented as allowing core files to be created for setuid
programs.  What I am using it for is to allow gdb run as a non-root
user to connect to setuid programs that have _permanently_ given up
their root privilege.  Without suid_dumpable enabled, gdb will fail
with a EPERM error even tho the target program is no longer running as
root and can not reacquire root privilege ( a good default behavior ).

This will work fine for my needs, but I would prefer finer grained control.
that is:
1) separate attaching and core dumping.
2) don't turn on this feature for _all_ processes, just select processes.

This should only be used in a controlled environment because of the
security issues.

Because this turns on core dumping it would be prudent to also look
into /proc/sys/kernel/core_pattern to prevent name collision when core
dumps are created.

-- 
Michael Potter

On Jan 23, 2008 2:42 PM, Andreas Schwab <schwab@suse.de> wrote:
> "Michael Potter" <pottmi@gmail.com> writes:
>
> > I will post to a Linux kernel list in a couple of days.  I posted here
> > because I felt that I was likely to find someone who had the same
> > problem in this group.
>
> /proc/sys/kernel/suid_dumpable might be what you are looking for.
>
> Andreas.
>
> --
> Andreas Schwab, SuSE Labs, schwab@suse.de
> SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
> PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
>

  reply	other threads:[~2008-01-24  5:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-22 20:00 Michael Potter
2008-01-22 20:09 ` Daniel Jacobowitz
2008-01-22 20:24   ` Michael Potter
2008-01-23 17:52 ` Mark Kettenis
2008-01-23 18:48   ` Michael Potter
2008-01-23 20:26     ` Michael Potter
2008-01-23 20:42     ` Andreas Schwab
2008-01-24  5:05       ` Michael Potter [this message]
2008-01-24  9:18         ` Andreas Schwab
2008-04-14 13:46 Reynolds, Brandon
2008-04-14 16:32 ` Michael Potter
2008-04-14 16:45 ` Tavis Ormandy
2008-04-15  1:02   ` Reynolds, Brandon
2008-04-15  1:24     ` Michael Potter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2379dacc0801232105r4afecc19r90a4a2f10f2d5054@mail.gmail.com \
    --to=pottmi@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).