From: ramsdell@mitre.org (John D. Ramsdell)
To: Alexander Viro <aviro@redhat.com>
Cc: bsniffen@mitre.org, Linux Audit <linux-audit@redhat.com>
Subject: Re: [PATCH] Reporting file descriptors created by pipe and socketpair
Date: 12 Sep 2006 14:25:50 -0400 [thread overview]
Message-ID: <ogt3baxyma9.fsf@divan.mitre.org> (raw)
In-Reply-To: <20060912162104.GK4144@devserv.devel.redhat.com>
Alexander Viro <aviro@redhat.com> writes:
> c) just how do you propose to do "tracking file descriptors"?
We aren't proposing to track file descriptors. We already have code
that does that. Currently, we collect the traces with a modified
version of strace, but for a variety of reasons, autrace would be a
much better source of trace data. First, we have to modify strace so
it includes security contexts on labeled objects. Second, strace
output is designed to be easily consumed by humans, and is a bear to
get a program to understand it. You can see the AWK/YACC/sed pipeline
required to put strace output into a form that can be easily consumed
by a python program by reading the source file
polgen/src/trackfd/trackstrace.in in the polgen CVS repository at
http://sf.net/projects/polgen. You'll quickly realize why I am eager
for the parsing library to be introduced in audit 1.3.
The program that does the analysis is in polgen/src/trackfd/trackfd.py.
It analyzes the records for the following system calls:
close open socket pipe socketpair dup dup2 fcntl64 read write bind
accept connect recv send unlink execve clone
The key thing is the program doesn't really track file descriptors,
instead it tracks what they refer to. The program generates a data
structure when each file descriptor is created via an open or socket
system call. The system calls dup, fcntl, close, and execve change
mappings of file descriptors to the data structure, and a close system
call causes a summary of reads and writes to be written. Here is the
summary of the file descriptor tracker from the polgen document.
An essential part of the data reduction is the summarization of the
life cycle of a file descriptor. For each file descriptor created
by a program, the @code{trackfd} program creates a data structure.
The data structure is updated whenever a system call is found that
applies to the file descriptor. Finally, when a file descriptor is
closed, a summary of the activity associated with the file
descriptor is written to the output.
It's one of those programs that is either correct, or explodes and
dies horribly when a bug is exercised. On Fedora Core, the program
has been quite solid for quite a while now. I has been used to
analyze the Jabber server and an application running in a Java Virtual
Machine.
By the way, we do not claim to handle every possible path for
information flow yet. In fact, we ignore all system calls implemented
by the ipc common kernel entry point. Our experience is that the
current set of system calls we analyze handles a large number
important target applications.
The trackfd.py file is about 600 lines of code. I tried to make it
easily read, in case someone took the time to proof read my code.
John
next prev parent reply other threads:[~2006-09-12 18:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-12 16:07 [PATCH] Reporting file descriptors created by pipe and socketpair John D. Ramsdell
2006-09-12 16:21 ` Alexander Viro
2006-09-12 17:41 ` Steve Grubb
2006-09-12 18:25 ` John D. Ramsdell [this message]
2006-09-12 19:12 ` Alexander Viro
2006-09-12 21:05 ` John D. Ramsdell
2006-09-12 19:22 ` John D. Ramsdell
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=ogt3baxyma9.fsf@divan.mitre.org \
--to=ramsdell@mitre.org \
--cc=aviro@redhat.com \
--cc=bsniffen@mitre.org \
--cc=linux-audit@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.