Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 300819 - sys-apps/arrayprobe-2.0-r2: Early stable for memleak/double init fixes
Summary: sys-apps/arrayprobe-2.0-r2: Early stable for memleak/double init fixes
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: STABLEREQ
Depends on:
Blocks:
 
Reported: 2010-01-13 11:24 UTC by Tobias Klausmann (RETIRED)
Modified: 2010-06-24 07:04 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to fix memleak and malloc (malloc_and_strlen.patch,1.12 KB, text/plain)
2010-01-13 11:27 UTC, Tobias Klausmann (RETIRED)
Details
detach IDA driver headers from kernel and use them locally (2.0-ida_headers.patch,16.01 KB, patch)
2010-01-13 14:54 UTC, Tobias Klausmann (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Klausmann (RETIRED) gentoo-dev 2010-01-13 11:24:33 UTC
arrayprobe has been failing for me recently (segfaults, glibc free() errors and assertions in glibc failing). I poked around the source with the help of valgrind and found two bugs, a memleak and a paren error that makes a malloc go boom.

The memleak is in main(), lines 482 and 521 are redundant: the first mallocs() and the second does exactly the same but in between, there isn't a single mention of the variable the memory has been allocated for (logdrvs).

The second is in line 357. If you look closely, you'll see that the +1 near the end is inside strlen's parens, which obviously is wrong, it should be right behind them. 

I'll attach a patch that fixes both.

Fwiw, Ubuntu found the same bug and fixed it already, Debian has a bug open for it (514028) but hasn't yet released a fixed version.
Comment 1 Tobias Klausmann (RETIRED) gentoo-dev 2010-01-13 11:27:10 UTC
Created attachment 216343 [details]
Patch to fix memleak and malloc
Comment 2 Tony Vroon (RETIRED) gentoo-dev 2010-01-13 12:13:12 UTC
+  13 Jan 2010; <chainsaw@gentoo.org> +files/2.0-malloc-strlen.patch,
+  +arrayprobe-2.0-r1.ebuild:
+  Patch scavenged from Ubuntu by Tobias "Blackb rd" Klausmann
+  <klausman@gentoo.org> resolves a misplaced bracket in a strlen statement
+  and removes a malloc that does not belong. From bug #300819.
Comment 3 Tony Vroon (RETIRED) gentoo-dev 2010-01-13 12:15:06 UTC
Arches, could you (compile) test this package and consider it for early stable please. The previous release has stability problems due to bad coding and I would like to eradicate it from the tree.
If you have the hardware (Compaq/HP IDA/CCISS RAID controller) then testing with the actual hardware is of course appreciated.
Comment 4 Tobias Klausmann (RETIRED) gentoo-dev 2010-01-13 14:54:41 UTC
Created attachment 216358 [details, diff]
detach IDA driver headers from kernel and use them locally

I've added a patch that removes the necessity to include files from /usr/src/linux* (which we shoudln't do anyway). Normally, I'd expect such an API to be exported via linux-headers to /usr/include/linux. This actually is the case for the CCISS driver, but not so for the older IDA driver. 

Hence, this patch includes copies of the corresponding headers and mucks about with the configure.ac checks and the includes of probe.c to fix all that.

Yes, it's ugly. But it works. And I don't see the ida API being exported all that soon.
Comment 5 Andreas Schürch gentoo-dev 2010-01-13 15:01:22 UTC
It works and passed the tests on one of my cpq-servers (x86) with a 2.6.18-gentoo-r6 kernel.
There it worked without problems and i was able to check the array!
But on another machine with the latest stable gentoo-sources-2.6.31-r6 i had to adjust /usr/src/linux/include/asm-generic/int-ll64.h (its asm-generic/bitsperlog.h  and not asm/bitsblabla) to get the configure-script working! This seems to be still an issue in vanilla-sources-2.6.33_rc3!!?!
Imho that should go upstream as its clearly a kernel-bug! 
Comment 6 Tobias Klausmann (RETIRED) gentoo-dev 2010-01-13 18:00:21 UTC
(In reply to comment #5)
> But on another machine with the latest stable gentoo-sources-2.6.31-r6 i had to
> adjust /usr/src/linux/include/asm-generic/int-ll64.h (its
> asm-generic/bitsperlog.h  and not asm/bitsblabla) to get the configure-script
> working! This seems to be still an issue in vanilla-sources-2.6.33_rc3!!?!
> Imho that should go upstream as its clearly a kernel-bug! 

That's not a kernel bug exactly. User space programs shouldn't use the kernel header files directly. Arrayprobe does this because it needs to use the IDA driver ioctls. By contrast, the CCISS ioctls are available via /usr/include/linux.

I've committed a new ebuild (2.0-r2) which includes the (fixed) headers and does not use the kernel sources anymore. Can you sync and test that (it might still take two hours or so until the ebuild turns up on the Rsync servers, but it's in our CVS.

> 

Comment 7 Andreas Schürch gentoo-dev 2010-01-13 20:42:18 UTC
It compiles with the ~x86 sys-app/linux-headers-2.6.30-r1, but i can't test it really right now... I will do that tomorrow morning (emerge-webrsync at the company...)

But to be warned: That wrong include-path within the linux-header-file wasn't there at least till 2.6.30-r9... I assume that when new headers are getting bumped, they're screwed as well! :-/
Comment 8 Andreas Schürch gentoo-dev 2010-01-14 07:56:10 UTC
ok, i tested x86 on ida and cciss servers with different Kernel and header versions now, it works flawless!
Comment 9 Christian Faulhammer (RETIRED) gentoo-dev 2010-01-14 12:39:46 UTC
x86 stable, thanks Andreas
Comment 10 Andreas Schürch gentoo-dev 2010-01-20 22:24:51 UTC
khm... https://bugs.gentoo.org/show_bug.cgi?id=297068
Comment 11 Christoph Mende (RETIRED) gentoo-dev 2010-06-24 07:04:17 UTC
amd64 stable