Hi,

El 28/12/21 a les 13:55, Samuel Thibault ha escrit:

? The interface explicitly says they can be different.

Samuel


Sorry, I was confused. I meant the function pci_device_hurd_map_range at libpciaccess. If io_map returns different ports for robj and wobj, we can only assign one of them to the variable pager, which we send to vm_map. Since we can only pass one of them to vm_map, when io_map returns different values for robj and wobj we could return an error and don't map. Something like this:

case VM_PROT_READ|VM_PROT_WRITE:
    if (robj == wobj) {
        if (robj == MACH_PORT_NULL)
            return EPERM;

        pager = wobj;
        /* Remove extra reference.  */
        mach_port_deallocate (mach_task_self (), pager);
    }
    else {
        if (robj != MACH_PORT_NULL)
            mach_port_deallocate (mach_task_self (), robj);
        if (wobj != MACH_PORT_NULL)
            mach_port_deallocate (mach_task_self (), wobj);

        return EPERM;
    }
    break;

Reply via email to