lkml.org 
[lkml]   [2012]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fs: hardlink creation restrictions

* 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-02-20 09:25    [W:0.046 / U:3.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site