Commit 7a6f461b authored by HardenedBSD Sync Service's avatar HardenedBSD Sync Service
Browse files

Merge branch 'freebsd/current/main' into hardened/current/master

* freebsd/current/main:
  Fix post-start check when unbound.conf has moved.
  Fix local-unbound setup for some IPv6 deployments.
  ns8250: don't drop IER_TXRDY on bus_grab/ungrab
  Arch64: Clear VFP state on execve()
  Allocating the LinuxKPI current structure from a software interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c .
  Use the word "LinuxKPI" instead of "Linux compatibility", to not confuse with user-space Linux compatibility support. No functional change.
parents c5bee1fe 409388cf
......@@ -106,7 +106,7 @@ local_unbound_poststart()
local retry=5
echo -n "Waiting for nameserver to start..."
until "${command}-control" status | grep -q "is running" ; do
until "${command}-control" -c "${local_unbound_config}" status | grep -q "is running" ; do
if [ $((retry -= 1)) -eq 0 ] ; then
echo " giving up"
return 1
......
......@@ -51,6 +51,9 @@ __FBSDID("$FreeBSD$");
#include <sys/vnode.h>
#include <machine/elf.h>
#ifdef VFP
#include <machine/vfp.h>
#endif
#include <compat/freebsd32/freebsd32_util.h>
......@@ -251,6 +254,10 @@ freebsd32_setregs(struct thread *td, struct image_params *imgp,
tf->tf_x[14] = imgp->entry_addr;
tf->tf_elr = imgp->entry_addr;
tf->tf_spsr = PSR_M_32;
#ifdef VFP
vfp_reset_state(td, td->td_pcb);
#endif
}
void
......
......@@ -552,6 +552,7 @@ void
exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack)
{
struct trapframe *tf = td->td_frame;
struct pcb *pcb = td->td_pcb;
memset(tf, 0, sizeof(struct trapframe));
......@@ -559,6 +560,12 @@ exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack)
tf->tf_sp = STACKALIGN(stack);
tf->tf_lr = imgp->entry_addr;
tf->tf_elr = imgp->entry_addr;
#ifdef VFP
vfp_reset_state(td, pcb);
#endif
/* TODO: Shouldn't we also reset pcb_dbg_regs? */
}
/* Sanity check these are the same size, they will be memcpy'd to and fro */
......
......@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
#ifdef VFP
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/limits.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/pcpu.h>
......@@ -199,6 +200,26 @@ vfp_save_state(struct thread *td, struct pcb *pcb)
critical_exit();
}
/*
* Reset the FP state to avoid leaking state from the parent process across
* execve() (and to ensure that we get a consistent floating point environment
* in every new process).
*/
void
vfp_reset_state(struct thread *td, struct pcb *pcb)
{
critical_enter();
bzero(&pcb->pcb_fpustate.vfp_regs, sizeof(pcb->pcb_fpustate.vfp_regs));
KASSERT(pcb->pcb_fpusaved == &pcb->pcb_fpustate,
("pcb_fpusaved should point to pcb_fpustate."));
pcb->pcb_fpustate.vfp_fpcr = initial_fpcr;
pcb->pcb_fpustate.vfp_fpsr = 0;
pcb->pcb_vfpcpu = UINT_MAX;
pcb->pcb_fpflags = 0;
vfp_discard(td);
critical_exit();
}
void
vfp_restore_state(void)
{
......
......@@ -108,7 +108,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
td2->td_pcb->pcb_sp = (uintptr_t)td2->td_frame;
td2->td_pcb->pcb_fpusaved = &td2->td_pcb->pcb_fpustate;
td2->td_pcb->pcb_vfpcpu = UINT_MAX;
td2->td_pcb->pcb_fpusaved->vfp_fpcr = initial_fpcr;
/* Setup to release spin count in fork_exit(). */
td2->td_md.md_spinlock_count = 1;
......
......@@ -68,6 +68,7 @@ struct thread;
void vfp_init(void);
void vfp_discard(struct thread *);
void vfp_reset_state(struct thread *, struct pcb *);
void vfp_restore_state(void);
void vfp_save_state(struct thread *, struct pcb *);
......
......@@ -60,6 +60,10 @@ __FBSDID("$FreeBSD$");
#include <compat/linux/linux_util.h>
#include <compat/linux/linux_vdso.h>
#ifdef VFP
#include <machine/vfp.h>
#endif
MODULE_VERSION(linux64elf, 1);
const char *linux_kplatform;
......@@ -363,6 +367,10 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp,
regs->tf_lr = 0xffffffffffffffff;
#endif
regs->tf_elr = imgp->entry_addr;
#ifdef VFP
vfp_reset_state(td, td->td_pcb);
#endif
}
int
......
......@@ -1913,9 +1913,15 @@ linux_timer_callback_wrapper(void *context)
{
struct timer_list *timer;
linux_set_current(curthread);
timer = context;
if (linux_set_current_flags(curthread, M_NOWAIT)) {
/* try again later */
callout_reset(&timer->callout, 1,
&linux_timer_callback_wrapper, timer);
return;
}
timer->function(timer->data);
}
......
......@@ -738,6 +738,7 @@ ns8250_bus_ipend(struct uart_softc *sc)
} else {
if (iir & IIR_TXRDY) {
ipend |= SER_INT_TXIDLE;
ns8250->ier &= ~IER_ETXRDY;
uart_setreg(bas, REG_IER, ns8250->ier);
uart_barrier(bas);
} else
......@@ -1035,7 +1036,9 @@ ns8250_bus_transmit(struct uart_softc *sc)
uart_setreg(bas, REG_DATA, sc->sc_txbuf[i]);
uart_barrier(bas);
}
uart_setreg(bas, REG_IER, ns8250->ier | IER_ETXRDY);
if (!broken_txfifo)
ns8250->ier |= IER_ETXRDY;
uart_setreg(bas, REG_IER, ns8250->ier);
uart_barrier(bas);
if (broken_txfifo)
ns8250_drain(bas, UART_DRAIN_TRANSMITTER);
......
......@@ -783,8 +783,8 @@ intr_handler_barrier(struct intr_handler *handler)
* Sleep until an ithread finishes executing an interrupt handler.
*
* XXX Doesn't currently handle interrupt filters or fast interrupt
* handlers. This is intended for compatibility with linux drivers
* only. Do not use in BSD code.
* handlers. This is intended for LinuxKPI drivers only.
* Do not use in BSD code.
*/
void
_intr_drain(int irq)
......
......@@ -190,7 +190,7 @@ int intr_event_resume_handler(void *cookie);
int intr_getaffinity(int irq, int mode, void *mask);
void *intr_handler_source(void *cookie);
int intr_setaffinity(int irq, int mode, void *mask);
void _intr_drain(int irq); /* Linux compat only. */
void _intr_drain(int irq); /* LinuxKPI only. */
int swi_add(struct intr_event **eventp, const char *name,
driver_intr_t handler, void *arg, int pri, enum intr_type flags,
void **cookiep);
......
......@@ -66,7 +66,7 @@ bkext=$(date "+%Y%m%d.%H%M%S")
RE_octet="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"
RE_ipv4="(${RE_octet}(\\.${RE_octet}){3})"
RE_word="([0-9A-Fa-f]{1,4})"
RE_ipv6="((${RE_word}:){1,}(:|(:${RE_word})*)|::1)"
RE_ipv6="((${RE_word}:){1,}(:|${RE_word}?(:${RE_word})*)|::1)"
RE_port="([1-9][0-9]{0,3}|[1-5][0-9]{4,4}|6([0-4][0-9]{3}|5([0-4][0-9]{2}|5([0-2][0-9]|3[0-5]))))"
RE_dnsname="([0-9A-Za-z-]{1,}(\\.[0-9A-Za-z-]{1,})*\\.?)"
RE_forward_addr="((${RE_ipv4}|${RE_ipv6})(@${RE_port})?)"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment