Linux kernel: Samba doesn't detect coredump path override by sysctl kernel.core_pattern

Volodymyr Khomenko Volodymyr.Khomenko at exanet.com
Mon Nov 3 11:46:51 GMT 2008


Hi all,

I've encountered pity issue in samba binaries in Linux environment:
here I can override the path for coredumps (globally for all processes)
by "sysctl -w" command, so I will have such configuration for example:

# sysctl kernel.core_pattern
kernel.core_pattern = /var/coredumps/core-%h-%u-%e.%p

Still, source/lib/fault.c:dump_core_setup routine doesn't detect such thing.
source/lib/fault.c:dump_core will write the message "dumping core in <regular_corepath>"
and do 'chdir' there, but with configured 'kernel.core_pattern' it doesn't make any effect.
After abort() a core will be dumped to the path specified by kernel.core_pattern instead of current dir.

To avoid false message with corepath I propose to patch source/lib/fault.c:dump_core_setup
to acquire kernel.core_pattern by sysctl
with __sysctl_args.name = {CTL_KERN, KERN_CORE_PATTERN} and skip corepath generation from logbase
if this parameter has basename (i.e. we have '/' as the 1st character).

Alternatively we can read kernel.core_pattern from /proc/sys/kernel/core_pattern as from regular text file
(if /proc/sys is available).

The thing I don't know is how to make autoconf detect the presence of corresponding sysctl or /proc/sys.

What do you think?


More information about the samba-technical mailing list