|
|
|
Re: [PATCHv4 2/3] fs: Make core dump functionality optional | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
|
Quoting Alex Kelly (alex.page.kelly@xxxxxxxxx):
> Adds an expert Kconfig option, CONFIG_COREDUMP, which allows disabling of core dump.
> This saves approximately 2.6k in the compiled kernel, and complements CONFIG_ELF_CORE,
> which now depends on it.
Is there another reason than the 2.6k to do this? My kernels range
between 4.8 and 5M, so that's .05% size savings?
I'm not saying nack (it's not my area anyway), just seem to be missing
the point.
> CONFIG_COREDUMP also disables coredump-related sysctls, except for suid_dumpable and
> related functions, which are necessary for ptrace.
>
> Signed-off-by: Alex Kelly <alex.page.kelly@xxxxxxxxx>
> Reviewed-by: Josh Triplett <josh@xxxxxxxxxxxxxxxx>
> ---
> fs/Kconfig.binfmt | 8 ++++++++
> fs/Makefile | 3 ++-
> include/linux/binfmts.h | 4 ++++
> init/Kconfig | 1 +
> kernel/sysctl.c | 6 +++++-
> 5 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
> index 0225742..0efd152 100644
> --- a/fs/Kconfig.binfmt
> +++ b/fs/Kconfig.binfmt
> @@ -164,3 +164,11 @@ config BINFMT_MISC
> You may say M here for module support and later load the module when
> you have use for it; the module is called binfmt_misc. If you
> don't know what to answer at this point, say Y.
> +
> +config COREDUMP
> + bool "Enable core dump support" if EXPERT
> + default y
> + help
> + This option enables support for performing core dumps. You almost
> + certainly want to say Y here. Not necessary on systems that never
> + need debugging or only ever run flawless code.
> diff --git a/fs/Makefile b/fs/Makefile
> index 8938f82..1d7af79 100644
> --- a/fs/Makefile
> +++ b/fs/Makefile
> @@ -11,7 +11,7 @@ obj-y := open.o read_write.o file_table.o super.o \
> attr.o bad_inode.o file.o filesystems.o namespace.o \
> seq_file.o xattr.o libfs.o fs-writeback.o \
> pnode.o drop_caches.o splice.o sync.o utimes.o \
> - stack.o fs_struct.o statfs.o coredump.o
> + stack.o fs_struct.o statfs.o
>
> ifeq ($(CONFIG_BLOCK),y)
> obj-y += buffer.o bio.o block_dev.o direct-io.o mpage.o ioprio.o
> @@ -48,6 +48,7 @@ obj-$(CONFIG_FS_MBCACHE) += mbcache.o
> obj-$(CONFIG_FS_POSIX_ACL) += posix_acl.o xattr_acl.o
> obj-$(CONFIG_NFS_COMMON) += nfs_common/
> obj-$(CONFIG_GENERIC_ACL) += generic_acl.o
> +obj-$(CONFIG_COREDUMP) += coredump.o
>
> obj-$(CONFIG_FHANDLE) += fhandle.o
>
> diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
> index 366422b..00e2e89 100644
> --- a/include/linux/binfmts.h
> +++ b/include/linux/binfmts.h
> @@ -132,7 +132,11 @@ extern int copy_strings_kernel(int argc, const char *const *argv,
> struct linux_binprm *bprm);
> extern int prepare_bprm_creds(struct linux_binprm *bprm);
> extern void install_exec_creds(struct linux_binprm *bprm);
> +#ifdef CONFIG_COREDUMP
> extern void do_coredump(long signr, int exit_code, struct pt_regs *regs);
> +#else
> +static inline void do_coredump(long signr, int exit_code, struct pt_regs *regs) {}
> +#endif
> extern void set_binfmt(struct linux_binfmt *new);
> extern void free_bprm(struct linux_binprm *);
>
> diff --git a/init/Kconfig b/init/Kconfig
> index af6c7f8..0e75056 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1230,6 +1230,7 @@ config BUG
> Just say Y.
>
> config ELF_CORE
> + depends on COREDUMP
> default y
> bool "Enable ELF core dumps" if EXPERT
> help
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 87174ef..af57e84 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -97,10 +97,12 @@
> extern int sysctl_overcommit_memory;
> extern int sysctl_overcommit_ratio;
> extern int max_threads;
> -extern int core_uses_pid;
> extern int suid_dumpable;
> +#ifdef CONFIG_COREDUMP
> +extern int core_uses_pid;
> extern char core_pattern[];
> extern unsigned int core_pipe_limit;
> +#endif
> extern int pid_max;
> extern int min_free_kbytes;
> extern int pid_max_min, pid_max_max;
> @@ -404,6 +406,7 @@ static struct ctl_table kern_table[] = {
> .mode = 0644,
> .proc_handler = proc_dointvec,
> },
> +#ifdef CONFIG_COREDUMP
> {
> .procname = "core_uses_pid",
> .data = &core_uses_pid,
> @@ -425,6 +428,7 @@ static struct ctl_table kern_table[] = {
> .mode = 0644,
> .proc_handler = proc_dointvec,
> },
> +#endif
> #ifdef CONFIG_PROC_SYSCTL
> {
> .procname = "tainted",
> --
> 1.7.11.2
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Other Archives] [Linux Kernel Newbies] [Linux Driver Development] [Linux Kbuild] [Fedora Kernel] [Linux Kernel Testers] [Linux SH] [Linux Omap] [Linux Tape] [Linux Input] [Linux Kernel Janitors] [Linux Kernel Packagers] [Linux Doc] [Linux Man Pages] [Linux API] [Linux Memory Management] [Linux Modules] [Linux Standards] [Kernel Announce] [Netdev] [Git] [Linux PCI] Linux CAN Development [Linux I2C] [Linux RDMA] [Linux NUMA] [Netfilter] [Netfilter Devel] [SELinux] [Bugtraq] [FIO] [Linux Perf Users] [Linux Serial] [Linux PPP] [Linux ISDN] [Linux Next] [Kernel Stable Commits] [Linux Tip Commits] [Kernel MM Commits] [Linux Security Module] [AutoFS] [Filesystem Development] [Ext3 Filesystem] [Linux bcache] [Ext4 Filesystem] [Linux BTRFS] [Linux CEPH Filesystem] [Linux XFS] [XFS] [Linux NFS] [Linux CIFS] [Ecryptfs] [Linux NILFS] [Linux Cachefs] [Reiser FS] [Initramfs] [Linux FB Devel] [Linux OpenGL] [DRI Devel] [Fastboot] [Linux RT Users] [Linux RT Stable] [eCos] [Corosync] [Linux Clusters] [LVS Devel] [Hot Plug] [Linux Virtualization] [KVM] [KVM PPC] [KVM ia64] [Linux Containers] [Linux Hexagon] [Linux Cgroups] [Util Linux] [Wireless] [Linux Bluetooth] [Bluez Devel] [Ethernet Bridging] [Embedded Linux] [Barebox] [Linux MMC] [Linux IIO] [Sparse] [Smatch] [Linux Arch] [x86 Platform Driver] [Linux ACPI] [Linux IBM ACPI] [LM Sensors] [CPU Freq] [Linux Power Management] [Linmodems] [Linux DCCP] [Linux SCTP] [ALSA Devel] [Linux USB] [Linux PA RISC] [Linux Samsung SOC] [MIPS Linux] [IBM S/390 Linux] [ARM Linux] [ARM Kernel] [ARM MSM] [Tegra Devel] [Sparc Linux] [Linux Security] [Linux Sound] [Linux Media] [Video 4 Linux] [Linux IRDA Users] [Linux for the blind] [Linux RAID] [Linux ATA RAID] [Device Mapper] [Linux SCSI] [SCSI Target Devel] [Linux SCSI Target Infrastructure] [Linux IDE] [Linux SMP] [Linux AXP] [Linux Alpha] [Linux M68K] [Linux ia64] [Linux 8086] [Linux x86_64] [Linux Config] [Linux Apps] [Linux MSDOS] [Linux X.25] [Linux Crypto] [DM Crypt] [Linux Trace Users] [Linux Btrace] [Linux Watchdog] [Utrace Devel] [Linux C Programming] [Linux Assembly] [Dash] [DWARVES] [Hail Devel] [Linux Kernel Debugger] [Linux gcc] [Gcc Help] [X.Org] [Wine]
![]() |
![]() |
[Older Kernel Discussion] [Yosemite National Park Forum] [Large Format Photos] [Gimp] [Yosemite Photos] [Stuff]