2015-04-01 11:42:53

by Stefan Seyfried

[permalink] [raw]
Subject: unit/test-gatt broken again (as always :-)

Hi all,

in bluez-5.30, the testsuite again does not complete with

MALLOC_CHECK_=3 MALLOC_PERTURB_=69 make check

Valgrind complains about a use-after-free.

I simply bisected the issue, this is the broken commit.

commit 9a0d6d99c79e5cecb76b7a61b53556447f0ccbd1
Author: Gowtham Anandha Babu <[email protected]>
Date: Thu Mar 26 18:29:06 2015 +0530

unit/test-gatt: Add TP/GAW/CL/BV-05-C test

Verify that a Generic Attribute Profile client can write a long
Characteristic Value selected by handle.

This is on plain x86_64, gcc-4.8.3 (old)

Best regards,

Stefan
--
Stefan Seyfried
Linux Consultant & Developer -- GPG Key: 0x731B665B

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537


2015-04-02 08:14:10

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: unit/test-gatt broken again (as always :-)

Hi Stefan,

On Wed, Apr 1, 2015 at 11:15 PM, Stefan Seyfried
<[email protected]> wrote:
> Hi Luiz,
>
> Am 01.04.2015 um 14:08 schrieb Luiz Augusto von Dentz:
>
>> This is actually a fault in our code that the test uncovered which is
>> good but we failed to see it happening, I actually have some plans to
>
> Ok. Then it's good that the openSUSE Buildservice setup has these
> parameters set as default for building :-)
>
>> have a check-valgrind target to catch this type of problems or maybe
>> there is a way to add MALLOC_CHECK_=3 MALLOC_PERTURB_=69 directly.
>
> I can help with that, see attached patch (sorry for the attachment, but
> making thunderbird behave well is out of scope for now :-)

Ive applied this along with the patches to fix the problem, note that
Ive edited you description since we don't use Signed-off-by in
userspace. Thanks a lot for the contribution.


--
Luiz Augusto von Dentz

2015-04-01 20:15:30

by Stefan Seyfried

[permalink] [raw]
Subject: Re: unit/test-gatt broken again (as always :-)

Hi Luiz,

Am 01.04.2015 um 14:08 schrieb Luiz Augusto von Dentz:

> This is actually a fault in our code that the test uncovered which is
> good but we failed to see it happening, I actually have some plans to

Ok. Then it's good that the openSUSE Buildservice setup has these
parameters set as default for building :-)

> have a check-valgrind target to catch this type of problems or maybe
> there is a way to add MALLOC_CHECK_=3 MALLOC_PERTURB_=69 directly.

I can help with that, see attached patch (sorry for the attachment, but
making thunderbird behave well is out of scope for now :-)

Best regards,

Stefan
--
Stefan Seyfried
Linux Consultant & Developer -- GPG Key: 0x731B665B

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537


Attachments:
0001-enable-glibc-s-malloc-checks-for-the-test-suite.patch (947.00 B)

2015-04-01 12:23:51

by Gowtham Anandha Babu

[permalink] [raw]
Subject: RE: unit/test-gatt broken again (as always :-)

Hi,

> -----Original Message-----
> From: [email protected] [mailto:linux-bluetooth-
> [email protected]] On Behalf Of Luiz Augusto von Dentz
> Sent: Wednesday, April 01, 2015 5:38 PM
> To: Stefan Seyfried
> Cc: BlueZ devel list; Gowtham Anandha Babu
> Subject: Re: unit/test-gatt broken again (as always :-)
>
> Hi Stefan,
>
> On Wed, Apr 1, 2015 at 2:42 PM, Stefan Seyfried
> <[email protected]> wrote:
> > Hi all,
> >
> > in bluez-5.30, the testsuite again does not complete with
> >
> > MALLOC_CHECK_=3 MALLOC_PERTURB_=69 make check
> >
> > Valgrind complains about a use-after-free.
> >
> > I simply bisected the issue, this is the broken commit.
> >
> > commit 9a0d6d99c79e5cecb76b7a61b53556447f0ccbd1
> > Author: Gowtham Anandha Babu <[email protected]>
> > Date: Thu Mar 26 18:29:06 2015 +0530
> >
> > unit/test-gatt: Add TP/GAW/CL/BV-05-C test
> >
> > Verify that a Generic Attribute Profile client can write a long
> > Characteristic Value selected by handle.
> >
> > This is on plain x86_64, gcc-4.8.3 (old)
>
> This is actually a fault in our code that the test uncovered which is good but
> we failed to see it happening, I actually have some plans to have a check-
> valgrind target to catch this type of problems or maybe there is a way to add
> MALLOC_CHECK_=3 MALLOC_PERTURB_=69 directly.
>
>

Good catch. I got the above error, after updating my gcc. The patch sent by Luiz resolved this issue.
Yes there may be a way for adding valgrind directly as done in
"android/system-emulator.c" & "android/bluetoothd-wrapper.c".

Regards,
Gowtham Anandha Babu

> --
> Luiz Augusto von Dentz
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to [email protected] More majordomo
> info at http://vger.kernel.org/majordomo-info.html


2015-04-01 12:08:00

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: unit/test-gatt broken again (as always :-)

Hi Stefan,

On Wed, Apr 1, 2015 at 2:42 PM, Stefan Seyfried
<[email protected]> wrote:
> Hi all,
>
> in bluez-5.30, the testsuite again does not complete with
>
> MALLOC_CHECK_=3 MALLOC_PERTURB_=69 make check
>
> Valgrind complains about a use-after-free.
>
> I simply bisected the issue, this is the broken commit.
>
> commit 9a0d6d99c79e5cecb76b7a61b53556447f0ccbd1
> Author: Gowtham Anandha Babu <[email protected]>
> Date: Thu Mar 26 18:29:06 2015 +0530
>
> unit/test-gatt: Add TP/GAW/CL/BV-05-C test
>
> Verify that a Generic Attribute Profile client can write a long
> Characteristic Value selected by handle.
>
> This is on plain x86_64, gcc-4.8.3 (old)

This is actually a fault in our code that the test uncovered which is
good but we failed to see it happening, I actually have some plans to
have a check-valgrind target to catch this type of problems or maybe
there is a way to add MALLOC_CHECK_=3 MALLOC_PERTURB_=69 directly.


--
Luiz Augusto von Dentz