mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-05 09:14:03 +00: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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=35972
@ -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 New Issue
Block a user