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)  編輯  收藏 所屬分類(lèi): MySQL 、LinuxSkills
          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

          主站蜘蛛池模板: 海阳市| 运城市| 亳州市| 湘西| 宜阳县| 商洛市| 樟树市| 南溪县| 迁西县| 江门市| 英吉沙县| 鹰潭市| 新化县| 宁远县| 叙永县| 巴塘县| 潮州市| 龙里县| 松潘县| 宁都县| 砀山县| 苏尼特右旗| 休宁县| 慈利县| 江山市| 屯留县| 和顺县| 东乡| 阳春市| 昌图县| 贺兰县| 仙居县| 赤城县| 宜宾市| 赤峰市| 靖安县| 巫溪县| 清镇市| 称多县| 乌拉特中旗| 新邵县|