From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18732 invoked by alias); 24 Jan 2008 05:05:34 -0000 Received: (qmail 18719 invoked by uid 22791); 24 Jan 2008 05:05:33 -0000 X-Spam-Check-By: sourceware.org Received: from wa-out-1112.google.com (HELO wa-out-1112.google.com) (209.85.146.176) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 24 Jan 2008 05:05:16 +0000 Received: by wa-out-1112.google.com with SMTP id l35so153520waf.12 for ; Wed, 23 Jan 2008 21:05:14 -0800 (PST) Received: by 10.115.107.1 with SMTP id j1mr279361wam.55.1201151114418; Wed, 23 Jan 2008 21:05:14 -0800 (PST) Received: by 10.115.58.2 with HTTP; Wed, 23 Jan 2008 21:05:14 -0800 (PST) Message-ID: <2379dacc0801232105r4afecc19r90a4a2f10f2d5054@mail.gmail.com> Date: Thu, 24 Jan 2008 05:05:00 -0000 From: "Michael Potter" To: "Andreas Schwab" Subject: Re: unable to attach to setuid program that as reverted it privilege Cc: "Mark Kettenis" , gdb@sourceware.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <2379dacc0801221159pfa2f3edh44c0b9c4ea6477ba@mail.gmail.com> <200801231752.m0NHqQPh001359@brahms.sibelius.xs4all.nl> <2379dacc0801231048l655f3463y748a41c7a4ab8b49@mail.gmail.com> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-01/txt/msg00246.txt.bz2 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. --=20 Michael Potter On Jan 23, 2008 2:42 PM, Andreas Schwab wrote: > "Michael Potter" 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=DFe 5, 90409 N=FCrnberg, Germany > PGP key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 > "And now for something completely different." >