From: James Antill <jantill@redhat.com>
To: klausk@br.ibm.com
Cc: Linux audit <Linux-audit@redhat.com>
Subject: Re: event loss with dispatcher?
Date: Thu, 08 Nov 2007 23:09:26 -0500 [thread overview]
Message-ID: <1194581366.5537.15.camel@code.and.org> (raw)
In-Reply-To: <1194563708.10377.13.camel@klausk.br.ibm.com>
[-- Attachment #1.1: Type: text/plain, Size: 1697 bytes --]
On Thu, 2007-11-08 at 18:15 -0500, Klaus Heinrich Kiwi wrote:
> On Thu, 08 Nov 2007 16:55:22 -0500, Steve Grubb wrote:
>
> > On Thursday 08 November 2007 16:17:52 klausk@br.ibm.com wrote:
> >> Any tips on how can I debug this further?
> >
> > I'd put some syslog()'s in the main event loop of the dispatcher to see
> > what is coming in and some in the output where its writing to the
> > descriptor.
> >
> > -Steve
>
> Added a syslog() in the auditd code just before writev() to pipe, and
> another in audit dispatcher just after readv() from pipe (code attached
> in the end). I see every record coming out of the daemon, but some
> records are lost at the dispatcher input:
[...]
> Still don't have a clue of what's going on. here's the patch used:
Byte stream I/O 101. The "readv" side is:
/* Get header first. it is fixed size */
vec[0].iov_base = &e->hdr;
vec[0].iov_len = sizeof(struct audit_dispatcher_header);
/* Next payload */
vec[1].iov_base = &e->data;
vec[1].iov_len = MAX_AUDIT_MESSAGE_LENGTH;
do {
rc = readv(fd, vec, 2);
} while (rc < 0 && errno == EINTR);
if (rc > 0) {
enqueue(e);
}
...where enqueue() assumes that a single "message" and _only_ a single
"message" has been read, SOCK_STREAM makes no such guarantee. As more
messages are produced from auditd it becomes more likely the OS will
merge multiple "messages".
The writev() sides of audispd are broken in a similar way, although
that might be more obvious as it will just start corrupting the byte
stream.
--
James Antill <jantill@redhat.com>
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2007-11-09 4:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-08 23:15 event loss with dispatcher? Klaus Heinrich Kiwi
2007-11-09 4:09 ` James Antill [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-11-08 16:54 Klaus Heinrich Kiwi
2007-11-08 17:34 ` Steve Grubb
2007-11-08 21:17 ` klausk
2007-11-08 21:55 ` Steve Grubb
2007-11-09 2:20 ` John Dennis
2007-11-09 14:23 ` Steve Grubb
2008-01-07 13:21 ` Klaus Heinrich Kiwi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1194581366.5537.15.camel@code.and.org \
--to=jantill@redhat.com \
--cc=Linux-audit@redhat.com \
--cc=klausk@br.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox