On Fri, Nov 14, 2008 at 09:05:45PM +0000, Doug Ambrisko wrote: > Author: ambrisko > Date: Fri Nov 14 21:05:45 2008 > New Revision: 184974 > URL: http://svn.freebsd.org/changeset/base/184974 > > Log: > When running a 32bit app. on amd64, ensure the bits above 32bit > are zero for the copyout. Confirmed by LSI. > > Modified: > head/sys/dev/mfi/mfi.c > > Modified: head/sys/dev/mfi/mfi.c > ============================================================================== > --- head/sys/dev/mfi/mfi.c Fri Nov 14 18:09:19 2008 (r184973) > +++ head/sys/dev/mfi/mfi.c Fri Nov 14 21:05:45 2008 (r184974) > @@ -2130,6 +2130,14 @@ mfi_ioctl(struct cdev *dev, u_long cmd, > ->mfi_frame.raw[ioc->mfi_sense_off], > &sense_ptr.sense_ptr_data[0], > sizeof(sense_ptr.sense_ptr_data)); > +#ifdef __amd64__ > + if (cmd != MFI_CMD) { > + /* > + * not 64bit native so zero out any address > + * over 32bit */ > + sense_ptr.high = 0; > + } > +#endif > error = copyout(cm->cm_sense, sense_ptr.user_space, > ioc->mfi_sense_len); > if (error != 0) { > @@ -2353,6 +2361,13 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ > ->lioc_frame.raw[l_ioc.lioc_sense_off], > &sense_ptr.sense_ptr_data[0], > sizeof(sense_ptr.sense_ptr_data)); > +#ifdef __amd64__ > + /* > + * only 32bit Linux support so zero out any > + * address over 32bit > + */ > + sense_ptr.high = 0; > +#endif > error = copyout(cm->cm_sense, sense_ptr.user_space, > l_ioc.lioc_sense_len); > if (error != 0) {
Would it make sense to perform this cut slightly more generically, by checking whether the current process is 32bit ? We still have not grew the easy to check flag or attribute of the image, but usual practice is to compare p_sysent with corresponding sysvec, like if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) or if (td->td_proc->p_sysent == &elf_linux_sysvec)
pgp0QCrb4C5BP.pgp
Description: PGP signature