posts - 88, comments - 3, trackbacks - 0, articles - 0
            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          About cannot core dump after setuid on linux server

          Posted on 2012-05-30 15:32 Milo的海域 閱讀(420) 評(píng)論(0)  編輯  收藏 所屬分類: MySQLLinuxSkills
          In many cases, binaries can no longer dump core after calling setuid(). 
          Under Linux it is possible to re-enable this with a system call.

          e.g.

          +#ifdef __linux__
          +#include <sys/prctl.h>
          +#endif
          +
           #ifdef HAVE_purify
           
          #define IF_PURIFY(A,B) (A)
           
          #else
          @@ 
          -1362,6 +1366,10 @@
               sql_perror(
          "setuid");
               unireg_abort(
          1);
             }
          +#ifdef __linux__
          +  /* inform kernel that process is dumpable */
          +  prctl(PR_SET_DUMPABLE,1,0,0,0);
          +#endif /* __linux__ */
           
          #endif
          Manual of prctl
                 PR_SET_DUMPABLE
                        (Since Linux 
          2.4) Set the state of the flag determining whether core dumps are produced for this process  upon  delivery  of  a
                        signal  whose  default  behaviour  is  to  produce a core dump.  (Normally this flag is set for a process by default
          , but it is
                        cleared when a set-user-ID or set-group-ID program is executed and also by various system calls that  manipulate  process  UIDs
                        and  GIDs).  In kernels up to and including 
          2.6.12, arg2 must be either 0 (process is not dumpable) or 1 (process is dumpable).
                        Since kernel 
          2.6.13, the value 2 is also permitted; this causes any binary which normally would not  be  dumped  to  be  dumped
                        readable by root only.  (See also the description of /proc/sys/fs/suid_dumpable in proc(5).)


          Ref: http://bugs.mysql.com/bug.php?id=21723
          Some files about linux core dump:
          /proc/sys/fs/suid_dumpable
          /etc/profile
          /etc/security/limits.conf
          /proc/sys/kernel/core_pattern

          主站蜘蛛池模板: 海兴县| 自治县| 灵寿县| 莱西市| 丰镇市| 五原县| 阳谷县| 赞皇县| 图们市| 若尔盖县| 磴口县| 从江县| 工布江达县| 筠连县| 德钦县| 东城区| 黄浦区| 怀集县| 富顺县| 孝昌县| 寻乌县| 桦川县| 盐山县| 丹东市| 北川| 冕宁县| 岳西县| 保德县| 化州市| 中超| 萨嘎县| 渑池县| 囊谦县| 海伦市| 清远市| 措美县| 内丘县| 福清市| 江永县| 贵阳市| 台江县|