Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
a5d17cd7
Commit
a5d17cd7
authored
Sep 19, 2002
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SPARC64]: Trap kernel bogus program counter at fault time.
parent
3ec85d14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
11 deletions
+43
-11
arch/sparc64/kernel/traps.c
arch/sparc64/kernel/traps.c
+11
-7
arch/sparc64/mm/fault.c
arch/sparc64/mm/fault.c
+32
-4
No files found.
arch/sparc64/kernel/traps.c
View file @
a5d17cd7
...
@@ -1566,17 +1566,14 @@ void user_instruction_dump (unsigned int *pc)
...
@@ -1566,17 +1566,14 @@ void user_instruction_dump (unsigned int *pc)
printk
(
"
\n
"
);
printk
(
"
\n
"
);
}
}
void
show_trace_
task
(
struct
task_struct
*
tsk
)
void
show_trace_
raw
(
struct
thread_info
*
tp
,
unsigned
long
ksp
)
{
{
unsigned
long
pc
,
fp
;
unsigned
long
pc
,
fp
,
thread_base
;
unsigned
long
thread_base
=
(
unsigned
long
)
tsk
->
thread_info
;
struct
reg_window
*
rw
;
struct
reg_window
*
rw
;
int
count
=
0
;
int
count
=
0
;
if
(
!
tsk
)
fp
=
ksp
+
STACK_BIAS
;
return
;
thread_base
=
(
unsigned
long
)
tp
;
fp
=
tsk
->
thread_info
->
ksp
+
STACK_BIAS
;
do
{
do
{
/* Bogus frame pointer? */
/* Bogus frame pointer? */
if
(
fp
<
(
thread_base
+
sizeof
(
struct
thread_info
))
||
if
(
fp
<
(
thread_base
+
sizeof
(
struct
thread_info
))
||
...
@@ -1590,6 +1587,13 @@ void show_trace_task(struct task_struct *tsk)
...
@@ -1590,6 +1587,13 @@ void show_trace_task(struct task_struct *tsk)
printk
(
"
\n
"
);
printk
(
"
\n
"
);
}
}
void
show_trace_task
(
struct
task_struct
*
tsk
)
{
if
(
tsk
)
show_trace_raw
(
tsk
->
thread_info
,
tsk
->
thread_info
->
ksp
);
}
void
die_if_kernel
(
char
*
str
,
struct
pt_regs
*
regs
)
void
die_if_kernel
(
char
*
str
,
struct
pt_regs
*
regs
)
{
{
extern
void
__show_regs
(
struct
pt_regs
*
regs
);
extern
void
__show_regs
(
struct
pt_regs
*
regs
);
...
...
arch/sparc64/mm/fault.c
View file @
a5d17cd7
...
@@ -130,8 +130,8 @@ unsigned long __init prom_probe_memory (void)
...
@@ -130,8 +130,8 @@ unsigned long __init prom_probe_memory (void)
return
tally
;
return
tally
;
}
}
void
unhandled_fault
(
unsigned
long
address
,
struct
task_struct
*
tsk
,
static
void
unhandled_fault
(
unsigned
long
address
,
struct
task_struct
*
tsk
,
struct
pt_regs
*
regs
)
struct
pt_regs
*
regs
)
{
{
if
((
unsigned
long
)
address
<
PAGE_SIZE
)
{
if
((
unsigned
long
)
address
<
PAGE_SIZE
)
{
printk
(
KERN_ALERT
"Unable to handle kernel NULL "
printk
(
KERN_ALERT
"Unable to handle kernel NULL "
...
@@ -148,6 +148,19 @@ void unhandled_fault(unsigned long address, struct task_struct *tsk,
...
@@ -148,6 +148,19 @@ void unhandled_fault(unsigned long address, struct task_struct *tsk,
die_if_kernel
(
"Oops"
,
regs
);
die_if_kernel
(
"Oops"
,
regs
);
}
}
extern
void
show_trace_raw
(
struct
thread_info
*
,
unsigned
long
);
static
void
bad_kernel_pc
(
struct
pt_regs
*
regs
)
{
unsigned
long
ksp
;
printk
(
KERN_CRIT
"OOPS: Bogus kernel PC [%016lx] in fault handler
\n
"
,
regs
->
tpc
);
__asm__
(
"mov %%sp, %0"
:
"=r"
(
ksp
));
show_trace_raw
(
current_thread_info
(),
ksp
);
unhandled_fault
(
regs
->
tpc
,
current
,
regs
);
}
/*
/*
* We now make sure that mmap_sem is held in all paths that call
* We now make sure that mmap_sem is held in all paths that call
* this. Additionally, to prevent kswapd from ripping ptes from
* this. Additionally, to prevent kswapd from ripping ptes from
...
@@ -215,7 +228,7 @@ static inline unsigned int get_fault_insn(struct pt_regs *regs, unsigned int ins
...
@@ -215,7 +228,7 @@ static inline unsigned int get_fault_insn(struct pt_regs *regs, unsigned int ins
if
(
!
regs
->
tpc
||
(
regs
->
tpc
&
0x3
))
if
(
!
regs
->
tpc
||
(
regs
->
tpc
&
0x3
))
return
0
;
return
0
;
if
(
regs
->
tstate
&
TSTATE_PRIV
)
{
if
(
regs
->
tstate
&
TSTATE_PRIV
)
{
insn
=
*
(
unsigned
int
*
)
regs
->
tpc
;
insn
=
*
(
unsigned
int
*
)
regs
->
tpc
;
}
else
{
}
else
{
insn
=
get_user_insn
(
regs
->
tpc
);
insn
=
get_user_insn
(
regs
->
tpc
);
}
}
...
@@ -306,6 +319,20 @@ asmlinkage void do_sparc64_fault(struct pt_regs *regs)
...
@@ -306,6 +319,20 @@ asmlinkage void do_sparc64_fault(struct pt_regs *regs)
(
fault_code
&
FAULT_CODE_DTLB
))
(
fault_code
&
FAULT_CODE_DTLB
))
BUG
();
BUG
();
if
(
regs
->
tstate
&
TSTATE_PRIV
)
{
unsigned
long
tpc
=
regs
->
tpc
;
extern
unsigned
int
_etext
;
/* Sanity check the PC. */
if
((
tpc
>=
KERNBASE
&&
tpc
<
(
unsigned
long
)
&
_etext
)
||
(
tpc
>=
MODULES_VADDR
&&
tpc
<
MODULES_END
))
{
/* Valid, no problems... */
}
else
{
bad_kernel_pc
(
regs
);
return
;
}
}
/*
/*
* If we're in an interrupt or have no user
* If we're in an interrupt or have no user
* context, we must not take the fault..
* context, we must not take the fault..
...
@@ -314,7 +341,8 @@ asmlinkage void do_sparc64_fault(struct pt_regs *regs)
...
@@ -314,7 +341,8 @@ asmlinkage void do_sparc64_fault(struct pt_regs *regs)
goto
intr_or_no_mm
;
goto
intr_or_no_mm
;
if
(
test_thread_flag
(
TIF_32BIT
))
{
if
(
test_thread_flag
(
TIF_32BIT
))
{
regs
->
tpc
&=
0xffffffff
;
if
(
!
(
regs
->
tstate
&
TSTATE_PRIV
))
regs
->
tpc
&=
0xffffffff
;
address
&=
0xffffffff
;
address
&=
0xffffffff
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment