Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
101b3531
Commit
101b3531
authored
Oct 06, 2005
by
Ralf Baechle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect manipulation of c0_status against preemption and multithreading.
Signed-off-by:
Ralf Baechle
<
ralf@linux-mips.org
>
parent
8afcb5d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
12 deletions
+47
-12
arch/mips/kernel/ptrace.c
arch/mips/kernel/ptrace.c
+31
-8
arch/mips/kernel/ptrace32.c
arch/mips/kernel/ptrace32.c
+16
-4
No files found.
arch/mips/kernel/ptrace.c
View file @
101b3531
...
...
@@ -33,6 +33,7 @@
#include <asm/dsp.h>
#include <asm/fpu.h>
#include <asm/mipsregs.h>
#include <asm/mipsmtregs.h>
#include <asm/pgtable.h>
#include <asm/page.h>
#include <asm/system.h>
...
...
@@ -126,10 +127,21 @@ int ptrace_getfpregs (struct task_struct *child, __u32 __user *data)
__put_user
(
child
->
thread
.
fpu
.
hard
.
fcr31
,
data
+
64
);
flags
=
read_c0_status
();
__enable_fpu
();
__asm__
__volatile__
(
"cfc1
\t
%0,$0"
:
"=r"
(
tmp
));
write_c0_status
(
flags
);
preempt_disable
();
if
(
cpu_has_mipsmt
)
{
unsigned
int
vpflags
=
dvpe
();
flags
=
read_c0_status
();
__enable_fpu
();
__asm__
__volatile__
(
"cfc1
\t
%0,$0"
:
"=r"
(
tmp
));
write_c0_status
(
flags
);
evpe
(
vpflags
);
}
else
{
flags
=
read_c0_status
();
__enable_fpu
();
__asm__
__volatile__
(
"cfc1
\t
%0,$0"
:
"=r"
(
tmp
));
write_c0_status
(
flags
);
}
preempt_enable
();
__put_user
(
tmp
,
data
+
65
);
}
else
{
__put_user
(
child
->
thread
.
fpu
.
soft
.
fcr31
,
data
+
64
);
...
...
@@ -284,10 +296,21 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
if
(
!
cpu_has_fpu
)
break
;
flags
=
read_c0_status
();
__enable_fpu
();
__asm__
__volatile__
(
"cfc1
\t
%0,$0"
:
"=r"
(
tmp
));
write_c0_status
(
flags
);
preempt_disable
();
if
(
cpu_has_mipsmt
)
{
unsigned
int
vpflags
=
dvpe
();
flags
=
read_c0_status
();
__enable_fpu
();
__asm__
__volatile__
(
"cfc1
\t
%0,$0"
:
"=r"
(
tmp
));
write_c0_status
(
flags
);
evpe
(
vpflags
);
}
else
{
flags
=
read_c0_status
();
__enable_fpu
();
__asm__
__volatile__
(
"cfc1
\t
%0,$0"
:
"=r"
(
tmp
));
write_c0_status
(
flags
);
}
preempt_enable
();
break
;
}
case
DSP_BASE
...
DSP_BASE
+
5
:
{
...
...
arch/mips/kernel/ptrace32.c
View file @
101b3531
...
...
@@ -29,6 +29,7 @@
#include <asm/dsp.h>
#include <asm/fpu.h>
#include <asm/mipsregs.h>
#include <asm/mipsmtregs.h>
#include <asm/pgtable.h>
#include <asm/page.h>
#include <asm/system.h>
...
...
@@ -191,10 +192,21 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
if
(
!
cpu_has_fpu
)
break
;
flags
=
read_c0_status
();
__enable_fpu
();
__asm__
__volatile__
(
"cfc1
\t
%0,$0"
:
"=r"
(
tmp
));
write_c0_status
(
flags
);
preempt_disable
();
if
(
cpu_has_mipsmt
)
{
unsigned
int
vpflags
=
dvpe
();
flags
=
read_c0_status
();
__enable_fpu
();
__asm__
__volatile__
(
"cfc1
\t
%0,$0"
:
"=r"
(
tmp
));
write_c0_status
(
flags
);
evpe
(
vpflags
);
}
else
{
flags
=
read_c0_status
();
__enable_fpu
();
__asm__
__volatile__
(
"cfc1
\t
%0,$0"
:
"=r"
(
tmp
));
write_c0_status
(
flags
);
}
preempt_enable
();
break
;
}
case
DSP_BASE
...
DSP_BASE
+
5
:
...
...
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