o Deal with stray machine checks
o Add for alpha a security-sensitive rate-limiting printf(9) wrapper based on ratecheck(9): void rlprintf(struct timeval *t, const char *fmt, ...);
This commit is contained in:
parent
0c779d0a01
commit
26882092f4
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: interrupt.c,v 1.59 2001/04/28 06:10:49 thorpej Exp $ */
|
||||
/* $NetBSD: interrupt.c,v 1.60 2001/05/14 19:56:22 ross Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
|
||||
@ -72,7 +72,7 @@
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.59 2001/04/28 06:10:49 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.60 2001/05/14 19:56:22 ross Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -81,6 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.59 2001/04/28 06:10:49 thorpej Exp $
|
||||
#include <sys/sched.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <machine/cpuvar.h>
|
||||
|
||||
@ -180,7 +181,8 @@ interrupt(unsigned long a0, unsigned long a1, unsigned long a2,
|
||||
case ALPHA_INTR_ERROR: /* Machine Check or Correctable Error */
|
||||
atomic_add_ulong(&ci->ci_intrdepth, 1);
|
||||
a0 = alpha_pal_rdmces();
|
||||
if (platform.mcheck_handler)
|
||||
if (platform.mcheck_handler != NULL &&
|
||||
(void *)framep->tf_regs[FRAME_PC] != XentArith)
|
||||
(*platform.mcheck_handler)(a0, framep, a1, a2);
|
||||
else
|
||||
machine_check(a0, framep, a1, a2);
|
||||
@ -245,6 +247,7 @@ machine_check(unsigned long mces, struct trapframe *framep,
|
||||
{
|
||||
const char *type;
|
||||
struct mchkinfo *mcp;
|
||||
static struct timeval ratelimit[1];
|
||||
|
||||
mcp = &curcpu()->ci_mcinfo;
|
||||
/* Make sure it's an error we know about. */
|
||||
@ -277,8 +280,11 @@ machine_check(unsigned long mces, struct trapframe *framep,
|
||||
return;
|
||||
|
||||
fatal:
|
||||
/* Clear pending machine checks and correctable errors */
|
||||
alpha_pal_wrmces(mces);
|
||||
if ((void *)framep->tf_regs[FRAME_PC] == XentArith) {
|
||||
rlprintf(ratelimit, "Stray machine check\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
printf("%s:\n", type);
|
||||
@ -560,3 +566,16 @@ softintr_disestablish(void *arg)
|
||||
|
||||
free(sih, M_DEVBUF);
|
||||
}
|
||||
|
||||
/*
|
||||
* Security sensitive rate limiting printf
|
||||
*/
|
||||
void
|
||||
rlprintf(struct timeval *t, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
static const struct timeval msgperiod[1] = {{ 5, 0 }};
|
||||
|
||||
if (ratecheck(t, msgperiod))
|
||||
vprintf(fmt, ap);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: alpha.h,v 1.15 2001/04/26 03:10:46 ross Exp $ */
|
||||
/* $NetBSD: alpha.h,v 1.16 2001/05/14 19:56:23 ross Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -62,6 +62,7 @@ typedef union alpha_t_float {
|
||||
#ifdef _KERNEL
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/stdarg.h>
|
||||
|
||||
struct pcb;
|
||||
struct proc;
|
||||
@ -117,6 +118,7 @@ void fpusave_cpu(struct cpu_info *, int);
|
||||
void fpusave_proc(struct proc *, int);
|
||||
|
||||
/* Multiprocessor glue; cpu.c */
|
||||
|
||||
struct cpu_info;
|
||||
int cpu_iccb_send(long, const char *);
|
||||
void cpu_iccb_receive(void);
|
||||
@ -145,5 +147,9 @@ void alpha_write_fp_c(struct proc *, u_int64_t);
|
||||
void alpha_enable_fp(struct proc *, int);
|
||||
int alpha_fp_complete(u_long, u_long, struct proc *, u_int64_t *);
|
||||
|
||||
/* Security sensitive rate limiting printf */
|
||||
|
||||
void rlprintf(struct timeval *t, const char *fmt, ...);
|
||||
|
||||
#endif /* _KERNEL */
|
||||
#endif /* _ALPHA_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user