aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
authorKornel Dulęba <kd@FreeBSD.org>2022-06-02 07:58:12 +0000
committerKornel Dulęba <kd@FreeBSD.org>2022-07-18 14:27:32 +0000
commit361971fbca5fdb8121dd4d05119d81269af78ea7 (patch)
tree19256d2ffea2eaee1955f7cf83006300cbeaeab7 /sys/sys
parentf6ac79fb12f3c7ad891849d6721a20a100f6a9a9 (diff)
downloadsrc-361971fbca5fdb8121dd4d05119d81269af78ea7.tar.gz
src-361971fbca5fdb8121dd4d05119d81269af78ea7.zip
Rework how shared page related data is stored
Store the shared page address in struct vmspace. Also instead of storing absolute addresses of various shared page segments save their offsets with respect to the shared page address. This will be more useful when the shared page address is randomized. Approved by: mw(mentor) Sponsored by: Stormshield Obtained from: Semihalf Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D35393
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/exec.h8
-rw-r--r--sys/sys/sysent.h8
2 files changed, 9 insertions, 7 deletions
diff --git a/sys/sys/exec.h b/sys/sys/exec.h
index 8e62876deb81..dd7a99475cbd 100644
--- a/sys/sys/exec.h
+++ b/sys/sys/exec.h
@@ -92,11 +92,13 @@ struct execsw {
/*
* Address of signal trampoline (in user space).
- * This assumes that the sigcode resides in the shared page, which is true
- * in all cases, except for a.out binaries.
+ * This assumes that the sigcode resides in the shared page.
*/
#define PROC_SIGCODE(p) \
- ((p)->p_sysent->sv_sigcode_base)
+ ((p)->p_vmspace->vm_shp_base + (p)->p_sysent->sv_sigcode_offset)
+
+#define PROC_HAS_SHP(p) \
+ ((p)->p_sysent->sv_shared_page_obj != NULL)
int exec_map_first_page(struct image_params *);
void exec_unmap_first_page(struct image_params *);
diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h
index f677050db769..a77feb5bcbf7 100644
--- a/sys/sys/sysent.h
+++ b/sys/sys/sysent.h
@@ -137,19 +137,19 @@ struct sysentvec {
void (*sv_set_syscall_retval)(struct thread *, int);
int (*sv_fetch_syscall_args)(struct thread *);
const char **sv_syscallnames;
- vm_offset_t sv_timekeep_base;
+ vm_offset_t sv_timekeep_offset;
vm_offset_t sv_shared_page_base;
vm_offset_t sv_shared_page_len;
- vm_offset_t sv_sigcode_base;
+ vm_offset_t sv_sigcode_offset;
void *sv_shared_page_obj;
- vm_offset_t sv_vdso_base;
+ vm_offset_t sv_vdso_offset;
void (*sv_schedtail)(struct thread *);
void (*sv_thread_detach)(struct thread *);
int (*sv_trap)(struct thread *);
u_long *sv_hwcap; /* Value passed in AT_HWCAP. */
u_long *sv_hwcap2; /* Value passed in AT_HWCAP2. */
const char *(*sv_machine_arch)(struct proc *);
- vm_offset_t sv_fxrng_gen_base;
+ vm_offset_t sv_fxrng_gen_offset;
void (*sv_onexec_old)(struct thread *td);
int (*sv_onexec)(struct proc *, struct image_params *);
void (*sv_onexit)(struct proc *);