Re: [PATCH] new interface: memory_object_get_proxy

2021-11-07 Thread Samuel Thibault
Hello, Thanks! Applied at last: there were various typing errors. Samuel

Re: [PATCH] new interface: memory_object_get_proxy

2021-11-06 Thread Joan Lledó
Hi, I tested it and everything works fine. I'm attaching the two patches for convenience. About the name, feel free to change it if you want, although I think if we rename it then the function should be moved to vm_map.c, maybe just below vm_region()

Re: [PATCH] new interface: memory_object_get_proxy

2021-11-04 Thread Sergey Bugaev
On Sat, Oct 30, 2021 at 9:38 AM Joan Lledó wrote: > El 24/10/21 a les 19:50, Sergey Bugaev ha escrit: > > Naming: perhaps memory_object_create_vm_proxy ()? or even > > memory_object_create_task_vm_proxy ()? > > I don't care about the name, you guys decide. Actually, how about vm_region_create_pro

Re: [PATCH] new interface: memory_object_get_proxy

2021-11-01 Thread Joan Lledó
Hi, El 1/11/21 a les 17:47, Sergey Bugaev ha escrit: With this diff (on top of your patch), it finally works sanely for me: Cool, great work. I'd like to try it myself but I won't have the time until next weekend. I'll merge your changes with mine and make my tests.

Re: [PATCH] new interface: memory_object_get_proxy

2021-11-01 Thread Samuel Thibault
Sergey Bugaev, le lun. 01 nov. 2021 19:47:06 +0300, a ecrit: > That, and also proxies actually don't support non-zero offset, but > they do support non-zero 'start' (I don't know what the difference was > supposed to be between the two). offset is inside the original object, and start is in the pr

Re: [PATCH] new interface: memory_object_get_proxy

2021-11-01 Thread Samuel Thibault
Sergey Bugaev, le lun. 01 nov. 2021 22:59:59 +0300, a ecrit: > On Mon, Nov 1, 2021 at 10:36 PM Samuel Thibault > wrote: > > offset is inside the original object, and start is in the proxy object. > > Think for instance of /dev/mem, within which you could want to map some > > VGA-compatible range

Re: [PATCH] new interface: memory_object_get_proxy

