On Tue, 25 Mar 2025 16:37:07 +0100, Mark Kettenis wrote:

> > I'm not 100% sure that change is correct.  Shouldn't it be:
> > 
> >     error = (uvm_map_protect(&p->p_vmspace->vm_map, cmd->ev_addr,
> >         trunc_page(cmd->ev_addr) + round_page(cmd->ev_len),
> >         prot, 0, FALSE, TRUE));
> > 
> > to match uvm_mmap()?
>
> That doesn't make sense to me.  Where is that idiom used?

Perhaps I'm misunderstanding things.  In uvm_map() I see:

    hint = trunc_page(*addr);
    ...
    KASSERT((sz & (vaddr_t)PAGE_MASK) == 0);

So it rounds down to a page boundary and the size must be a multiple
of the page size.

Doesn't it follow that when changing the page protection we should
be using the same starting page extended by the appropriate number
of pages instead of rounding up the sum of cmd->ev_addr and cmd->ev_len?

 - todd

Reply via email to