Re: Trouble getting a core dump from clamd

2010-01-20 Thread Doug Poland

On Tue, January 19, 2010 12:35, Chuck Swiger wrote:
 Hi--

 On Jan 19, 2010, at 10:04 AM, Doug Poland wrote:
 No joy.

 # sysctl kern.corefile=/var/crash/clamd.core
 # /usr/local/etc/rc.d/clamav-clamd start
  Starting clamav_clamd.
  Segmentation fault
 # ll /var/crash
  total 2
  -rw-r--r--  1 root  wheel  5 Apr 10  2005 minfree

 Please see man 5 core; in particular, clamd changes userid:

 By default, a process that changes user or group credentials
 whether real or effective will not create a corefile.  This behaviour
 can be changed to generate a core dump by setting the sysctl(8)
 variable
  kern.sugid_coredump to 1.

 ...so you will need to toggle that sysctl also.  I'd suggest doing
 something more like:

 mkdir /cores
 chmod 1777 /cores
 sysctl kern.sugid_coredump=1
 sysctl kern.corefile=/cores/%N.%P.core

 ...but adjust the path to be under /var or /usr if free diskspace
 makes doing so necessary.

Thanks for the suggestion and the pointer to man 5 core.  I
implemented your suggestions but still get no core dump.  Very
strange...



-- 
Regards,
Doug

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Trouble getting a core dump from clamd

2010-01-20 Thread Chuck Swiger
Hi--

On Jan 20, 2010, at 12:46 PM, Doug Poland wrote:
 Thanks for the suggestion and the pointer to man 5 core.  I
 implemented your suggestions but still get no core dump.  Very
 strange...

Check your default resource limits (shell startup files  /etc/login.conf) and 
see whether coredumpsize is set to 0, maybe?  If you build and run:

% cat crash.c
#include stdlib.h

main()
{
char *bad = NULL;
bad[0] = '1';
}
% cc -o crash crash.c
% ./crash
[1]16550 segmentation fault (core dumped)  ./crash
% ls /cores
crash.16550.core

...do you get this trivial program to dump core?

Regards,
-- 
-Chuck

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Trouble getting a core dump from clamd

2010-01-20 Thread Doug Poland

On Wed, January 20, 2010 15:05, Chuck Swiger wrote:
 Hi--

 On Jan 20, 2010, at 12:46 PM, Doug Poland wrote:
 Thanks for the suggestion and the pointer to man 5 core.  I
 implemented your suggestions but still get no core dump.  Very
 strange...

 Check your default resource limits (shell startup files 
 /etc/login.conf) and see whether coredumpsize is set to 0, maybe?

Nope, nothin'

% set | grep core | egrep -v grep
% env | grep core | egrep -v grep

% grep core /etc/login.c* | egrep -v #
/etc/login.conf::coredumpsize=unlimited:\


 If you build and run:

 % cat crash.c
 #include stdlib.h

 main()
 {
 char *bad = NULL;
 bad[0] = '1';
 }
 % cc -o crash crash.c
 % ./crash
 [1]16550 segmentation fault (core dumped)  ./crash
 % ls /cores
 crash.16550.core

 ...do you get this trivial program to dump core?

No, not on the system in question.  Just tried it on a plain-vanilla
8.0-RELEASE box I just built and I do get the the core dump there.

% echo $SHELL
/bin/tcsh


% uname -a
FreeBSD hostname.domain.com 7.2-RELEASE-p3 FreeBSD 7.2-RELEASE-p3 #0:
Sat Sep 12 11:15:05 CDT 2009
r...@hostname.domain.com:/usr/obj/usr/src/sys/GENERIC-SERVER  i386


% cat /sys/i386/conf/GENERIC-SERVER
ident   GENERIC-SERVER
include GENERIC
options INCLUDE_CONFIG_FILE # Include this file in kernel
options QUOTA


% sysctl -a | grep core
kern.corefile: /var/coredumps/%U/%N.core
kern.nodump_coredump: 0
kern.coredump: 1
kern.sugid_coredump: 1
debug.elf32_legacy_coredump: 1


% touch /var/coredumps/file
% ll !$
ll /var/coredumps/file
-rw-r--r--  1 doug  wheel  0 Jan 20 15:13 /var/coredumps/file




-- 
Regards,
Doug

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Trouble getting a core dump from clamd

2010-01-20 Thread Chuck Swiger
Hi--

On Jan 20, 2010, at 1:24 PM, Doug Poland wrote:
 % sysctl -a | grep core
 kern.corefile: /var/coredumps/%U/%N.core

Does /var/coredumps/doug and/or /var/coredumps/clamav exist and have 
appropriate permissions (or be 1777 like /tmp to avoid a problem with that)...?

-- 
-Chuck

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Trouble getting a core dump from clamd

2010-01-20 Thread Boris Samorodov
On Wed, 20 Jan 2010 15:24:51 -0600 Doug Poland wrote:

 % sysctl -a | grep core
 kern.corefile: /var/coredumps/%U/%N.core

As CORE(5) says %U is a UID...

 % touch /var/coredumps/file
 % ll !$
 ll /var/coredumps/file
 -rw-r--r--  1 doug  wheel  0 Jan 20 15:13 /var/coredumps/file

