Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153520742
D24410.id70606.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D24410.id70606.diff
View Options
Index: head/sys/mips/mips/trap.c
===================================================================
--- head/sys/mips/mips/trap.c
+++ head/sys/mips/mips/trap.c
@@ -1402,7 +1402,7 @@
{
pt_entry_t *ptep;
pd_entry_t *pdep;
- unsigned int *addr;
+ unsigned int *addr, instr[4];
struct thread *td;
struct proc *p;
register_t pc;
@@ -1429,17 +1429,16 @@
* Dump a few words around faulting instruction, if the addres is
* valid.
*/
- if (!(pc & 3) &&
- useracc((caddr_t)(intptr_t)pc, sizeof(int) * 4, VM_PROT_READ)) {
+ addr = (unsigned int *)(intptr_t)pc;
+ if ((pc & 3) == 0 && copyin(addr, instr, sizeof(instr)) == 0) {
/* dump page table entry for faulting instruction */
log(LOG_ERR, "Page table info for pc address %#jx: pde = %p, pte = %#jx\n",
(intmax_t)pc, (void *)(intptr_t)*pdep, (uintmax_t)(ptep ? *ptep : 0));
- addr = (unsigned int *)(intptr_t)pc;
log(LOG_ERR, "Dumping 4 words starting at pc address %p: \n",
addr);
log(LOG_ERR, "%08x %08x %08x %08x\n",
- addr[0], addr[1], addr[2], addr[3]);
+ instr[0], instr[1], instr[2], instr[3]);
} else {
log(LOG_ERR, "pc address %#jx is inaccessible, pde = %p, pte = %#jx\n",
(intmax_t)pc, (void *)(intptr_t)*pdep, (uintmax_t)(ptep ? *ptep : 0));
@@ -1451,7 +1450,7 @@
{
pt_entry_t *ptep;
pd_entry_t *pdep;
- unsigned int *addr;
+ unsigned int *addr, instr[4];
struct thread *td;
struct proc *p;
char *read_or_write;
@@ -1499,18 +1498,18 @@
* Dump a few words around faulting instruction, if the addres is
* valid.
*/
- if (!(pc & 3) && (pc != frame->badvaddr) &&
- (trap_type != T_BUS_ERR_IFETCH) &&
- useracc((caddr_t)(intptr_t)pc, sizeof(int) * 4, VM_PROT_READ)) {
+ addr = (unsigned int *)(intptr_t)pc;
+ if ((pc & 3) == 0 && pc != frame->badvaddr &&
+ trap_type != T_BUS_ERR_IFETCH &&
+ copyin((caddr_t)(intptr_t)pc, instr, sizeof(instr)) == 0) {
/* dump page table entry for faulting instruction */
log(LOG_ERR, "Page table info for pc address %#jx: pde = %p, pte = %#jx\n",
(intmax_t)pc, (void *)(intptr_t)*pdep, (uintmax_t)(ptep ? *ptep : 0));
- addr = (unsigned int *)(intptr_t)pc;
log(LOG_ERR, "Dumping 4 words starting at pc address %p: \n",
addr);
log(LOG_ERR, "%08x %08x %08x %08x\n",
- addr[0], addr[1], addr[2], addr[3]);
+ instr[0], instr[1], instr[2], instr[3]);
} else {
log(LOG_ERR, "pc address %#jx is inaccessible, pde = %p, pte = %#jx\n",
(intmax_t)pc, (void *)(intptr_t)*pdep, (uintmax_t)(ptep ? *ptep : 0));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 22, 2:47 PM (5 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31907434
Default Alt Text
D24410.id70606.diff (2 KB)
Attached To
Mode
D24410: Don't directly access userspace memory.
Attached
Detach File
Event Timeline
Log In to Comment