Subject: Re: core vs seteuid()
To: None <netbsd-users@netbsd.org>
From: Jorgen Lundman <lundman@lundman.net>
List: netbsd-users
Date: 05/30/2003 16:25:23
(sorry David, didn't mean to reply only to you).

Can we make that somewhat more dynamic, sysctl or similar.  Oh well :)

Guess I can start it in gdb, and not do the background fork()...

Lund

David Maxwell wrote:
> On Fri, May 30, 2003 at 11:17:23AM +0900, Jorgen Lundman wrote:
> 
>>Program calls seteuid() a fair bit, but if it ever dies I need the core to 
>>remove any bugs. I know it may be undesirable to have core files from 
>>seteuid programs in a multi user machine, but since these are dedicated 
>>development machines that is not a concern.
>>
>>Are there easy ways to make sure it dumps core, _always_? Even if I have to 
>>force them into a special directory or whatever. I would rather not have to 
>>hack at kernel sources and rebuild the kernel too :)
> 
> 
> That's what you'll need to do...
> 
> /usr/src/sys/kern/kern_sig.c
> 
> /*
>  * Dump core, into a file named "progname.core" or "core" (depending on
> the
>  * value of shortcorename), unless the process was setuid/setgid.
>  */
> int
> coredump(struct proc *p)
> {
>         struct vnode            *vp;
>         struct vmspace          *vm;
>         struct ucred            *cred;
>         struct nameidata        nd;
>         struct vattr            vattr;
>         int                     error, error1;
>         char                    name[MAXPATHLEN];
> 
>         vm = p->p_vmspace;
>         cred = p->p_cred->pc_ucred;
> 
>         /*
>          * Make sure the process has not set-id, to prevent data leaks.
>          */
>         if (p->p_flag & P_SUGID)
>                 return (EPERM);
> 
> 
> So... Comment out those last two lines - build a kernel, and you're all
> set.
> 
> 						David
> 
> 
> 

-- 
Jorgen Lundman       | <lundman@lundman.net>
Unix Administrator   | +81 (0)3 -5456-2687 ext 1017 (work)
Shibuya-ku, Tokyo    | +81 (0)90-5578-8500          (cell)
Japan                | +81 (0)3 -3375-1767          (home)