args-sendsyslog-nostash.pl revision 1.1
1# Run client before starting syslogd. 2# The client tries to fill up the kernel stash with invalid messages. 3# The client writes one message before and one after syslogd is started. 4# Start syslogd, it reads the second message from the log socket. 5# Find the log message in file, syslogd, server log. 6# Check that the first message got lost. 7# Create a ktrace dump of the client and check that sendsyslog(2) has failed. 8# Check that kernel did not write sendsyslog(2) error message to log socket. 9 10use strict; 11use warnings; 12use Errno ':POSIX'; 13require 'sys/syscall.ph'; 14 15use constant LOGSTASH_SIZE => 100; 16 17my $errno = ENOTCONN; 18$! = $errno; 19my $error = $!; 20my $kerngrep = qr/sendsyslog: dropped \d+ messages?/; 21 22our %args = ( 23 client => { 24 early => 1, 25 func => sub { 26 my $self = shift; 27 foreach (0..LOGSTASH_SIZE) { 28 # bad system call, NULL pointer as message 29 syscall(&SYS_sendsyslog, 0, 42, 0) != -1 30 or warn ref($self), " sendsyslog NULL failed: $!"; 31 } 32 write_between2logs($self, sub { 33 my $self = shift; 34 ${$self->{syslogd}}->loggrep(qr/syslogd: started/, 5) 35 or die ref($self), " syslogd started not in syslogd.log"; 36 })}, 37 ktrace => { 38 qr/CALL sendsyslog\(/ => '>=103', 39 qr/RET sendsyslog -1 errno $errno / => 102, 40 }, 41 loggrep => { 42 get_firstlog() => 1, 43 qr/Client sendsyslog NULL failed: $error/ => 101, 44 get_testgrep() => 1, 45 }, 46 }, 47 syslogd => { 48 loggrep => { 49 get_firstlog() => 1, 50 qr/msg $kerngrep/ => 0, 51 get_testgrep() => 1, 52 }, 53 }, 54 server => { 55 loggrep => { 56 get_firstlog() => 1, 57 $kerngrep => 0, 58 get_testgrep() => 1, 59 }, 60 }, 61 file => { 62 loggrep => { 63 get_firstlog() => 1, 64 $kerngrep => 0, 65 get_testgrep() => 1, 66 }, 67 }, 68); 69 701; 71