All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: ensure __dump_instr() checks addr_limit
Date: Thu, 2 Nov 2017 17:07:50 +0000	[thread overview]
Message-ID: <20171102170750.GC595@arm.com> (raw)
In-Reply-To: <20171102161203.4704-1-mark.rutland@arm.com>

On Thu, Nov 02, 2017 at 04:12:03PM +0000, Mark Rutland wrote:
> It's possible for a user to deliberately trigger __dump_instr with a
> chosen kernel address.
> 
> Let's avoid problems resulting from this by using get_user() rather than
> __get_user(), ensuring that we don't erroneously access kernel memory.
> 
> Where we use __dump_instr() on kernel text, we already switch to
> KERNEL_DS, so this shouldn't adversely affect those cases.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Fixes: 60ffc30d5652810d ("arm64: Exception handling")
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: stable at vger.kernel.org
> ---
>  arch/arm64/kernel/traps.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Will Deacon <will.deacon@arm.com>

Catalin, can you take this as a fix please?

Will

> diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
> index 5ea4b85aee0e..8383af15a759 100644
> --- a/arch/arm64/kernel/traps.c
> +++ b/arch/arm64/kernel/traps.c
> @@ -118,7 +118,7 @@ static void __dump_instr(const char *lvl, struct pt_regs *regs)
>  	for (i = -4; i < 1; i++) {
>  		unsigned int val, bad;
>  
> -		bad = __get_user(val, &((u32 *)addr)[i]);
> +		bad = get_user(val, &((u32 *)addr)[i]);
>  
>  		if (!bad)
>  			p += sprintf(p, i == 0 ? "(%08x) " : "%08x ", val);
> -- 
> 2.11.0
> 

WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] arm64: ensure __dump_instr() checks addr_limit
Date: Thu, 2 Nov 2017 17:07:50 +0000	[thread overview]
Message-ID: <20171102170750.GC595@arm.com> (raw)
In-Reply-To: <20171102161203.4704-1-mark.rutland@arm.com>

On Thu, Nov 02, 2017 at 04:12:03PM +0000, Mark Rutland wrote:
> It's possible for a user to deliberately trigger __dump_instr with a
> chosen kernel address.
> 
> Let's avoid problems resulting from this by using get_user() rather than
> __get_user(), ensuring that we don't erroneously access kernel memory.
> 
> Where we use __dump_instr() on kernel text, we already switch to
> KERNEL_DS, so this shouldn't adversely affect those cases.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Fixes: 60ffc30d5652810d ("arm64: Exception handling")
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: stable@vger.kernel.org
> ---
>  arch/arm64/kernel/traps.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Will Deacon <will.deacon@arm.com>

Catalin, can you take this as a fix please?

Will

> diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
> index 5ea4b85aee0e..8383af15a759 100644
> --- a/arch/arm64/kernel/traps.c
> +++ b/arch/arm64/kernel/traps.c
> @@ -118,7 +118,7 @@ static void __dump_instr(const char *lvl, struct pt_regs *regs)
>  	for (i = -4; i < 1; i++) {
>  		unsigned int val, bad;
>  
> -		bad = __get_user(val, &((u32 *)addr)[i]);
> +		bad = get_user(val, &((u32 *)addr)[i]);
>  
>  		if (!bad)
>  			p += sprintf(p, i == 0 ? "(%08x) " : "%08x ", val);
> -- 
> 2.11.0
> 

  reply	other threads:[~2017-11-02 17:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02 16:12 [PATCH] arm64: ensure __dump_instr() checks addr_limit Mark Rutland
2017-11-02 16:12 ` Mark Rutland
2017-11-02 17:07 ` Will Deacon [this message]
2017-11-02 17:07   ` Will Deacon
2017-11-02 18:31 ` Catalin Marinas
2017-11-02 18:31   ` 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=20171102170750.GC595@arm.com \
    --to=will.deacon@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.