Teach rump to process __link_set_evcnts entries. (Second part of
fix for PR kern/55088)
This commit is contained in:
parent
3ec019e619
commit
561f1f3c9a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rumpuser_dl.c,v 1.32 2020/03/21 04:48:37 pgoyette Exp $ */
|
||||
/* $NetBSD: rumpuser_dl.c,v 1.33 2020/03/22 13:30:10 pgoyette Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
|
||||
|
@ -40,15 +40,12 @@
|
|||
#include "rumpuser_port.h"
|
||||
|
||||
#if !defined(lint)
|
||||
__RCSID("$NetBSD: rumpuser_dl.c,v 1.32 2020/03/21 04:48:37 pgoyette Exp $");
|
||||
__RCSID("$NetBSD: rumpuser_dl.c,v 1.33 2020/03/22 13:30:10 pgoyette Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef NOTYET
|
||||
#include <sys/evcnt.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
@ -353,7 +350,8 @@ getsymbols(struct link_map *map, int ismainobj)
|
|||
|
||||
static void
|
||||
process_object(void *handle,
|
||||
rump_modinit_fn domodinit, rump_compload_fn docompload)
|
||||
rump_modinit_fn domodinit, rump_compload_fn docompload,
|
||||
rump_evcntattach_fn doevcntattach)
|
||||
{
|
||||
const struct modinfo *const *mi_start, *const *mi_end;
|
||||
struct rump_component *const *rc, *const *rc_end;
|
||||
|
@ -362,9 +360,7 @@ process_object(void *handle,
|
|||
typedef void sysctl_setup_func(struct sysctllog **);
|
||||
sysctl_setup_func *const *sfp, *const *sfp_end;
|
||||
|
||||
#ifdef NOTYET /* We don't yet handle link_set_evcnts */
|
||||
struct evcnt *const *evp, *const *evp_end;
|
||||
#endif
|
||||
|
||||
mi_start = dlsym(handle, "__start_link_set_modules");
|
||||
mi_end = dlsym(handle, "__stop_link_set_modules");
|
||||
|
@ -388,16 +384,14 @@ process_object(void *handle,
|
|||
assert(sfp == sfp_end);
|
||||
}
|
||||
|
||||
#ifdef NOTYET
|
||||
/* handle link_set_evcnts */
|
||||
evp = dlsym(handle, "__start_link_set_evcnts");
|
||||
evp_end = dlsym(handle, "__stop_link_set_evcnts");
|
||||
if (evp && evp_end) {
|
||||
for (; evp < evp_end; evp++)
|
||||
evcnt_attach_static(*evp);
|
||||
doevcntattach(*evp);
|
||||
assert(evp == evp_end);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -406,7 +400,8 @@ process_object(void *handle,
|
|||
*/
|
||||
void
|
||||
rumpuser_dl_bootstrap(rump_modinit_fn domodinit,
|
||||
rump_symload_fn symload, rump_compload_fn compload)
|
||||
rump_symload_fn symload, rump_compload_fn compload,
|
||||
rump_evcntattach_fn doevcntattach)
|
||||
{
|
||||
struct link_map *map, *origmap, *mainmap;
|
||||
void *mainhandle;
|
||||
|
@ -501,7 +496,7 @@ rumpuser_dl_bootstrap(rump_modinit_fn domodinit,
|
|||
if (handle == NULL)
|
||||
continue;
|
||||
}
|
||||
process_object(handle, domodinit, compload);
|
||||
process_object(handle, domodinit, compload, doevcntattach);
|
||||
if (map != mainmap)
|
||||
dlclose(handle);
|
||||
}
|
||||
|
@ -512,7 +507,8 @@ rumpuser_dl_bootstrap(rump_modinit_fn domodinit,
|
|||
*/
|
||||
void
|
||||
rumpuser_dl_bootstrap(rump_modinit_fn domodinit,
|
||||
rump_symload_fn symload, rump_compload_fn compload)
|
||||
rump_symload_fn symload, rump_compload_fn compload,
|
||||
rump_evcntattach_fn doevcntattach)
|
||||
{
|
||||
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rumpuser.h,v 1.115 2017/12/27 09:01:53 ozaki-r Exp $ */
|
||||
/* $NetBSD: rumpuser.h,v 1.116 2020/03/22 13:30:10 pgoyette Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved.
|
||||
|
@ -224,10 +224,13 @@ void rumpuser_cv_has_waiters(struct rumpuser_cv *, int *);
|
|||
|
||||
struct modinfo;
|
||||
struct rump_component;
|
||||
struct evcnt;
|
||||
typedef void (*rump_modinit_fn)(const struct modinfo *const *, size_t);
|
||||
typedef int (*rump_symload_fn)(void *, uint64_t, char *, uint64_t);
|
||||
typedef void (*rump_compload_fn)(const struct rump_component *);
|
||||
void rumpuser_dl_bootstrap(rump_modinit_fn, rump_symload_fn, rump_compload_fn);
|
||||
typedef void (*rump_evcntattach_fn)(struct evcnt *);
|
||||
void rumpuser_dl_bootstrap(rump_modinit_fn, rump_symload_fn, rump_compload_fn,
|
||||
rump_evcntattach_fn);
|
||||
|
||||
/*
|
||||
* misc management
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rump.c,v 1.342 2020/02/22 21:45:34 ad Exp $ */
|
||||
/* $NetBSD: rump.c,v 1.343 2020/03/22 13:30:10 pgoyette Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved.
|
||||
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.342 2020/02/22 21:45:34 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.343 2020/03/22 13:30:10 pgoyette Exp $");
|
||||
|
||||
#include <sys/systm.h>
|
||||
#define ELFSIZE ARCH_ELFSIZE
|
||||
|
@ -129,6 +129,7 @@ rump_proc_vfs_init_fn rump_proc_vfs_init = (void *)nullop;
|
|||
rump_proc_vfs_release_fn rump_proc_vfs_release = (void *)nullop;
|
||||
|
||||
static void add_linkedin_modules(const struct modinfo *const *, size_t);
|
||||
static void add_static_evcnt(struct evcnt *);
|
||||
|
||||
static pid_t rspo_wrap_getpid(void) {
|
||||
return rump_sysproxy_hyp_getpid();
|
||||
|
@ -423,7 +424,7 @@ rump_init(void)
|
|||
|
||||
/* process dso's */
|
||||
rumpuser_dl_bootstrap(add_linkedin_modules,
|
||||
rump_kernelfsym_load, rump_component_load);
|
||||
rump_kernelfsym_load, rump_component_load, add_static_evcnt);
|
||||
|
||||
rump_component_addlocal();
|
||||
rump_component_init(RUMP_COMPONENT_KERN);
|
||||
|
@ -645,6 +646,18 @@ add_linkedin_modules(const struct modinfo * const *mip, size_t nmodinfo)
|
|||
module_builtin_add(mip, nmodinfo, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add an evcnt. Just in case it might already have been added, remove
|
||||
* it first.
|
||||
*/
|
||||
static void
|
||||
add_static_evcnt(struct evcnt *ev)
|
||||
{
|
||||
|
||||
evcnt_detach(ev);
|
||||
evcnt_attach_static(ev);
|
||||
}
|
||||
|
||||
int
|
||||
rump_kernelfsym_load(void *symtab, uint64_t symsize,
|
||||
char *strtab, uint64_t strsize)
|
||||
|
|
Loading…
Reference in New Issue