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

Andrew Bartlett abartlet at samba.org
Tue Nov 4 00:41:41 GMT 2008


On Mon, 2008-11-03 at 16:08 -0800, Tim Prouty wrote:
> 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.

Or just add 'or in your OS-specified location' to the debug message?

We don't dump core often (I hope), so is the complexity worth it?

Andrew Bartlett

-- 
Andrew Bartlett
http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Red Hat Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20081104/2519f7cc/attachment.bin


More information about the samba-technical mailing list