madfuload crashes with 'segmentation fault' on amd64

Bug #301771 reported by Caesar
This bug report is a duplicate of:  Bug #330573: madfuload doesn't work. Edit Remove
30
This bug affects 4 people
Affects Status Importance Assigned to Milestone
madfuload (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: madfuload

I'm using Ubuntu 8.10 amd64 and trying to get M-Audio Transit USB Audio Interface working with madfuload firmware downloader.

madfuload version is 1.2-2 (latest at the moment)

Madfuload should upload the firmware to the device and device should appear in `asoundconf list` and `/proc/asound/cards` lists

command crashes with 'segmentation fault' error instead.

To reproduce:
1) get the M-Audio Transit USB interface and connect it to USB port
2) find the bus and device numbers in lsusb output. It was 005/003 in my case
3) run madfuload with proper options and get the segmentation fault:

$ sudo madfuload -v -f /usr/share/usb/maudio/ma006100.bin -3 -D /proc/bus/usb/005/003
/usr/share/usb/maudio/ma006100.bin: 5616 bytes read successfully
reading device descriptor ...
interface descriptor 0:0
DFU interface is 0
DFU descriptor found
transfer size is 64
waiting 32 ms
Segmentation fault

Btw this package works fine on i386 box.

Revision history for this message
2ndunit (dileepv) wrote :

dmesg shows this error message on my laptop.

[ 2891.049921] madfuload[11218]: segfault at 53ef1727 ip 00007f4e53e3a690 sp 00007fff5c3438b8 error 4 in libc-2.8.90.so[7f4e53db8000+169000]

I have been facing this problem for a while; it used to work fine with Dapper.

Revision history for this message
2ndunit (dileepv) wrote :

There is an open bug against madfuload for this very problem, and mr_batschner seems to have identified where the issue is with a gdb trace:
http://sourceforge.net/tracker2/?func=detail&aid=1905613&group_id=87777&atid=584353

There is a patch attached to the bug, but from the bug details, may not be a complete fix. If someone with C skills can take a look at it, it would be fantastic.

Revision history for this message
Matthias Hardt (mhardt) wrote :

The segmentation fault is caused by the missing usbfs.
While this isn't fixed you can try the following workaround.

Create an entry in /etc/fstab like this:
none /proc/bus/usb usbfs devgid=46,devmode=664 0 0

Revision history for this message
Tim Cole (tcole) wrote :

This is another bug related to bug #156085

Revision history for this message
Tim Cole (tcole) wrote :

Actually, I take that back. It does look like there is a /proc/bus/usb issue, but that is separate from the segfault.

Revision history for this message
Caesar (gaius-julius) wrote :

exactly. /proc/bus/usb issue exists on both platforms and easily fixable, but crash happens only on amd64

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Well, the /proc/bus/usb issue simply appears to be that you gave that path on the command-line no? What happens when you give a /dev/bus/usb command-line instead?

I've uploaded a fix to the madfuload package udev rules

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

The attached patch is very incorrect, I can't see what it's trying to do at all - va_start takes the name of a function argument, and the patch breaks that

Revision history for this message
Caesar (gaius-julius) wrote :

Scott, this bug is not about the /dev/bus/usb issue, it is about segfault on amd64.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

I know, my first comment was simply addressing the fact that there was another problem.

The second comment still stands - the attached patch will not work

Revision history for this message
Chris (cpeter1) wrote :

1) it seems that the seg fault is caused by strerror(errno).
After replacing strerror(errno) with a default text, no segmentation faults happens anymore.

2) thanks to Strider -> Bug #102631 I replaced in the madfuload.rules file
ACTION=="add", SUBSYSTEM=="usb", DEVPATH=="/*.0", ENV{PRODUCT}=="763/2806/*", RUN+="/usr/sbin/madfuload -l -3 -f /usr/share/usb/maudio/ma006100.bin -D $root/$name"
with
ACTION=="add", SUBSYSTEM=="usb", ENV{PRODUCT}=="763/2806/*", RUN+="/usr/sbin/madfuload -l -3 -f /usr/share/usb/maudio/ma006100.bin -D $env{DEVNAME}"

Then, madfuload works flawlessly with my Transit on amd64.

Revision history for this message
Chris (cpeter1) wrote :

remark to my comment above:

To be more precise: In the output subroutines "fatal", "warning" and "logmsg" in madfuload.c the pointer(?) strerror(errno) is converted into a string via %s,
e.g. in line 289: fatal("cannot claim interface %d: (%d) %s", interface, errno, strerror(errno)).

I think, this is where the segmentation fault happens. if strerror(errno) is converted to an integer %d instead, then no seg fault occurs and obviously madfuload returns an integer as result of strerror(errno).

Pls forgive my descriptions, I am no programmer ;-)

Revision history for this message
Neil Wilson (neil-aldur) wrote :

I can confirm this bug

madfuload[3839]: segfault at b4432dc2 ip 00007f10b437ac40 sp 00007fffbc889aa8 error 4 in libc-2.9.so[7f10b42fa000+168000]

Changed in madfuload (Ubuntu):
status: New → Confirmed
Revision history for this message
Neil Wilson (neil-aldur) wrote :

This particular bug is caused by the lack of the correct header definitions in the C file. The implicit declarations are breaking things on a 64-bit architecture.

The attached patch will at least get the 'failed to load error' into the syslog!

Scott - are you happy to package this patch or would you like me to repackage?

Changed in madfuload (Ubuntu):
assignee: nobody → Neil Wilson (neil-aldur)
Revision history for this message
lsdark (lsdark) wrote :

This patch works fine for me, thanks

Revision history for this message
Neil Wilson (neil-aldur) wrote :

The debdiff below fixes this fault, the device loading problems and generally tidies up the package so that it conforms to standards.

Revision history for this message
Neil Wilson (neil-aldur) wrote :

For those that can't wait, the package for Karmic is available on my PPA.

https://launchpad.net/~neil-aldur/+archive/ppa

Changed in madfuload (Ubuntu):
assignee: Neil Wilson (neil-aldur) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.