2021-11-01 Thread Sergey Bugaev
On Mon, Nov 1, 2021 at 10:36 PM Samuel Thibault wrote: > offset is inside the original object, and start is in the proxy object. > Think for instance of /dev/mem, within which you could want to map some > VGA-compatible range at 0xA (that's the start), but the mapping > range is a subpart of t

Re: [PATCH] new interface: memory_object_get_proxy

2021-11-01 Thread Sergey Bugaev
On Mon, Nov 1, 2021 at 7:13 PM Sergey Bugaev wrote: > But again, let's try to get the simple version working first. As I've > said, with vm_object_pager_create () it kind of works, except it > doesn't give me the actual data for whatever reason. Phew, I figured out why that was! We were not calc

Re: [PATCH] new interface: memory_object_get_proxy

2021-11-01 Thread Sergey Bugaev
On Mon, Nov 1, 2021 at 6:44 PM Joan Lledó wrote: > > * "Anonymous" mappings (created with a null memory object) > > If they provide no object when calling vm_map, then the kernel uses the > default pager, isn't it? Conceptually, yes. But the way it's implemented, the object->pager port stays null

Re: [PATCH] new interface: memory_object_get_proxy

2021-11-01 Thread Joan Lledó
Hi, El 1/11/21 a les 14:36, Sergey Bugaev ha escrit: * "Anonymous" mappings (created with a null memory object) If they provide no object when calling vm_map, then the kernel uses the default pager, isn't it? Can't you send a reference to the default pager to memory_object_create_proxy()?

Re: [PATCH] new interface: memory_object_get_proxy

2021-11-01 Thread Sergey Bugaev
So I've applied the patch and have tried to actually exercise the new functionality. And unfortunately, I'm reminded (by a kernel panic and a corrupted filesystem) of the two important cases that we have forgot: * Submaps * "Anonymous" mappings (created with a null memory object) Submaps could b

[PATCH] new interface: memory_object_get_proxy

2021-11-01 Thread Joan Lledó
From: Joan Lledó To get a proxy to the region a given address belongs to, with protection and range limited to the region ones. * include/mach/mach4.defs: memory_object_get_proxy RPC declaration * vm/memory_object_proxy.c: memory_object_get_proxy implementation --- include/mach/mach4.defs | 10

Re: [PATCH] new interface: memory_object_get_proxy

2021-11-01 Thread Joan Lledó
Here you go

Re: [PATCH] new interface: memory_object_get_proxy

2021-11-01 Thread Sergey Bugaev
On Mon, Nov 1, 2021 at 12:32 PM Joan Lledó wrote: > +kern_return_t > +memory_object_get_proxy (task_t task, const vm_offset_t address, > +vm_prot_t max_protection, vm_offset_t len, > +ipc_port_t *port) > +{ > + kern_return_t err; Super minor nitpic

Re: [PATCH] new interface: memory_object_get_proxy

2021-11-01 Thread Sergey Bugaev
On Mon, Nov 1, 2021 at 12:33 PM Joan Lledó wrote: > Thanks for your explanations, it makes sense but there's still one thing I > don't understand: if memory_object_create_proxy() is the owner of the pager > it receives as parameter, and the caller doesn't care about releasing it, > then where i

Re: [PATCH] new interface: memory_object_get_proxy

2021-11-01 Thread Joan Lledó
Hi, El 30/10/21 a les 14:06, Sergey Bugaev ha escrit: > I hope this makes sense; I'd be happy to expand if not. Thanks for your explanations, it makes sense but there's still one thing I don't understand: if memory_object_create_proxy() is the owner of the pager it receives as parameter, and th

[PATCH] new interface: memory_object_get_proxy

2021-11-01 Thread Joan Lledó
From: Joan Lledó To get a proxy to the region a given address belongs to, with protection and range limited to the region ones. * include/mach/mach4.defs: memory_object_get_proxy RPC declaration * vm/memory_object_proxy.c: memory_object_get_proxy implementation --- include/mach/mach4.defs | 10

Re: [PATCH] new interface: memory_object_get_proxy

2021-10-30 Thread Samuel Thibault
I forgot to answer this: Sergey Bugaev, le sam. 30 oct. 2021 15:06:30 +0300, a ecrit: > > > Should the implementation cap the length to that of the entry > > > silently, or should it return an error if called with an overly long > > > len argument? > > > > > > > I don't know, Samuel, what do you t

Re: [PATCH] new interface: memory_object_get_proxy

2021-10-30 Thread Sergey Bugaev
On Sat, Oct 30, 2021 at 3:06 PM Sergey Bugaev wrote: > But > memory_object_create_proxy () does add a reference to the memory > object by doing ipc_port_copy_send (object[0]). It would seem that it > should not do that; but then I'm not sure why this doesn't cause a > leak — I know Samuel has ensu

Re: [PATCH] new interface: memory_object_get_proxy

2021-10-30 Thread Samuel Thibault
Joan Lledó, le sam. 30 oct. 2021 08:38:23 +0200, a ecrit: > > I don't think you can access the entry once you've unlocked the map. > > > > You're probably right b/c it doesn't seem the entry is being accessed after > the lock release in any other place of the code. You have to, yes. The problem

Re: [PATCH] new interface: memory_object_get_proxy

2021-10-30 Thread Sergey Bugaev
On Sat, Oct 30, 2021 at 9:38 AM Joan Lledó wrote: > El 24/10/21 a les 19:50, Sergey Bugaev ha escrit: > > I would expect the request port argument to be a vm_task_t (i.e. a > > vm_map), not a full task. But I see that you need to pass > > task->itk_space to memory_object_create_proxy (). But > > m

Re: [PATCH] new interface: memory_object_get_proxy

2021-10-29 Thread Joan Lledó
Hi, El 24/10/21 a les 19:50, Sergey Bugaev ha escrit: Naming: perhaps memory_object_create_vm_proxy ()? or even memory_object_create_task_vm_proxy ()? I don't care about the name, you guys decide. I would expect the request port argument to be a vm_task_t (i.e. a vm_map), not a full task. Bu

Re: [PATCH] new interface: memory_object_get_proxy

2021-10-24 Thread Sergey Bugaev
On Sun, Oct 24, 2021 at 7:28 PM Joan Lledó wrote: > +routine memory_object_get_proxy( > + task: task_t; Naming: perhaps memory_object_create_vm_proxy ()? or even memory_object_create_task_vm_proxy ()? I would expect the request port argument to be a vm_task_t (i.e. a vm

[PATCH] new interface: memory_object_get_proxy

2021-10-24 Thread Joan Lledó
From: Joan Lledó To get a proxy to the region a given address belongs to, with protection and range limited to the region ones. * include/mach/mach4.defs: memory_object_get_proxy RPC declaration * vm/memory_object_proxy.c: memory_object_get_proxy implementation --- include/mach/mach4.defs | 10