protonscr

steamclient.so called op_get_device_list in libusbx (either from steam-runtime or from the official repo) even when op_init returned errors which causes segmentation fault

steamclosed reviewedSteam client
ValveSoftware/steam-for-linux#2704 · opened 2013-07-19 by UnknownzD · updated 2013-08-12 · 5 comments · github
UUnknownzD 2013-07-19 github

Although I have no idea why steamclient.so wants to get a list of USB devices, but afraid this causes crash (segmentation fault) on client without any usbfs installed.

This is the crash log that I have by forcing steam linux client to load my own unstripped libusbx.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xecf00b40 (LWP 40013)]
__opendirat (dfd=dfd@entry=-100, name=name@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);

P.S. the opendirat is function provided by eglibc while the usbfs_get_device_list is a function provided by libusb1.0-so.0.1.0.

Basically if a client does not have the following directories, the usbfs_path would set to NULL and op_init would return LIBUSB_ERROR_OTHER instead of 0, but seems like the steamclient.so code has ignored the return value of op_init and continues to call the op_get_device_list afterwards (which have a call towards usbfs_get_device_list).

/dev/usbdev%d.%d
/dev/bus/usb
/proc/bus/usb

I have also reported the bug to libusbx though Ubuntu trackpad (but not by sending an email towards their own mail list yet, will do it later today) which is possible to eliminate the bug by adding 3 lines at the beginning of usbfs_get_device_list function.

https://bugs.launchpad.net/ubuntu/+source/libusbx/+bug/1202912

UUnknownzD 2013-07-19 github

In addition, I have forgotten to mention the things that I was using.

Ubuntu 13.04 amd64 (Raring)
libusb1.0.12 (which is the same version used by Ubuntu 12.04 LTS (Precise) and steam-runtime)
Unstripped libusb was compiled with -m32 -O2 -g
None of those predefined usbfs paths are shown on my Ubuntu.

Pparadigm 2013-07-20 github

I reported similar issues here. I think your report is more detailed, though. I didn't think to unstrip libusb, good idea.. Glad I'm not the only one crazy enough to run with odd USB setups.

I think Steam wants USB for bigpicture + gamepad control, fwiw.

Ggdrewb-valve maintainer 2013-07-24 github

A future Steam client beta will have a fix for this.

Ggdrewb-valve maintainer 2013-08-09 github

Today's beta client has a fix, do you still see problems after updating?

Ggdrewb-valve maintainer 2013-08-12 github

Closing pending further feedback.