All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Dave Hansen <dave.hansen@intel.com>,
	Qiaowei Ren <qiaowei.ren@intel.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86, mpx: Ensure unused arguments of prctl() MPX requests are 0
Date: Fri, 09 Jan 2015 09:25:51 -0800	[thread overview]
Message-ID: <87r3v350io.fsf@tassilo.jf.intel.com> (raw)
In-Reply-To: <54AE5BE8.1050701@gmail.com> (Michael Kerrisk's message of "Thu, 08 Jan 2015 11:28:56 +0100")

"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> writes:

> From: Michael Kerrisk <mtk.manpages@gmail.com>
>
> commit fe8c7f5cbf91124987106faa3bdf0c8b955c4cf7 added two new prctl()
> operations, PR_MPX_ENABLE_MANAGEMENT and PR_MPX_DISABLE_MANAGEMENT.
> However, no checks were included to ensure that unused arguments
> are zero, as is done in many existing prctl()s and as should be 
> done for all new prctl()s. This patch adds the required checks.

This will break the existing gcc run time, which doesn't zero these
arguments.

-ANdi

>
> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
> ---
>  kernel/sys.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/kernel/sys.c b/kernel/sys.c
> index a8c9f5a..ea9c881 100644
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -2210,9 +2210,13 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
>  		up_write(&me->mm->mmap_sem);
>  		break;
>  	case PR_MPX_ENABLE_MANAGEMENT:
> +		if (arg2 || arg3 || arg4 || arg5)
> +			return -EINVAL;
>  		error = MPX_ENABLE_MANAGEMENT(me);
>  		break;
>  	case PR_MPX_DISABLE_MANAGEMENT:
> +		if (arg2 || arg3 || arg4 || arg5)
> +			return -EINVAL;
>  		error = MPX_DISABLE_MANAGEMENT(me);
>  		break;
>  	default:
> -- 
> 1.9.3

-- 
ak@linux.intel.com -- Speaking for myself only

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Andi Kleen <andi@firstfloor.org>
To: "Michael Kerrisk \(man-pages\)" <mtk.manpages@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"linux-mm\@kvack.org" <linux-mm@kvack.org>,
	Dave Hansen <dave.hansen@intel.com>,
	Qiaowei Ren <qiaowei.ren@intel.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86, mpx: Ensure unused arguments of prctl() MPX requests are 0
Date: Fri, 09 Jan 2015 09:25:51 -0800	[thread overview]
Message-ID: <87r3v350io.fsf@tassilo.jf.intel.com> (raw)
In-Reply-To: <54AE5BE8.1050701@gmail.com> (Michael Kerrisk's message of "Thu, 08 Jan 2015 11:28:56 +0100")

"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> writes:

> From: Michael Kerrisk <mtk.manpages@gmail.com>
>
> commit fe8c7f5cbf91124987106faa3bdf0c8b955c4cf7 added two new prctl()
> operations, PR_MPX_ENABLE_MANAGEMENT and PR_MPX_DISABLE_MANAGEMENT.
> However, no checks were included to ensure that unused arguments
> are zero, as is done in many existing prctl()s and as should be 
> done for all new prctl()s. This patch adds the required checks.

This will break the existing gcc run time, which doesn't zero these
arguments.

-ANdi

>
> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
> ---
>  kernel/sys.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/kernel/sys.c b/kernel/sys.c
> index a8c9f5a..ea9c881 100644
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -2210,9 +2210,13 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
>  		up_write(&me->mm->mmap_sem);
>  		break;
>  	case PR_MPX_ENABLE_MANAGEMENT:
> +		if (arg2 || arg3 || arg4 || arg5)
> +			return -EINVAL;
>  		error = MPX_ENABLE_MANAGEMENT(me);
>  		break;
>  	case PR_MPX_DISABLE_MANAGEMENT:
> +		if (arg2 || arg3 || arg4 || arg5)
> +			return -EINVAL;
>  		error = MPX_DISABLE_MANAGEMENT(me);
>  		break;
>  	default:
> -- 
> 1.9.3

-- 
ak@linux.intel.com -- Speaking for myself only

  reply	other threads:[~2015-01-09 17:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-08 10:28 [PATCH] x86, mpx: Ensure unused arguments of prctl() MPX requests are 0 Michael Kerrisk (man-pages)
2015-01-08 10:28 ` Michael Kerrisk (man-pages)
2015-01-09 17:25 ` Andi Kleen [this message]
2015-01-09 17:25   ` Andi Kleen
2015-01-09 18:25   ` Michael Kerrisk (man-pages)
2015-01-09 18:25     ` Michael Kerrisk (man-pages)
2015-01-09 18:34     ` Dave Hansen
2015-01-09 18:34       ` Dave Hansen
2015-01-10 13:49       ` Michael Kerrisk (man-pages)
2015-01-10 13:49         ` Michael Kerrisk (man-pages)
2015-01-10 18:39         ` Andi Kleen
2015-01-10 18:39           ` Andi Kleen
2015-01-14  7:21           ` Michael Kerrisk (man-pages)
2015-01-14  7:21             ` Michael Kerrisk (man-pages)

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=87r3v350io.fsf@tassilo.jf.intel.com \
    --to=andi@firstfloor.org \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mtk.manpages@gmail.com \
    --cc=qiaowei.ren@intel.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.