Hi Paul, On Mon Apr 25, 2022 at 17:55:45 +0200, Paul Boddie wrote: > On Monday, 25 April 2022 01:04:44 CEST Adam Lackorzynski wrote: > > > > Thanks for the example. > > Thanks for looking at it! I appreciate the help. > > > I believe I see the issue but first I immediately change to buf_log2size > > to 12 for the reason of less suprise, and did not change further on the > > sizes. Then I noticed your way of handling the UTCB involved allocating > > memory. That's not needed. With the fpage you specify the window of the > > UTCB memory in the other task, so no need to allocation memory in the > > launcher task, if it is for reserving the virtual memory. > > I didn't really understand this when looking through the existing code. It > seemed that the memory was reserved, and that seemed to involve telling a > region manager/mapper about it, such as in Remote_app_model where the > prog_reserve_utcb_area method appears to attach an invalid dataspace > (obtained > from the reserved_area method) to an existing RM.
Generally, the RM API has a reserve_area call which should be used for this. > Meanwhile, the l4_factory_create_task function accepts a flexpage as > parameter > whose details are then provided in the IPC message. As you noted before, > Fiasco is meant to handle this flexpage. And it does appear that if I just > remove the dataspace allocation and provide the flexpage details, the UTCB > gets set up in the new task at the appropriate location. Yes, a dataspace has nothing to do with this. > > Then, the issue is that posix_memalign allocates memory which does not > > have the x-bit set, i.e., is memory that is not executable. > > Change it to > > buf = (char *)mmap(NULL, region_size, PROT_EXEC | PROT_READ | PROT_WRITE, > > MAP_PRIVATE | MAP_ANON, -1, 0); if (buf == MAP_FAILED) > > { > > printf("Could not reserve memory.\n"); > > return 1; > > } > > and it should work (it did for me). > > This seems like the obvious thing that I couldn't see: that the memory needs > to have the appropriate permissions associated with it. Well, it seems a bit > more obvious now! > > For the larger region I had in mind, just to keep things simple, mmap is a > bit > cumbersome because it only supports page-level alignment, so I used the L4Re > memory allocator to get a dataspace that I could attach at a suitably aligned > address. I imagine that if the parent task were to terminate, having an > independently allocated dataspace would be desirable, too. Yes, of course using a dataspace is also totally fine. Adam _______________________________________________ l4-hackers mailing list l4-hackers@os.inf.tu-dresden.de https://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers