From: Steve Grubb <sgrubb@redhat.com>
To: Kerem Aksu <ahmtkrmd96@gmail.com>
Cc: linux-audit@redhat.com
Subject: Re: Matching close() system calls
Date: Thu, 15 Mar 2018 18:34:10 +0100 [thread overview]
Message-ID: <20180315183410.5292c6af@ivy-bridge> (raw)
In-Reply-To: <CANuRfe8NCqiBd130mZaNVHx0kPtMgjXU_k7n==0h4Yh-UR-EGA@mail.gmail.com>
On Wed, 14 Mar 2018 15:51:44 +0300
Kerem Aksu <ahmtkrmd96@gmail.com> wrote:
> Hello,
>
> I am trying to trace files by using this rule :
> "-a always,exit -F arch=b64 -S read,write,open,close -k file_op"
>
> I can trace open() system calls with the "type=path" log occurred
> with the same ID as the open() system call. I can learn which file is
> opened by that open() system call.
If open returns a non-negative number, then that is the descriptor.
You'll need to match that descriptor as an argument to the other
syscalls for the same pid. You might need to watch exit_group also since
a program exiting closes all descriptors. And also you'll need to check
flags set by open and fcntl to see if CLOEXEC is being set.
> But when it comes to other system calls I am unable to learn which
> file is read, wrote or closed.
This is implicit by referencing the descriptor.
> I tried to match arguments passed to system calls (a[0..3]) but those
> are different than the arguments defined in linux man pages. I might
> misunderstand these arguments.
No, they are pretty much the same.
> How can I match these or any other (file) system calls with the files
> that they used onto.
> And when does a "type=PATH" log occurs?
You'll probably need to write a program using auparse to save the
descriptor from an open or openat and then output the information you
need as a custom program.
-Steve
prev parent reply other threads:[~2018-03-15 17:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 12:51 Matching close() system calls Kerem Aksu
2018-03-15 17:34 ` Steve Grubb [this message]
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=20180315183410.5292c6af@ivy-bridge \
--to=sgrubb@redhat.com \
--cc=ahmtkrmd96@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox