Summary: | DAHLIN-00087: [patch] ioctls from 32bit userspace on 64bit kernel | ||
Reporter: | Tzafrir Cohen (tzafrir) | Labels: | |
Date Opened: | 2009-04-01 18:38:13 | Date Closed: | 2010-01-06 13:16:54.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) 0001-dahdi-base-Remove-some-unused-struct-inode-function-.patch ( 1) 0002-dahdi-base-Use-unlocked_ioctl-and-compat_ioctl-inste.patch ( 2) 0003-add-a-separate-dahdi_ioctl_compat.patch ( 3) dahdi-base__user.diff | |
Description: | Create a 32bit system on (chroot_dir/ , for this example) of a 64bit system. Connect a DAHDI device and load its drivers. On Debian/Ubuntu amd64: debootstrap --arch=i386 --insclude=build-essential,subversion,libreadline5-dev,libssl-dev,libnewt-dev SUITE chroot_dir chroot chroot_dir # and build asterisk (SUITE is the name of the distro to install: lenny, sid, testing, unstable, jaunty, hardy, etc.) Now run: mount -o bind /dev chroot_dir/dev chroot chroot_dir mount /proc mount /sys dahdi_genconf dahdi_cfg The last command will generate errors: DAHDI_CHANCONFIG failed on channel 1: Invalid argument (22) Such a case should probably be handled through a compat_ioctl (linux/compat.h). More reading is needed :-) ****** ADDITIONAL INFORMATION ****** (I suspect this involves a number of unexpected changes. Thus probably no reason for getting it into 2.2) | ||
Comments: | By: Tzafrir Cohen (tzafrir) 2009-06-14 03:31:26 One small patch - don't forget to mark pareameters to dahdi_read and dahdi_write as __user . We'll need to go over them as well. As an aside - the various dahdi_ioctl subfunctions tend to use the userspace parameter through an explicit cast, and thus avoid the check. By: Digium Subversion (svnbot) 2009-09-21 11:39:25 Repository: dahdi Revision: 7164 U linux/trunk/drivers/dahdi/dahdi-base.c ------------------------------------------------------------------------ r7164 | tzafrir | 2009-09-21 11:39:25 -0500 (Mon, 21 Sep 2009) | 8 lines Mark some userspace parameters with __user . No functional change. Mark parameters for some system calls as __user . This handles some of the cases, but still leaves copy_from_user / copy_to_user that are currently always used with an explicit cast. A minor patch from issue DAHLIN-87 . ------------------------------------------------------------------------ http://svn.digium.com/view/dahdi?view=rev&revision=7164 By: Shaun Ruffell (sruffell) 2009-11-04 11:43:24.000-0600 Saved off two patches that allow at least 32-bit dahdi_tool to work. I believe the DAHDI_SFCONFIG ioctl is the only one that will need to be adapted differently in the .compat_ioctl call since there are long members in the attached structure (which would be different sizes in a 32-bit userspace and 64-bit kernel). By: Tzafrir Cohen (tzafrir) 2009-12-18 16:30:16.000-0600 But then again, is there any existing program that actually uses this ioctl? By: Tzafrir Cohen (tzafrir) 2009-12-28 13:54:14.000-0600 The branch of those three patches was tested successfully here. By: Digium Subversion (svnbot) 2010-01-06 13:02:18.000-0600 Repository: dahdi Revision: 7768 U linux/trunk/drivers/dahdi/dahdi-base.c ------------------------------------------------------------------------ r7768 | tzafrir | 2010-01-06 13:02:17 -0600 (Wed, 06 Jan 2010) | 7 lines Remove some unused 'struct inode *' function parameters. Patch 0001 from issue DAHLIN-87 (initial cleanup) 0001-dahdi-base-Remove-some-unused-struct-inode-function-.patch uploaded by sruffell (license 456) ------------------------------------------------------------------------ http://svn.digium.com/view/dahdi?view=rev&revision=7768 By: Digium Subversion (svnbot) 2010-01-06 13:16:53.000-0600 Repository: dahdi Revision: 7769 U linux/trunk/drivers/dahdi/dahdi-base.c ------------------------------------------------------------------------ r7769 | tzafrir | 2010-01-06 13:16:52 -0600 (Wed, 06 Jan 2010) | 16 lines Use unlocked_ioctl and compat_ioctl instead of ioctl. * dahdi-base needs compat_ioctl in order to allow 32-bit userspace applications to call the DAHDI ioctls in a 64-bit kernel. * add a separate dahdi_ioctl_compat() to handle functions whose parameters will need some tweaks (currently: only reject DAHDI_SFCONFIG). (closes issue DAHLIN-87) * 0002-dahdi-base-Use-unlocked_ioctl-and-compat_ioctl-inste.patch uploaded by sruffell (license 456) * 0003-add-a-separate-dahdi_ioctl_compat.patch uploaded by tzafrir (license 46) Tested by: sruffell, tzafrir ------------------------------------------------------------------------ http://svn.digium.com/view/dahdi?view=rev&revision=7769 |