From owner-freebsd-current Wed Feb 5 13:50:10 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6999E37B401 for ; Wed, 5 Feb 2003 13:50:09 -0800 (PST) Received: from mother.thoughtworks.com (mother.thoughtworks.com [204.178.39.204]) by mx1.FreeBSD.org (Postfix) with ESMTP id ECD6243F9B for ; Wed, 5 Feb 2003 13:50:07 -0800 (PST) (envelope-from anoop@ranganath.com) Received: from ranganath ([10.4.2.12]) by mother.thoughtworks.com (Lotus Domino Release 5.0.11) with SMTP id 2003020516133218:8729 ; Wed, 5 Feb 2003 16:13:32 -0600 Message-ID: <015c01c2cd60$7b6dc0a0$0c02040a@ranganath> From: "Anoop Ranganath" To: "Terry Lambert" Cc: References: <00e201c2cd5b$14f31c30$0c02040a@ranganath> <3E41846A.39AAE406@mindspring.com> Subject: Re: tmpfile breakage on setuid executables Date: Wed, 5 Feb 2003 15:49:34 -0600 MIME-Version: 1.0 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-MIMETrack: Itemize by SMTP Server on Mother/ThoughtWorks.COM/US(Release 5.0.11 |July 24, 2002) at 02/05/2003 04:13:32 PM, Serialize by Router on Mother/ThoughtWorks.COM/US(Release 5.0.11 |July 24, 2002) at 02/05/2003 04:13:36 PM, Serialize complete at 02/05/2003 04:13:36 PM Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="iso-8859-1" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > > I've used the code at the bottom of this message to isolate this > > bug. The summary is that when I compile the code as root, and then > > make it setuid (chmod u+s a.out) and then try to run it as a user, the > > tmpfile() fails. If I run it as root, it works fine. Conversely, I > > can give user ownership of the executable, and then run it as user, and > > it works great, but if fails for root. Again this is only with the > > setuid bit set. > > Probably your real and effective UID's aren't the same. Does your > SUID root program set the real UID from the effective UID? Well, the code sample I submitted in my original email doesn't set any UID. It just creates a tmpfile() and then verifies that it succeeded. This is definitely a regression from 4.7 though. Running the same code on 4.7 succeeds, as it does on several other unix boxes. Anoop To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message