Re: [PATCH v2011.2] fs: symlink restrictions on sticky directories
From: Ingo Molnar
Date: Thu Dec 15 2011 - 01:50:18 EST
* Kees Cook <keescook@xxxxxxxxxxxx> wrote:
> + /* Check parent directory mode and owner. */
> + spin_lock(&dentry->d_lock);
> + parent = dentry->d_parent->d_inode;
> + if ((parent->i_mode & (S_ISVTX|S_IWOTH)) == (S_ISVTX|S_IWOTH) &&
> + parent->i_uid != inode->i_uid) {
> + error = -EACCES;
> + }
> + spin_unlock(&dentry->d_lock);
> +
> +#ifdef CONFIG_AUDIT
> + if (error) {
> + struct audit_buffer *ab;
> +
> + ab = audit_log_start(current->audit_context,
> + GFP_ATOMIC, AUDIT_AVC);
> + audit_log_format(ab, "op=follow_link action=denied");
> + audit_log_d_path(ab, "path=", &nameidata->path);
> + audit_log_format(ab, " name=");
> + audit_log_untrustedstring(ab, dentry->d_name.name);
> + audit_log_format(ab, " dev=%s ino=%lu",
> + inode->i_sb->s_id,
> + inode->i_ino);
> + audit_log_end(ab);
> + }
> +#endif
Hm, is GFP_ATOMIC really necessary here? Why not GFP_KERNEL?
This is in VFS process context, not in some atomic context that
has to be careful about allocations, right?
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/