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

Tim Prouty tprouty at samba.org
Tue Nov 4 00:08:55 GMT 2008


On Nov 3, 2008, at 3:46 AM, Volodymyr Khomenko wrote:

> 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?

FreeBSD uses similar global sysctls to control the core file location,  
so making the core path in samba aware of these sysctls would be  
useful for other OSs as well.  Your approach to make the corepath  
sysctl aware sounds good.

You'll probably want to add a check in source3/configure.in for the  
existence of _sysctl, and maybe even have the configure check call  
_sysctl with kernel.core_pattern to make sure that the sysctl will  
work.  There are many examples of different types of checks already in  
configure.in, so I would recommend modeling your check after one of  
the existing ones.

-Tim


More information about the samba-technical mailing list