mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Don't attempt to read process context from the kernel when (the
kernel's) curproc is null. This fixes endless recursion in xfer_umem() for attempts to read from user addresses, in particular for attempts to read %fs and %gs from the pcb for `info reg'.
This commit is contained in:
parent
12e553e059
commit
e7c80443b4
3 changed files with 6 additions and 6 deletions
|
|
@ -361,7 +361,7 @@ get_kcore_registers (regno)
|
|||
struct user *uaddr;
|
||||
|
||||
/* find the pcb for the current process */
|
||||
if (kvread (&cur_proc->p_addr, &uaddr))
|
||||
if (cur_proc == NULL || kvread (&cur_proc->p_addr, &uaddr))
|
||||
error ("cannot read u area ptr for proc at %#x", cur_proc);
|
||||
if (read_pcb (core_kd, (CORE_ADDR)&uaddr->u_pcb) < 0)
|
||||
error ("cannot read pcb at %#x", &uaddr->u_pcb);
|
||||
|
|
@ -418,7 +418,7 @@ xfer_umem (memaddr, myaddr, len, write)
|
|||
int n;
|
||||
struct proc proc;
|
||||
|
||||
if (kvread (cur_proc, &proc))
|
||||
if (cur_proc == NULL || kvread (cur_proc, &proc))
|
||||
error ("cannot read proc at %#x", cur_proc);
|
||||
n = kvm_uread (core_kd, &proc, memaddr, myaddr, len) ;
|
||||
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ get_kcore_registers (regno)
|
|||
struct user *uaddr;
|
||||
|
||||
/* find the pcb for the current process */
|
||||
if (kvread (&cur_proc->p_addr, &uaddr))
|
||||
if (cur_proc == NULL || kvread (&cur_proc->p_addr, &uaddr))
|
||||
error ("cannot read u area ptr for proc at %#x", cur_proc);
|
||||
if (read_pcb (core_kd, (CORE_ADDR)&uaddr->u_pcb) < 0)
|
||||
error ("cannot read pcb at %#x", &uaddr->u_pcb);
|
||||
|
|
@ -418,7 +418,7 @@ xfer_umem (memaddr, myaddr, len, write)
|
|||
int n;
|
||||
struct proc proc;
|
||||
|
||||
if (kvread (cur_proc, &proc))
|
||||
if (cur_proc == NULL || kvread (cur_proc, &proc))
|
||||
error ("cannot read proc at %#x", cur_proc);
|
||||
n = kvm_uread (core_kd, &proc, memaddr, myaddr, len) ;
|
||||
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ get_kcore_registers (regno)
|
|||
struct user *uaddr;
|
||||
|
||||
/* find the pcb for the current process */
|
||||
if (kvread (&cur_proc->p_addr, &uaddr))
|
||||
if (cur_proc == NULL || kvread (&cur_proc->p_addr, &uaddr))
|
||||
error ("cannot read u area ptr for proc at %#x", cur_proc);
|
||||
if (read_pcb (core_kd, (CORE_ADDR)&uaddr->u_pcb) < 0)
|
||||
error ("cannot read pcb at %#x", &uaddr->u_pcb);
|
||||
|
|
@ -418,7 +418,7 @@ xfer_umem (memaddr, myaddr, len, write)
|
|||
int n;
|
||||
struct proc proc;
|
||||
|
||||
if (kvread (cur_proc, &proc))
|
||||
if (cur_proc == NULL || kvread (cur_proc, &proc))
|
||||
error ("cannot read proc at %#x", cur_proc);
|
||||
n = kvm_uread (core_kd, &proc, memaddr, myaddr, len) ;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue