Deleted Added
full compact
31c31
< __FBSDID("$FreeBSD: head/sys/compat/linux/linux_misc.c 230132 2012-01-15 13:23:18Z uqs $");
---
> __FBSDID("$FreeBSD: head/sys/compat/linux/linux_misc.c 231885 2012-02-17 23:47:16Z kib $");
232d231
< vm_offset_t buffer;
234a234
> ssize_t aresid;
311,312c311,312
< /* Pull in executable header into kernel_map */
< error = vm_mmap(kernel_map, (vm_offset_t *)&a_out, PAGE_SIZE,
---
> /* Pull in executable header into exec_map */
> error = vm_mmap(exec_map, (vm_offset_t *)&a_out, PAGE_SIZE,
405,410c405,408
< /* map file into kernel_map */
< error = vm_mmap(kernel_map, &buffer,
< round_page(a_out->a_text + a_out->a_data + file_offset),
< VM_PROT_READ, VM_PROT_READ, 0, OBJT_VNODE, vp,
< trunc_page(file_offset));
< if (error)
---
> error = vn_rdwr(UIO_READ, vp, (void *)vmaddr, file_offset,
> a_out->a_text + a_out->a_data, UIO_USERSPACE, 0,
> td->td_ucred, NOCRED, &aresid, td);
> if (error != 0)
412,421c410,411
<
< /* copy from kernel VM space to user space */
< error = copyout(PTRIN(buffer + file_offset),
< (void *)vmaddr, a_out->a_text + a_out->a_data);
<
< /* release temporary kernel space */
< vm_map_remove(kernel_map, buffer, buffer +
< round_page(a_out->a_text + a_out->a_data + file_offset));
<
< if (error)
---
> if (aresid != 0) {
> error = ENOEXEC;
422a413
> }
466c457
< /* Release the kernel mapping. */
---
> /* Release the temporary mapping. */
468,469c459
< vm_map_remove(kernel_map, (vm_offset_t)a_out,
< (vm_offset_t)a_out + PAGE_SIZE);
---
> kmem_free_wakeup(exec_map, (vm_offset_t)a_out, PAGE_SIZE);