diff options
| author | Mark Newton <newton@FreeBSD.org> | 1999-02-08 01:27:18 +0000 |
|---|---|---|
| committer | Mark Newton <newton@FreeBSD.org> | 1999-02-08 01:27:18 +0000 |
| commit | 3acac25c18e4cf5b37e4902774a9515dd5eb0e93 (patch) | |
| tree | ae0990c4dec802b6ed0d80e71d2daee1572ab310 /sys | |
| parent | 191595d3100d6af876651e8a3158915b4eded7ab (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/i386/ibcs2/ibcs2_sysvec.c | 16 | ||||
| -rw-r--r-- | sys/i386/linux/linux_sysvec.c | 14 | ||||
| -rw-r--r-- | sys/kern/imgact_elf.c | 15 | ||||
| -rw-r--r-- | sys/sys/imgact_elf.h | 4 |
4 files changed, 42 insertions, 7 deletions
diff --git a/sys/i386/ibcs2/ibcs2_sysvec.c b/sys/i386/ibcs2/ibcs2_sysvec.c index bc0fa61e3bde..b0f58875af62 100644 --- a/sys/i386/ibcs2/ibcs2_sysvec.c +++ b/sys/i386/ibcs2/ibcs2_sysvec.c @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: ibcs2_sysvec.c,v 1.12 1998/12/14 18:53:47 dt Exp $ + * $Id: ibcs2_sysvec.c,v 1.14 1999/02/04 21:21:38 newton Exp $ */ #include <sys/param.h> @@ -35,6 +35,7 @@ #include <sys/module.h> #include <sys/sysent.h> #include <sys/signalvar.h> +#include <sys/proc.h> #include <i386/ibcs2/ibcs2_syscall.h> extern int bsd_to_ibcs2_sig[]; @@ -68,7 +69,18 @@ struct sysentvec ibcs2_svr3_sysvec = { static int ibcs2_modevent(module_t mod, int type, void *unused) { - /* Do not care */ + struct proc *p = NULL; + + switch(type) { + case MOD_UNLOAD: + /* if this was an ELF module we'd use elf_brand_inuse()... */ + for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) { + if (p->p_sysent == &ibcs2_svr3_sysvec) + return EBUSY; + } + default: + /* do not care */ + } return 0; } moduledata_t ibcs2_mod = { diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index fd80f1d438e8..78f24d310903 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_sysvec.c,v 1.43 1999/01/06 23:05:38 julian Exp $ + * $Id: linux_sysvec.c,v 1.45 1999/02/04 21:20:13 newton Exp $ */ /* XXX we use functions that might not exist. */ @@ -471,8 +471,16 @@ linux_elf_modevent(module_t mod, int type, void *data) case MOD_UNLOAD: for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL; ++brandinfo) - if (elf_remove_brand_entry(*brandinfo) < 0) - error = EINVAL; + if (elf_brand_inuse(*brandinfo)) { + error = EBUSY; + } + + if (error == 0) { + for (brandinfo = &linux_brandlist[0]; + *brandinfo != NULL; ++brandinfo) + if (elf_remove_brand_entry(*brandinfo) < 0) + error = EINVAL; + } if (error) printf("Could not deinstall ELF interpreter entry\n"); else if (bootverbose) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 56f9d621d62b..90aade36c3c1 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: imgact_elf.c,v 1.44 1998/12/19 02:55:33 julian Exp $ + * $Id: imgact_elf.c,v 1.44.2.1 1999/01/27 20:51:41 julian Exp $ */ #include "opt_rlimit.h" @@ -145,6 +145,19 @@ elf_remove_brand_entry(Elf_Brandinfo *entry) return 0; } +int +elf_brand_inuse(Elf_Brandinfo *entry) +{ + struct proc *p; + + for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) { + if (p->p_sysent == entry->sysvec) + return TRUE; + } + + return FALSE; +} + static int elf_check_header(const Elf_Ehdr *hdr, int type) { diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h index d841a39c4b67..e80214053dd2 100644 --- a/sys/sys/imgact_elf.h +++ b/sys/sys/imgact_elf.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: imgact_elf.h,v 1.9 1998/09/14 05:36:51 jdp Exp $ + * $Id: imgact_elf.h,v 1.14 1999/02/06 17:58:06 mjacob Exp $ */ #ifndef _SYS_IMGACT_ELF_H_ @@ -64,6 +64,7 @@ typedef struct { #define MAX_BRANDS 8 +int elf_brand_inuse __P((Elf32_Brandinfo *entry)); int elf_insert_brand_entry __P((Elf32_Brandinfo *entry)); int elf_remove_brand_entry __P((Elf32_Brandinfo *entry)); @@ -94,6 +95,7 @@ typedef struct { #define MAX_BRANDS 8 +int elf_brand_inuse __P((Elf64_Brandinfo *entry)); int elf_insert_brand_entry __P((Elf64_Brandinfo *entry)); int elf_remove_brand_entry __P((Elf64_Brandinfo *entry)); |
