IRC channel logs
2023-07-15.log
back to list of logs
<damo22>youpi: should i try putting a sleep after the sem_post and see if it crashes? <damo22>then we will know if there still exists a race? <damo22>it does not crash if you wait 5 seconds after the sem_post <damo22>before launching the mach_msg_server <damo22>i dont know what the sem waiting prevents then <damo22>path.cpp:54:14: error: ‘PATH_MAX’ was not declared in this scope <damo22>ahh hurd has no PATH_MAX anymore <damo22>youpi: i am modifying libpciaccess to only request the io ports it needs <damo22>i am working off the assumption that mach will eventually block requests to i386_perm_create for overlapping ranges and maintain a list there <damo22>but how do i handle a process getting destroyed? <damo22>is there any way for mach to know that a process died and thus needs to release the ports? <damo22>otherwise i would have to maintain the list on the client <damo22>jlledom: is there any way for mach to know that a process died and thus needs to release a set of io ports? <damo22>i was just saying, i am modifying libpciaccess to only request io ports it needs <damo22>(18:14:43) damo22: i am working off the assumption that mach will eventually block requests to i386_perm_create for overlapping ranges and maintain a list there <damo22>but it would be so much easier if mach could know if a process that requested a bunch of ranges needs to free them all so i dont have to maintain a list on the client as well <damo22>io ports can only be used by one process at a time, regardless of the user who opened them <jlledom>damo22: I understand, but libpciaccess uses ioperm(), it doesn't call ithe 386_perm_create RPC <jlledom>> io ports can only be used by one process at a time <youpi>damo22: it knows that through the no-sender notification. Taht's already handled <youpi>io perm is implemented through the RPC <jlledom>I meant, if you're worried b/c Mach wiill block requests to i386_perm_create, will it affect livbpciaccess which is calling ioperm()? <youpi>actually, I don't think you can make libpciaccess request only the required ports <youpi>because the application doesn't actually tell what pci devices it will be using <youpi>or is that pci_device_enable ? <youpi>but I wouldn't be suprised that it doesn't <damo22>pci_legacy_open_io(struct pci_device *dev, pciaddr_t base, pciaddr_t size) <damo22>i think that is what X11 must be using? <youpi>ok, so we need to be sure that applications actually do call that once per pci card it wants to drive <damo22>pci_device_open_io(struct pci_device *dev, pciaddr_t base, pciaddr_t size) <youpi>ah, linux uses /sys/.../legacy_io <youpi>since linux makes it mandatory to use proper access <damo22>if a process that calls ioperm(0, 7, 1); dies after making that call, does something trigger in the kernel for no-sender <youpi> /* Our ``no senders'' handling routine. Deallocate the object. */ <youpi>no_senders (mach_no_senders_notification_t *notification) <damo22>so i could store a list of ranges in emul_data? <damo22>is there a way to address all io_perms? <youpi>you'll get a no sender for each port <damo22>yes but i need to check all of them when deciding if its okay to grant the next <youpi>you can simply use a global bitmap <jlledom>coldn't libpciaccess call ioperm() when it probes a device and finds an IO region, only for those region IO ports, instead of calling ioperm(0, 0xffff, 1) once at startup? <damo22>jlledom: i am working on that yes <damo22>but the kernel needs to deny access to any range that already overlaps the request <youpi>yes, and a global bitmap will work <damo22>global bitmap? theres 65536 possible ports <youpi>you already have the functions in io_per!.c <youpi>just not the overlap-testing one, but that's easy to write <youpi>one thing you'll want to add to io_perm_t, however, is whether the range is enable (by a call to i386_io_perm_modify) or not <youpi>since you may have several processes that have a port to an io_perm, but only one that has it enabled <youpi>atm gnumach doesn't care remembering if a process has it enable dor not <damo22>where can i initialise the global_iopb to 0xff? <damo22>unsigned char global_iopb[8192] = { [0 ... 8191] = 0xff }; <youpi>you can invert the condition <youpi>and it'll even go to bss instead of data <damo22>does every call to ioperm(, , 1) get a new ioperm mach port? <youpi>as it is now the port is just a way to ask to enable/disable <youpi>deallocating the port is not supposed to disable access <youpi>ioperm deallocates the port after calling __i386_io_perm_modify <damo22>i wrote something in the destructor <youpi>yes but then that'll drop access <youpi>which is not what the current ioperm() expects <damo22>the port does not usually live until ioperm(0) <damo22>+/* The destructor which is called when the last send right to a port <damo22>+ representing an io_perm_t object vanishes. */ <damo22>+io_perm_deallocate (io_perm_t io_perm) <youpi>so with what we have now, we can't use the no-sender notification, we'll have to add a call from the task termination <youpi>when destroying the task bitmap <damo22>+ /* Inverse op to clear out ports */ <damo22>+ io_bitmap_set (&global_iopb[0], io_perm->from, io_perm->to); <youpi>to tell the io_perm.c module to release the ports <youpi>since ioperm() deallocates the port after using it to enable i/o access <damo22>so the lifetime of the port means its still being used <youpi>we could but we have to care about backward compatibility, otherwise it'll be hell <youpi>also, the API of ioperm() doesn't really allow to remember a port