Branch: Tag:

2003-03-05

2003-03-05 16:18:30 by Martin Stjernholm <mast@lysator.liu.se>

Retain the dumpable flag over the implicit sete?id calls for new threads on
Linux.

Rev: src/configure.in:1.657
Rev: src/threads.c:1.193

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: threads.c,v 1.192 2002/11/28 23:45:39 marcus Exp $ + || $Id: threads.c,v 1.193 2003/03/05 16:18:30 mast Exp $   */      #include "global.h" - RCSID("$Id: threads.c,v 1.192 2002/11/28 23:45:39 marcus Exp $"); + RCSID("$Id: threads.c,v 1.193 2003/03/05 16:18:30 mast Exp $");      PMOD_EXPORT int num_threads = 1;   PMOD_EXPORT int threads_disabled = 0;
33:      #include <errno.h>    + #ifdef HAVE_SYS_PRCTL_H + #include <sys/prctl.h> + #endif /* HAVE_SYS_PRCTL_H */ +    PMOD_EXPORT int live_threads = 0, disallow_live_threads = 0;   PMOD_EXPORT COND_T live_threads_change;   PMOD_EXPORT COND_T threads_disabled_change;
687: Inside #if defined(HAVE_BROKEN_LINUX_THREAD_EUID)
   * effective uid & gid.    */    if (!geteuid()) { + #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) +  /* The sete?id calls will clear the dumpable state that we might +  * have set with system.dumpable. */ +  int current = prctl(PR_GET_DUMPABLE); + #endif    setegid(arg.egid);    seteuid(arg.euid); -  + #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) +  if (prctl(PR_SET_DUMPABLE, current) == -1) +  Pike_fatal ("Didn't expect prctl to go wrong. errno=%d\n", errno); + #endif    }   #endif /* HAVE_BROKEN_LINUX_THREAD_EUID */   
1676: Inside #if defined(HAVE_BROKEN_LINUX_THREAD_EUID)
   * effective uid & gid.    */    if (!geteuid()) { + #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) +  /* The sete?id calls will clear the dumpable state that we might +  * have set with system.dumpable. */ +  int current = prctl(PR_GET_DUMPABLE); + #endif    setegid(me->egid);    seteuid(me->euid); -  + #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) +  if (prctl(PR_SET_DUMPABLE, current) == -1) +  Pike_fatal ("Didn't expect prctl to go wrong. errno=%d\n", errno); + #endif    }   #endif /* HAVE_BROKEN_LINUX_THREAD_EUID */