All of lore.kernel.org
 help / color / mirror / Atom feed
From: Solar Designer <solar@openwall.com>
To: Matt Brown <matt@nmatt.com>
Cc: kernel-hardening@lists.openwall.com, Eric Biggers <ebiggers3@gmail.com>
Subject: Re: [kernel-hardening] [PATCH v2 1/1]  Add Trusted Path Execution as a stackable LSM
Date: Thu, 8 Jun 2017 15:05:47 +0200	[thread overview]
Message-ID: <20170608130547.GA22981@openwall.com> (raw)
In-Reply-To: <20170608034349.31876-2-matt@nmatt.com>

Matt,

I really didn't intend to comment on this further, but I just happened
to notice:

On Wed, Jun 07, 2017 at 11:43:49PM -0400, Matt Brown wrote:
> +static int tpe_check(struct file *file, char *method)
> +{
> +	struct inode *inode;
> +	struct inode *file_inode;
> +	struct dentry *dir;
> +	const struct cred *cred = current_cred();
> +	char *reason1 = NULL;
> +	char *reason2 = NULL;
> +
> +	dir = dget_parent(file->f_path.dentry);
> +	inode = d_backing_inode(dir);
> +	file_inode = d_backing_inode(file->f_path.dentry);
> +
> +	if (!tpe_enabled)
> +		return 0;

You have many return statements in tpe_check(), where it is already past
dget_parent() and thus must have reached:

> +end:
> +	dput(dir);

You'll probably want to move the dget_parent() and the following two
lines to be below the first few checks where you may just return, and
then be careful not to ever use a return statement anymore.

Alexander

  reply	other threads:[~2017-06-08 13:05 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08  3:43 [kernel-hardening] [PATCH v2 0/1] Add Trusted Path Execution as a stackable LSM Matt Brown
2017-06-08  3:43 ` Matt Brown
2017-06-08  3:43 ` Matt Brown
2017-06-08  3:43 ` [kernel-hardening] [PATCH v2 1/1] " Matt Brown
2017-06-08  3:43   ` Matt Brown
2017-06-08  3:43   ` Matt Brown
2017-06-08 13:05   ` Solar Designer [this message]
2017-06-08 13:16     ` [kernel-hardening] " Matt Brown
2017-06-09  2:38   ` [kernel-hardening] " Kees Cook
2017-06-09  2:38     ` Kees Cook
2017-06-09  2:38     ` Kees Cook
2017-06-09  3:50     ` [kernel-hardening] " Matt Brown
2017-06-09  3:50       ` Matt Brown
2017-06-09  3:50       ` Matt Brown
2017-06-09 10:18       ` [kernel-hardening] " Mimi Zohar
2017-06-09 10:18         ` Mimi Zohar
2017-06-09 10:18         ` Mimi Zohar
2017-06-09 12:55         ` [kernel-hardening] " Kees Cook
2017-06-09 12:55           ` Kees Cook
2017-06-09 12:55           ` Kees Cook
2017-06-09 13:15           ` [kernel-hardening] " Matt Brown
2017-06-09 13:15             ` Matt Brown
2017-06-09 13:15             ` Matt Brown
2017-06-09 13:16           ` [kernel-hardening] " Mimi Zohar
2017-06-09 13:16             ` Mimi Zohar
2017-06-09 13:16             ` Mimi Zohar
2017-06-09 13:18             ` [kernel-hardening] " Matt Brown
2017-06-09 13:18               ` Matt Brown
2017-06-09 13:44               ` Mimi Zohar
2017-06-09 13:44                 ` Mimi Zohar
2017-06-13 21:27       ` Solar Designer
2017-06-13 23:53         ` Mickaël Salaün
2017-06-14 12:36           ` Solar Designer
2017-06-14 13:15         ` Jann Horn
2017-06-14 14:28           ` Solar Designer
2017-06-14 14:33             ` Jann Horn
2017-06-14 14:34               ` Jann Horn
2017-06-14 16:24         ` Matt Brown
2017-06-16  2:25   ` [kernel-hardening] [RFC PATCH] print_tpe_error() can be static kbuild test robot
2017-06-16  2:25     ` kbuild test robot
2017-06-16  2:25     ` kbuild test robot
2017-06-16  2:25   ` [kernel-hardening] Re: [PATCH v2 1/1] Add Trusted Path Execution as a stackable LSM kbuild test robot
2017-06-16  2:25     ` kbuild test robot
2017-06-16  2:25     ` kbuild test robot
2017-06-08 18:37 ` [kernel-hardening] Re: [PATCH v2 0/1] " Alan Cox
2017-06-08 18:37   ` Alan Cox
2017-06-08 18:37   ` Alan Cox
2017-06-08 19:01   ` [kernel-hardening] " Matt Brown
2017-06-08 19:01     ` Matt Brown
2017-06-08 19:01     ` Matt Brown
2017-06-08 19:23     ` [kernel-hardening] " Alan Cox
2017-06-08 19:23       ` Alan Cox
2017-06-08 19:23       ` Alan Cox
2017-06-11 11:30     ` [kernel-hardening] " Mickaël Salaün
2017-06-11 11:30       ` Mickaël Salaün
2017-06-12  0:04       ` [kernel-hardening] " Matt Brown
2017-06-12  0:04         ` Matt Brown
2017-06-12  0:04         ` Matt Brown

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=20170608130547.GA22981@openwall.com \
    --to=solar@openwall.com \
    --cc=ebiggers3@gmail.com \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=matt@nmatt.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.