All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Djalal Harouni <tixxdz@opendz.org>
Cc: linux-kernel@vger.kernel.org,
	kernel-hardening@lists.openwall.com,
	Al Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vasiliy Kulikov <segoon@openwall.com>,
	WANG Cong <xiyou.wangcong@gmail.com>,
	Solar Designer <solar@openwall.com>,
	Kees Cook <keescook@chromium.org>,
	David Rientjes <rientjes@google.com>,
	Brad Spengler <spender@grsecurity.net>
Subject: [kernel-hardening] Re: [PATCH v2 2/2] proc: do not allow negative offsets on /proc/<pid>/environ
Date: Wed, 25 Jul 2012 14:16:44 +0200	[thread overview]
Message-ID: <20120725121644.GA6584@redhat.com> (raw)
In-Reply-To: <1343143742-31229-3-git-send-email-tixxdz@opendz.org>

On 07/24, Djalal Harouni wrote:
>
>  static int mem_open(struct inode *inode, struct file *file)
>  {
> -	return __mem_open(inode, file, PTRACE_MODE_ATTACH);
> +	int ret = __mem_open(inode, file, PTRACE_MODE_ATTACH);
> +
> +	/* OK to pass negative loff_t, we can catch out-of-range */
> +	file->f_mode |= FMODE_UNSIGNED_OFFSET;
> +
> +	return ret;
>  }

It could be even simpler, I meant

	file->f_mode |= FMODE_UNSIGNED_OFFSET;
	return __mem_open(inode, file, PTRACE_MODE_ATTACH);

Never mind, this is very minor and the patch is already in -mm.

Oleg.

WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Djalal Harouni <tixxdz@opendz.org>
Cc: linux-kernel@vger.kernel.org,
	kernel-hardening@lists.openwall.com,
	Al Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vasiliy Kulikov <segoon@openwall.com>,
	WANG Cong <xiyou.wangcong@gmail.com>,
	Solar Designer <solar@openwall.com>,
	Kees Cook <keescook@chromium.org>,
	David Rientjes <rientjes@google.com>,
	Brad Spengler <spender@grsecurity.net>
Subject: Re: [PATCH v2 2/2] proc: do not allow negative offsets on /proc/<pid>/environ
Date: Wed, 25 Jul 2012 14:16:44 +0200	[thread overview]
Message-ID: <20120725121644.GA6584@redhat.com> (raw)
In-Reply-To: <1343143742-31229-3-git-send-email-tixxdz@opendz.org>

On 07/24, Djalal Harouni wrote:
>
>  static int mem_open(struct inode *inode, struct file *file)
>  {
> -	return __mem_open(inode, file, PTRACE_MODE_ATTACH);
> +	int ret = __mem_open(inode, file, PTRACE_MODE_ATTACH);
> +
> +	/* OK to pass negative loff_t, we can catch out-of-range */
> +	file->f_mode |= FMODE_UNSIGNED_OFFSET;
> +
> +	return ret;
>  }

It could be even simpler, I meant

	file->f_mode |= FMODE_UNSIGNED_OFFSET;
	return __mem_open(inode, file, PTRACE_MODE_ATTACH);

Never mind, this is very minor and the patch is already in -mm.

Oleg.


  reply	other threads:[~2012-07-25 12:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-24 15:29 [kernel-hardening] [PATCH v2 0/2] proc: /proc/<pid>/environ offset fixes Djalal Harouni
2012-07-24 15:29 ` Djalal Harouni
2012-07-24 15:29 ` [kernel-hardening] [PATCH v2 1/2] proc: environ_read() make sure offset points to environment address range Djalal Harouni
2012-07-24 15:29   ` Djalal Harouni
2012-07-24 15:29 ` [kernel-hardening] [PATCH v2 2/2] proc: do not allow negative offsets on /proc/<pid>/environ Djalal Harouni
2012-07-24 15:29   ` Djalal Harouni
2012-07-25 12:16   ` Oleg Nesterov [this message]
2012-07-25 12:16     ` Oleg Nesterov
2012-07-24 17:41 ` [kernel-hardening] Re: [PATCH v2 0/2] proc: /proc/<pid>/environ offset fixes Kees Cook
2012-07-24 17:41   ` Kees Cook

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=20120725121644.GA6584@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    --cc=segoon@openwall.com \
    --cc=solar@openwall.com \
    --cc=spender@grsecurity.net \
    --cc=tixxdz@opendz.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xiyou.wangcong@gmail.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.