Re: Privileged ports to access the arbiter

2021-05-06 Thread Joan Lledó
El 5/5/21 a les 20:22, Samuel Thibault ha escrit: Mmm, no, we only need it for the device_open case. We don't need it for falling back on using file_name_lookup (_SERVERS_BUS_PCI) And do we need write permissions to perform the scan?

And another patch...

2021-05-06 Thread Sergey Bugaev
There's yet another bug: libpager just throws away clean precious pages (those previously offered with pager_offer_page (precious = 1)) upon receiving them from the kernel, since it mistakes them for evicted pages it's being notified about. This is obviously very problematic. I'm attaching a patch

[PATCH 6/6] libpager: Use libc heap for pagemap

2021-05-06 Thread Sergey Bugaev
libc already implements the functionality for allocating and managing memory blocks like the pagemap. Using libc functions gives us some additional niceties like overflow checking in reallocarray (). it also means that we will not allocate a whole page of memory if we need to store just a few integ

[PATCH 5/6] libpager: Fix overallocating pagemap

2021-05-06 Thread Sergey Bugaev
The code tried to round up the allocation size to a multiple of page size. But we actually allocate newsize * sizeof (*p->pagemap) bytes, not newsize bytes, which meant allocations were sizeof (*p->pagemap) times larger than they needed to be. --- libpager/pagemap.c | 9 + 1 file changed,

[PATCH 4/6] libpager: Store pagemapsize as vm_size_t

2021-05-06 Thread Sergey Bugaev
On a 64-bit system, there can be a lot more pages than a 32-bit int can fit. --- libpager/pagemap.c | 2 +- libpager/priv.h| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libpager/pagemap.c b/libpager/pagemap.c index 963f6567..63c5f44d 100644 --- a/libpager/pagemap.c +++

[PATCH 3/6] libpager: Add error handling to various functions

2021-05-06 Thread Sergey Bugaev
Instead of ignoring errors, we might as well return them to the caller. This technically changes the function signatures, but should not break any users since they can continue to ignore the return value. --- doc/hurd.texi | 16 ++-- libpager/data-unlock.c | 13 +- libp

[PATCH 2/6] libpager: Do not flush in-core pages on offer

2021-05-06 Thread Sergey Bugaev
pager_offer_page () is documented to may ignore the offered page if the kernel already has a copy in core (indeed, that's what Mach does). However the current behavior is the inverse of that: it asks the kernel to flush (i.e. drop) its in-core copy, and replace it with the offered one. Fix this by

[PATCH 0/6] Various libpager fixes

2021-05-06 Thread Sergey Bugaev
While hacking further on tarfs mmap support, I've come across some issues in libpager and I thought I'd fix them. The issues range from plain bugs (such as pager_offer_page () always silently failing) to minor things that could be improved. The patches are fairly independent, but they touch a lot

[PATCH 1/6] libpager: Fix mixing up success and error

2021-05-06 Thread Sergey Bugaev
_pager_pagemap_resize () returns an error or 0 on success, not a boolean. --- libpager/offer-page.c | 27 ++- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/libpager/offer-page.c b/libpager/offer-page.c index 9f090bcb..ddea236a 100644 --- a/libpager/offer-p