From: Ingo Molnar <mingo@elte.hu>
To: Kees Cook <keescook@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, Randy Dunlap <rdunlap@xenotime.net>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org,
kernel-hardening@lists.openwall.com
Subject: Re: [PATCH] fs: hardlink creation restrictions
Date: Mon, 20 Feb 2012 09:22:23 +0100 [thread overview]
Message-ID: <20120220082223.GF30810@elte.hu> (raw)
In-Reply-To: <CAGXu5jL-NZP9At16q-b6biszMAWQQ4HLzW3cHDQUf0m7PGwGbQ@mail.gmail.com>
* Kees Cook <keescook@chromium.org> wrote:
> >> +#ifdef CONFIG_AUDIT
> >> + if (error) {
> >> + struct audit_buffer *ab;
> >> +
> >> + ab = audit_log_start(current->audit_context,
> >> + GFP_KERNEL, AUDIT_AVC);
> >> + audit_log_format(ab, "op=linkat action=denied");
> >> + audit_log_format(ab, " pid=%d comm=", current->pid);
> >> + audit_log_untrustedstring(ab, current->comm);
> >> + audit_log_d_path(ab, " path=", old_path);
> >> + audit_log_format(ab, " dev=");
> >> + audit_log_untrustedstring(ab, inode->i_sb->s_id);
> >> + audit_log_format(ab, " ino=%lu", inode->i_ino);
> >> + audit_log_end(ab);
> >> + }
> >> +#endif
> >
> > Small detail: don't these audit methods map to nothing on
> > !CONFIG_AUDIT, allowing the #ifdef to be dropped? (if not then
> > it should really be so.)
>
> Ah-ha; a more careful look at audit.h agrees. :) I'll adjust
> this as well.
Another detail, I'd also stick those logging lines into a
separate inline function right before the linkat function, so
that the logging details do not obscure the main flow of VFS
logic:
if (error)
audit_log_linkat_denied(current, old_path, inode);
... or so. People reading this function won't be interested in
the logging details 99.9% of the time.
Thanks,
Ingo
prev parent reply other threads:[~2012-02-20 8:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-18 19:38 [PATCH] fs: hardlink creation restrictions Kees Cook
2012-02-18 20:56 ` Marcin Slusarz
2012-02-19 1:36 ` Kees Cook
2012-02-19 12:49 ` Ingo Molnar
2012-02-19 17:45 ` Kees Cook
2012-02-20 8:22 ` Ingo Molnar [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=20120220082223.GF30810@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@linux-foundation.org \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).