是否可以在启动时为Linux中的所有进程设置/proc//coredump_filter?/proc/self/coredump_filter将为当前shell和在shell中运行的所有进程设置,但不为启动后的所有进程设置。这是否可以在内核中修补(当前值设置为0x33)?

最佳答案

Corey的详细信息可以在man core中找到。
http://man7.org/linux/man-pages/man5/core.5.html
内核param文档给了我们这个

coredump_filter=
        [KNL] Change the default value for
        /proc/<pid>/coredump_filter.
        See also Documentation/filesystems/proc.txt.

如果使用grub,请编辑/etc/default/grub文件并修改此变量。
GRUB_CMDLINE_LINUX_DEFAULT="quiet"

为了这个
GRUB_CMDLINE_LINUX_DEFAULT="quiet coredump_filter=0x21"

然后运行update-grub2更新引导配置文件。注意0x21。位参数是
 bit 0  Dump anonymous private mappings.
 bit 1  Dump anonymous shared mappings.
 bit 2  Dump file-backed private mappings.
 bit 3  Dump file-backed shared mappings.
 bit 4 (since Linux 2.6.24)
        Dump ELF headers.
 bit 5 (since Linux 2.6.28)
        Dump private huge pages.
 bit 6 (since Linux 2.6.28)
        Dump shared huge pages.
 bit 7 (since Linux 4.4)
        Dump private DAX pages.
 bit 8 (since Linux 4.4)
        Dump shared DAX pages.

关于linux - 所有进程的coredump_filter,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36523279/

10-13 08:39