Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1428467 > unrolled thread
| Started by | He Kuang <hekuang@huawei.com> |
|---|---|
| First post | 2016-06-22 09:00 +0200 |
| Last post | 2016-06-23 15:30 +0200 |
| Articles | 5 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 5/5] perf tools: Fix NULL pointer deference when vdso not found He Kuang <hekuang@huawei.com> - 2016-06-22 09:00 +0200
Re: [PATCH 5/5] perf tools: Fix NULL pointer deference when vdso not found "Wangnan (F)" <wangnan0@huawei.com> - 2016-06-23 04:10 +0200
Re: [PATCH 5/5] perf tools: Fix NULL pointer deference when vdso not found Hekuang <hekuang@huawei.com> - 2016-06-23 05:10 +0200
Re: [PATCH 5/5] perf tools: Fix NULL pointer deference when vdso not found Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-06-23 14:10 +0200
Re: [PATCH 5/5] perf tools: Fix NULL pointer deference when vdso not found Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-06-23 15:30 +0200
| From | He Kuang <hekuang@huawei.com> |
|---|---|
| Date | 2016-06-22 09:00 +0200 |
| Subject | [PATCH 5/5] perf tools: Fix NULL pointer deference when vdso not found |
| Message-ID | <rMKiJ-8pY-3@gated-at.bofh.it> |
We should check if 'dso' is a null pointer before passing it to the
function dso__type(), otherwise a segfault will be raised in
dso__data_get_fd(). In function machine__find_vdso(), the return value
checking of 'dso' is missed and this patch fixes this issue.
Signed-off-by: He Kuang <hekuang@huawei.com>
---
tools/perf/util/vdso.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c
index 8f81c41..7bdcad4 100644
--- a/tools/perf/util/vdso.c
+++ b/tools/perf/util/vdso.c
@@ -296,7 +296,7 @@ static struct dso *machine__find_vdso(struct machine *machine,
if (!dso) {
dso = __dsos__find(&machine->dsos, DSO__NAME_VDSO,
true);
- if (dso_type != dso__type(dso, machine))
+ if (dso && dso_type != dso__type(dso, machine))
dso = NULL;
}
break;
--
1.8.5.2
[toc] | [next] | [standalone]
| From | "Wangnan (F)" <wangnan0@huawei.com> |
|---|---|
| Date | 2016-06-23 04:10 +0200 |
| Subject | Re: [PATCH 5/5] perf tools: Fix NULL pointer deference when vdso not found |
| Message-ID | <rN2fE-3kM-1@gated-at.bofh.it> |
| In reply to | #1428467 |
Hi,
This patch fixes a real crash problem when we do 'perf report'
on an arm64 platform with arm32 program.
It is introduced by commit f9b2bdf228 ("perf tools: Find vdso
with the consider of cross-platform"). From dmesg report, perf
crashes in dso__type() because dso is NULL.
Still don't know why on x86 it never crash, but it is obviously
that we need to check the return vaule from __dso__find(): it can
be NULL.
So please consider pulling.
Thank you.
On 2016/6/22 14:57, He Kuang wrote:
> We should check if 'dso' is a null pointer before passing it to the
> function dso__type(), otherwise a segfault will be raised in
> dso__data_get_fd(). In function machine__find_vdso(), the return value
> checking of 'dso' is missed and this patch fixes this issue.
>
> Signed-off-by: He Kuang <hekuang@huawei.com>
> ---
> tools/perf/util/vdso.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c
> index 8f81c41..7bdcad4 100644
> --- a/tools/perf/util/vdso.c
> +++ b/tools/perf/util/vdso.c
> @@ -296,7 +296,7 @@ static struct dso *machine__find_vdso(struct machine *machine,
> if (!dso) {
> dso = __dsos__find(&machine->dsos, DSO__NAME_VDSO,
> true);
> - if (dso_type != dso__type(dso, machine))
> + if (dso && dso_type != dso__type(dso, machine))
> dso = NULL;
> }
> break;
[toc] | [prev] | [next] | [standalone]
| From | Hekuang <hekuang@huawei.com> |
|---|---|
| Date | 2016-06-23 05:10 +0200 |
| Subject | Re: [PATCH 5/5] perf tools: Fix NULL pointer deference when vdso not found |
| Message-ID | <rN3bH-42k-3@gated-at.bofh.it> |
| In reply to | #1429400 |
在 2016/6/23 10:02, Wangnan (F) 写道:
> Hi,
>
> This patch fixes a real crash problem when we do 'perf report'
> on an arm64 platform with arm32 program.
> It is introduced by commit f9b2bdf228 ("perf tools: Find vdso
> with the consider of cross-platform"). From dmesg report, perf
> crashes in dso__type() because dso is NULL.
>
> Still don't know why on x86 it never crash, but it is obviously
This is because the fault only occured while
dso_type==DSO__TYPE_32BIT, run 64bit executable won't enter the
fault branch, but if we run a 32bit executable on x86_64, this
bug can be reproduced easily.
# file ~/hello
~/hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 4.5.0, not stripped
# perf record -g hello
Segmentation fault
Thank you.
> that we need to check the return vaule from __dso__find(): it can
> be NULL.
>
> So please consider pulling.
>
> Thank you.
>
> On 2016/6/22 14:57, He Kuang wrote:
>> We should check if 'dso' is a null pointer before passing it to the
>> function dso__type(), otherwise a segfault will be raised in
>> dso__data_get_fd(). In function machine__find_vdso(), the return value
>> checking of 'dso' is missed and this patch fixes this issue.
>>
>> Signed-off-by: He Kuang <hekuang@huawei.com>
>> ---
>> tools/perf/util/vdso.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c
>> index 8f81c41..7bdcad4 100644
>> --- a/tools/perf/util/vdso.c
>> +++ b/tools/perf/util/vdso.c
>> @@ -296,7 +296,7 @@ static struct dso *machine__find_vdso(struct
>> machine *machine,
>> if (!dso) {
>> dso = __dsos__find(&machine->dsos, DSO__NAME_VDSO,
>> true);
>> - if (dso_type != dso__type(dso, machine))
>> + if (dso && dso_type != dso__type(dso, machine))
>> dso = NULL;
>> }
>> break;
>
>
>
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-06-23 14:10 +0200 |
| Subject | Re: [PATCH 5/5] perf tools: Fix NULL pointer deference when vdso not found |
| Message-ID | <rNbCh-1lK-3@gated-at.bofh.it> |
| In reply to | #1429400 |
Em Thu, Jun 23, 2016 at 10:02:39AM +0800, Wangnan (F) escreveu:
> Hi,
>
> This patch fixes a real crash problem when we do 'perf report'
> on an arm64 platform with arm32 program.
> It is introduced by commit f9b2bdf228 ("perf tools: Find vdso
> with the consider of cross-platform"). From dmesg report, perf
> crashes in dso__type() because dso is NULL.
Ok, I removed f9b2bdf228 because of this crash, Ingo reported it, now
that I see this new patch and checked that the crash was introduced by
f9b2bdf228 I'll just combine those two and test again using a 32-bit
hackbench on top of f9b2bdf228, to reproduce the crash, then on top of
both patches combined.
- Arnaldo
> Still don't know why on x86 it never crash, but it is obviously
> that we need to check the return vaule from __dso__find(): it can
> be NULL.
>
> So please consider pulling.
>
> Thank you.
>
> On 2016/6/22 14:57, He Kuang wrote:
> > We should check if 'dso' is a null pointer before passing it to the
> > function dso__type(), otherwise a segfault will be raised in
> > dso__data_get_fd(). In function machine__find_vdso(), the return value
> > checking of 'dso' is missed and this patch fixes this issue.
> >
> > Signed-off-by: He Kuang <hekuang@huawei.com>
> > ---
> > tools/perf/util/vdso.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c
> > index 8f81c41..7bdcad4 100644
> > --- a/tools/perf/util/vdso.c
> > +++ b/tools/perf/util/vdso.c
> > @@ -296,7 +296,7 @@ static struct dso *machine__find_vdso(struct machine *machine,
> > if (!dso) {
> > dso = __dsos__find(&machine->dsos, DSO__NAME_VDSO,
> > true);
> > - if (dso_type != dso__type(dso, machine))
> > + if (dso && dso_type != dso__type(dso, machine))
> > dso = NULL;
> > }
> > break;
>
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-06-23 15:30 +0200 |
| Subject | Re: [PATCH 5/5] perf tools: Fix NULL pointer deference when vdso not found |
| Message-ID | <rNcRI-27f-25@gated-at.bofh.it> |
| In reply to | #1429737 |
Em Thu, Jun 23, 2016 at 09:07:04AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Jun 23, 2016 at 10:02:39AM +0800, Wangnan (F) escreveu:
> > Hi,
> >
> > This patch fixes a real crash problem when we do 'perf report'
> > on an arm64 platform with arm32 program.
> > It is introduced by commit f9b2bdf228 ("perf tools: Find vdso
> > with the consider of cross-platform"). From dmesg report, perf
> > crashes in dso__type() because dso is NULL.
>
> Ok, I removed f9b2bdf228 because of this crash, Ingo reported it, now
> that I see this new patch and checked that the crash was introduced by
> f9b2bdf228 I'll just combine those two and test again using a 32-bit
> hackbench on top of f9b2bdf228, to reproduce the crash, then on top of
> both patches combined.
Tested, reproduced, ammended, fixed, applied, thanks!
- Arnaldo
> - Arnaldo
>
> > Still don't know why on x86 it never crash, but it is obviously
> > that we need to check the return vaule from __dso__find(): it can
> > be NULL.
> >
> > So please consider pulling.
> >
> > Thank you.
> >
> > On 2016/6/22 14:57, He Kuang wrote:
> > > We should check if 'dso' is a null pointer before passing it to the
> > > function dso__type(), otherwise a segfault will be raised in
> > > dso__data_get_fd(). In function machine__find_vdso(), the return value
> > > checking of 'dso' is missed and this patch fixes this issue.
> > >
> > > Signed-off-by: He Kuang <hekuang@huawei.com>
> > > ---
> > > tools/perf/util/vdso.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c
> > > index 8f81c41..7bdcad4 100644
> > > --- a/tools/perf/util/vdso.c
> > > +++ b/tools/perf/util/vdso.c
> > > @@ -296,7 +296,7 @@ static struct dso *machine__find_vdso(struct machine *machine,
> > > if (!dso) {
> > > dso = __dsos__find(&machine->dsos, DSO__NAME_VDSO,
> > > true);
> > > - if (dso_type != dso__type(dso, machine))
> > > + if (dso && dso_type != dso__type(dso, machine))
> > > dso = NULL;
> > > }
> > > break;
> >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web