[Bug 1202912] Re: Segmentation fault in eglibc if usbfs_path is NULL and usbfs_get_device_list get called afterwards

Launchpad Bug Tracker 1202912 at bugs.launchpad.net
Mon Mar 3 05:31:50 UTC 2014


Status changed to 'Confirmed' because the bug affects multiple users.

** Changed in: libusbx (Ubuntu)
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to libusbx in Ubuntu.
https://bugs.launchpad.net/bugs/1202912

Title:
  Segmentation fault in eglibc if usbfs_path is NULL and
  usbfs_get_device_list get called afterwards

Status in “libusbx” package in Ubuntu:
  Confirmed

Bug description:
  Basically this bug exist from 1.0.12 to 1.0.16 (so this may affect
  Saucy as well)

  Tested under Hyper-V Ubuntu 13.04 (Raring) with linux-virtual kernel
  and targeted driver (using netinstall iso).

  So I have got this bug when I was running the steam client binary
  (yes, I know that this may also be a problem created by steam client
  itself as it ignores the value returned by op_init, but I think it
  would be to make the libusbx to become a fail proof library. And I
  will report this bug to valve as well) in Hyper VM (Raring), without
  any predefined usbfs path on it.

  As there is no dbg build for libusb-1.0.12 atm, I have built one on my own and here is what I have got with gdb attached to steam client binary.
  -------------------------------------------------------------------------------------------------------------------------------------------
  Program received signal SIGSEGV, Segmentation fault.
  [Switching to Thread 0xecf00b40 (LWP 40013)]
  __opendirat (dfd=dfd at entry=-100, name=name at entry=0x0)
      at ../sysdeps/posix/opendir.c:90
  90	../sysdeps/posix/opendir.c: No such file or directory.
  (gdb) frame 2
  #2  0xec2e460e in usbfs_get_device_list (_discdevs=0xeceffddc, ctx=0xebd014c8)
      at os/linux_usbfs.c:1088
  1088		DIR *buses = opendir(usbfs_path);
  -------------------------------------------------------------------------------------------------------------------------------------------
  (Frame 1 is simply a opendir function which passed the NULL pointer to opendirat in eglibc)

  Afterwards, I have recompiled the libusb 1.0.12 with following lines added to the usbfs_get_device_list function.
  -------------------------------------------------------------------------------------------------------------------------------------------
  static int usbfs_get_device_list(struct libusb_context *ctx,
  	struct discovered_devs **_discdevs)
  {
  	if (!usbfs_path) {
  		usbi_err(ctx, "could not find usbfs");
  		return LIBUSB_ERROR_OTHER;
  	}
  	struct dirent *entry;
  	DIR *buses = opendir(usbfs_path);
  -------------------------------------------------------------------------------------------------------------------------------------------
  And steam client is working like a charm again.

  Therefore I want to ask can you guys consider to add a check within
  usbfs_get_device_list or not?

  Best regards,
  UnknownzD

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libusbx/+bug/1202912/+subscriptions



More information about the foundations-bugs mailing list