... so you should have a directory /var/coredumps/UID owned by
(well, at least have permissions to write by) this UID.

-- 
WBR, Boris Samorodov (bsam)
Research Engineer, http://www.ipt.ru Telephone  Internet SP
FreeBSD Committer, http://www.FreeBSD.org The Power To Serve
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Trouble getting a core dump from clamd

2010-01-20 Thread Doug Poland

On 2010-01-20 17:11, Boris Samorodov wrote:

On Wed, 20 Jan 2010 15:24:51 -0600 Doug Poland wrote:


% sysctl -a | grep core
kern.corefile: /var/coredumps/%U/%N.core


As CORE(5) says %U is a UID...


% touch /var/coredumps/file
% ll !$
ll /var/coredumps/file
-rw-r--r--  1 doug  wheel  0 Jan 20 15:13 /var/coredumps/file


... so you should have a directory /var/coredumps/UID  owned by
(well, at least have permissions to write by) this UID.


That was it, thanks for the keen vision!

--
Regards,
Doug
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Trouble getting a core dump from clamd

2010-01-19 Thread Doug Poland
Hello,

I'm running 7.2-RELEASE-p3 i386 and am having an issue getting a core
dump from a program that is seg faulting.

Last night, inexplicably, clamd started to seg fault.  I was trying to
obtain a core dump for further analysis but no .core file can be
found.

I've tried the following in a tcsh:

# sysctl -a | grep core
kern.corefile: %N.core
kern.nodump_coredump: 0
kern.coredump: 1
kern.sugid_coredump: 0
debug.elf32_legacy_coredump: 0

# set ulimit=-c

# /usr/local/sbin/clamd /usr/local/etc/clamd.conf
Segmentation fault

# tail /var/log/messages
Jan 19 10:16:19 hostname kernel: pid 42315 (clamd), uid 106: exited on
signal 11


But I get no .core file.  Suggestions?



-- 
Regards,
Doug

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Trouble getting a core dump from clamd

2010-01-19 Thread krad
2010/1/19 Doug Poland d...@polands.org

 Hello,

 I'm running 7.2-RELEASE-p3 i386 and am having an issue getting a core
 dump from a program that is seg faulting.

 Last night, inexplicably, clamd started to seg fault.  I was trying to
 obtain a core dump for further analysis but no .core file can be
 found.

 I've tried the following in a tcsh:

 # sysctl -a | grep core
 kern.corefile: %N.core
 kern.nodump_coredump: 0
 kern.coredump: 1
 kern.sugid_coredump: 0
 debug.elf32_legacy_coredump: 0

 # set ulimit=-c

 # /usr/local/sbin/clamd /usr/local/etc/clamd.conf
 Segmentation fault

 # tail /var/log/messages
 Jan 19 10:16:19 hostname kernel: pid 42315 (clamd), uid 106: exited on
 signal 11


 But I get no .core file.  Suggestions?



 --
 Regards,
 Doug

 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to 
 freebsd-questions-unsubscr...@freebsd.org


set a path in the sysctl variable kern.corefile. WIll make the core file
easier to find if one is generated. Generally much tider as well then having
core files littered all over the system
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Trouble getting a core dump from clamd

2010-01-19 Thread Doug Poland

On Tue, January 19, 2010 11:10, krad wrote:
 2010/1/19 Doug Poland d...@polands.org

 Hello,

 I'm running 7.2-RELEASE-p3 i386 and am having an issue getting a
 core dump from a program that is seg faulting.


 set a path in the sysctl variable kern.corefile. WIll make the core
 file easier to find if one is generated. Generally much tider as well
 then having core files littered all over the system

No joy.

# sysctl kern.corefile=/var/crash/clamd.core
# /usr/local/etc/rc.d/clamav-clamd start
  Starting clamav_clamd.
  Segmentation fault
# ll /var/crash
  total 2
  -rw-r--r--  1 root  wheel  5 Apr 10  2005 minfree

-- 
Regards,
Doug

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Trouble getting a core dump from clamd

2010-01-19 Thread Chuck Swiger
Hi--

On Jan 19, 2010, at 10:04 AM, Doug Poland wrote:
 No joy.
 
 # sysctl kern.corefile=/var/crash/clamd.core
 # /usr/local/etc/rc.d/clamav-clamd start
  Starting clamav_clamd.
  Segmentation fault
 # ll /var/crash
  total 2
  -rw-r--r--  1 root  wheel  5 Apr 10  2005 minfree

Please see man 5 core; in particular, clamd changes userid:

 By default, a process that changes user or group credentials whether real
 or effective will not create a corefile.  This behaviour can be changed
 to generate a core dump by setting the sysctl(8) variable
 kern.sugid_coredump to 1.

...so you will need to toggle that sysctl also.  I'd suggest doing something 
more like:

mkdir /cores
chmod 1777 /cores
sysctl kern.sugid_coredump=1
sysctl kern.corefile=/cores/%N.%P.core

...but adjust the path to be under /var or /usr if free diskspace makes doing 
so necessary.

Regards,
-- 
-Chuck

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org