Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/arm/machdep.c
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
* Updated : 18/04/01 updated for new wscons | * Updated : 18/04/01 updated for new wscons | ||||
*/ | */ | ||||
#include "opt_compat.h" | #include "opt_compat.h" | ||||
#include "opt_ddb.h" | #include "opt_ddb.h" | ||||
#include "opt_platform.h" | #include "opt_platform.h" | ||||
#include "opt_sched.h" | #include "opt_sched.h" | ||||
#include "opt_timer.h" | #include "opt_timer.h" | ||||
#include "opt_pax.h" | |||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/bio.h> | #include <sys/bio.h> | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
#include <dev/fdt/fdt_common.h> | #include <dev/fdt/fdt_common.h> | ||||
#include <dev/ofw/openfirm.h> | #include <dev/ofw/openfirm.h> | ||||
#endif | #endif | ||||
#ifdef DDB | #ifdef DDB | ||||
#include <ddb/ddb.h> | #include <ddb/ddb.h> | ||||
#endif | #endif | ||||
#ifdef PAX_ASLR | |||||
#include <sys/pax.h> | |||||
#endif | |||||
#ifdef DEBUG | #ifdef DEBUG | ||||
#define debugf(fmt, args...) printf(fmt, ##args) | #define debugf(fmt, args...) printf(fmt, ##args) | ||||
#else | #else | ||||
#define debugf(fmt, args...) | #define debugf(fmt, args...) | ||||
#endif | #endif | ||||
struct pcpu __pcpu[MAXCPU]; | struct pcpu __pcpu[MAXCPU]; | ||||
struct pcpu *pcpup = &__pcpu[0]; | struct pcpu *pcpup = &__pcpu[0]; | ||||
▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | |||||
#if defined(COMPAT_43) | #if defined(COMPAT_43) | ||||
td->td_sigstk.ss_flags |= SS_ONSTACK; | td->td_sigstk.ss_flags |= SS_ONSTACK; | ||||
#endif | #endif | ||||
} else | } else | ||||
fp = (struct sigframe *)td->td_frame->tf_usr_sp; | fp = (struct sigframe *)td->td_frame->tf_usr_sp; | ||||
/* make room on the stack */ | /* make room on the stack */ | ||||
fp--; | fp--; | ||||
rwatson: Please omit pure stylistic changes from this functional diff. | |||||
Not Done Inline ActionsWill address in the next patch. lattera-gmail.com: Will address in the next patch. | |||||
/* make the stack aligned */ | /* make the stack aligned */ | ||||
Not Done Inline Actionsnit? mjg: nit? | |||||
fp = (struct sigframe *)STACKALIGN(fp); | fp = (struct sigframe *)STACKALIGN(fp); | ||||
/* Populate the siginfo frame. */ | /* Populate the siginfo frame. */ | ||||
get_mcontext(td, &frame.sf_uc.uc_mcontext, 0); | get_mcontext(td, &frame.sf_uc.uc_mcontext, 0); | ||||
frame.sf_si = ksi->ksi_info; | frame.sf_si = ksi->ksi_info; | ||||
frame.sf_uc.uc_sigmask = *mask; | frame.sf_uc.uc_sigmask = *mask; | ||||
frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK ) | frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK ) | ||||
? ((onstack) ? SS_ONSTACK : 0) : SS_DISABLE; | ? ((onstack) ? SS_ONSTACK : 0) : SS_DISABLE; | ||||
frame.sf_uc.uc_stack = td->td_sigstk; | frame.sf_uc.uc_stack = td->td_sigstk; | ||||
Show All 23 Lines | #endif | ||||
tf->tf_r1 = (register_t)&fp->sf_si; | tf->tf_r1 = (register_t)&fp->sf_si; | ||||
tf->tf_r2 = (register_t)&fp->sf_uc; | tf->tf_r2 = (register_t)&fp->sf_uc; | ||||
/* the trampoline uses r5 as the uc address */ | /* the trampoline uses r5 as the uc address */ | ||||
tf->tf_r5 = (register_t)&fp->sf_uc; | tf->tf_r5 = (register_t)&fp->sf_uc; | ||||
tf->tf_pc = (register_t)catcher; | tf->tf_pc = (register_t)catcher; | ||||
tf->tf_usr_sp = (register_t)fp; | tf->tf_usr_sp = (register_t)fp; | ||||
tf->tf_usr_lr = (register_t)(PS_STRINGS - *(p->p_sysent->sv_szsigcode)); | tf->tf_usr_lr = (register_t)(PS_STRINGS - *(p->p_sysent->sv_szsigcode)); | ||||
#ifdef PAX_ASLR | |||||
pax_aslr_stack(td, &tf->tf_usr_lr); | |||||
Not Done Inline ActionsSurprising that ARM requires special casing .. I wonder if the ARM code deserves a comment about why that is? Is there risk other architectures (e.g., MIPS) might need this as well? (I see that kern_exec.c and freebsd32 have it in machine-independent code?) rwatson: Surprising that ARM requires special casing .. I wonder if the ARM code deserves a comment… | |||||
Not Done Inline Actionscommit bebda004cd4e9ea1e0ae6c1bd2d78a2a81cc09ec Author: Ilya Bakulin <Ilya@Bakulin.de> Date: Mon Sep 29 02:46:16 2014 +0200 PAX ASLR: Fix signal delivery on ARM when ASLR is enabled The LR register on ARM contains the return address. The way its value is calculated must match the corresponding code in kern/kern_exec.c, so call pax_aslr_stack() to adjust the LR. github-issue: #46 Submitted-by: Ilya Bakulin <Ilya@Bakulin.de> Signed-off-by: Oliver Pinter <oliver.pntr@gmail.com> op: ```
commit bebda004cd4e9ea1e0ae6c1bd2d78a2a81cc09ec
Author: Ilya Bakulin <Ilya@Bakulin.de>
Date… | |||||
Not Done Inline ActionsThis change was come from kibab@ : https://github.com/kibab/freebsd/commits/hbsd . op: This change was come from kibab@ : https://github.com/kibab/freebsd/commits/hbsd . | |||||
#endif | |||||
CTR3(KTR_SIG, "sendsig: return td=%p pc=%#x sp=%#x", td, tf->tf_usr_lr, | CTR3(KTR_SIG, "sendsig: return td=%p pc=%#x sp=%#x", td, tf->tf_usr_lr, | ||||
tf->tf_usr_sp); | tf->tf_usr_sp); | ||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
mtx_lock(&psp->ps_mtx); | mtx_lock(&psp->ps_mtx); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,020 Lines • Show Last 20 Lines |
Please omit pure stylistic changes from this functional diff.