From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: avoid multiple evaluation of ptr in get_user/put_user()
Date: Tue, 24 Sep 2013 15:05:38 +0100 [thread overview]
Message-ID: <20130924140537.GF25907@arm.com> (raw)
In-Reply-To: <524154C2.1080303@linaro.org>
On Tue, Sep 24, 2013 at 10:00:50AM +0100, AKASHI Takahiro wrote:
> get_user() is defined as a function macro in arm64, and trace_get_user()
> calls it as followed:
> get_user(ch, ptr++);
> Since the second parameter occurs twice in the definition, 'ptr++' is
> unexpectedly evaluated twice and trace_get_user() will generate a bogus
> string from user-provided one. As a result, some ftrace sysfs operations,
> like "echo FUNCNAME > set_ftrace_filter," hit this case and eventually fail.
> This patch fixes the issue both in get_user() and put_user().
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
> arch/arm64/include/asm/uaccess.h | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
> index edb3d5c..bbeab83 100644
> --- a/arch/arm64/include/asm/uaccess.h
> +++ b/arch/arm64/include/asm/uaccess.h
> @@ -166,9 +166,11 @@ do { \
> #define get_user(x, ptr) \
> ({ \
> + __typeof__(*(ptr)) *optr = (ptr); \
I think this should be:
__typeof__(*(ptr)) __user *optr = (ptr);
Otherwise the patch looks fine. I can fix the above.
Thanks.
--
Catalin
next prev parent reply other threads:[~2013-09-24 14:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-24 9:00 [PATCH] arm64: avoid multiple evaluation of ptr in get_user/put_user() AKASHI Takahiro
2013-09-24 14:05 ` Catalin Marinas [this message]
2013-09-24 14:25 ` Catalin Marinas
2013-09-25 9:29 ` AKASHI Takahiro
2013-09-25 13:21 ` Catalin Marinas
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=20130924140537.GF25907@arm.com \
--to=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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.