All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <david.ahern@oracle.com>
To: sparclinux@vger.kernel.org
Subject: Re: [PATCH 3/4] sparc64: perf: Add sanity checking on addresses in user stack
Date: Tue, 16 Jun 2015 00:27:17 +0000	[thread overview]
Message-ID: <557F6D65.2030903@oracle.com> (raw)
In-Reply-To: <1434399346-21665-4-git-send-email-david.ahern@oracle.com>

On 6/15/15 6:13 PM, Julian Calaby wrote:
> Hi David,
>
> On Tue, Jun 16, 2015 at 6:15 AM, David Ahern <david.ahern@oracle.com> wrote:
>> Processes are getting killed (sigbus or segv) while walking userspace
>> callchains when using perf. In some instances I have seen ufp = 0x7ff
>> which does not seem like a proper stack address.
>>
>> This patch adds a function to run validity checks against the address
>> before attempting the copy_from_user. The checks are copied from the
>> x86 version as a start point with the addition of a 4-byte alignment
>> check.
>>
>> Signed-off-by: David Ahern <david.ahern@oracle.com>
>> ---
>>   arch/sparc/include/asm/uaccess_64.h | 22 ++++++++++++++++++++++
>>   arch/sparc/kernel/perf_event.c      | 13 +++++++++++++
>>   2 files changed, 35 insertions(+)
>>
>> diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
>> index a35194b7dba0..ea6e9a20f3ff 100644
>> --- a/arch/sparc/include/asm/uaccess_64.h
>> +++ b/arch/sparc/include/asm/uaccess_64.h
>> @@ -49,6 +49,28 @@ do {                                                                         \
>>          __asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" ((val).seg));        \
>>   } while(0)
>>
>> +/*
>> + * Test whether a block of memory is a valid user space address.
>> + * Returns 0 if the range is valid, nonzero otherwise.
>
> Do you mean true / false here?
>

Yes. I literally copied and pasted from x86 code.


      parent reply	other threads:[~2015-06-16  0:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15 20:15 [PATCH 3/4] sparc64: perf: Add sanity checking on addresses in user stack David Ahern
2015-06-16  0:13 ` Julian Calaby
2015-06-16  0:27 ` David Ahern [this message]

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=557F6D65.2030903@oracle.com \
    --to=david.ahern@oracle.com \
    --cc=sparclinux@vger.kernel.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.