NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

re: kern/50430: syscall_disestablish() can remove active syscalls

The following reply was made to PR kern/50430; it has been noted by GNATS.

From: (Christos Zoulas)
Subject: re: kern/50430: syscall_disestablish() can remove active syscalls
Date: Mon, 16 Nov 2015 07:55:30 -0500

 On Nov 16,  6:39am, (Paul Goyette) wrote:
 -- Subject: re: kern/50430: syscall_disestablish() can remove active syscalls
 | On Sun, 15 Nov 2015, Christos Zoulas wrote:
 | > - when load a module that has compat syscalls, assign to it a bit.
 | > - mark a flags field of all syscalls that were loaded with that module
 | >  with that bit.
 | > - or the lwp flags with the syscall flags on each syscall.
 | > - when it is time to unload check that no lwp has that bit in the flags set.
 | > - instead of keeping l_sysent, keep l_sysmodflags or something.
 | Just curious about any suggestions you might have for allocating the
 | flag bit to be used....
 Just look for a free one. The bit is per module, not per syscall. It is
 allocated only for modules that do syscall_establish(). If you run out,
 you don't load the module.
 | 1. Seems to me we would need to keep a 32- or 64-bit mask for each
 |     syscall.  When a new request to sc_establish() comes in, we could
 |     calculate the logical-OR of all current bits, complement the
 |     result, and find-least-significant-bit-set.
 Yes. We need a 32 or 64 bit mask per lwp. On each syscall we "or" the
 flag of the syscall (which is set when the module loads it) with the
 mask in lwp. A 64 bit mask would allow us to load 64 modules that allocate
 On module unload, we scan the lwps to make sure that none has the bit of
 the module we are trying to unload set.
 | 2. What do we do if we run out of bits?  Perhaps not too likely,
 |     but we would need to handle it.  What would be an appropriate
 |     value for sc_establish() to return if no bit is available?
 | If everyone agrees on this approach
 |  	* replace l_sysent with a bitmask l_sc_bitmask,
 |  	* add complementary sy_bitmask to struct sysent (or just a
 |  	  short bit_number sy_mask_bitnum) to the syscall table, and
 |  	* have sc_disestablish() return an error if any active lwp
 |  	  has _ever_ called a related syscall)
 | I can get started immediately on making this happen.
 I don't know, perhaps someone else has a better idea.

Home | Main Index | Thread Index | Old Index