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
Kirill Smelkov
linux
Commits
2e4a4d4e
Commit
2e4a4d4e
authored
Feb 19, 2002
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ptrace and fork interaction
parent
967fe243
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
mm/memory.c
mm/memory.c
+15
-10
No files found.
mm/memory.c
View file @
2e4a4d4e
...
...
@@ -213,7 +213,7 @@ int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
pgd_t
*
src_pgd
,
*
dst_pgd
;
unsigned
long
address
=
vma
->
vm_start
;
unsigned
long
end
=
vma
->
vm_end
;
unsigned
long
cow
=
(
vma
->
vm_flags
&
(
VM_SHARED
|
VM_
WRITE
))
==
VM_
WRITE
;
unsigned
long
cow
=
(
vma
->
vm_flags
&
(
VM_SHARED
|
VM_
MAYWRITE
))
==
VM_MAY
WRITE
;
src_pgd
=
pgd_offset
(
src
,
address
)
-
1
;
dst_pgd
=
pgd_offset
(
dst
,
address
)
-
1
;
...
...
@@ -280,7 +280,7 @@ skip_copy_pte_range: address = (address + PMD_SIZE) & PMD_MASK;
goto
cont_copy_pte_range
;
/* If it's a COW mapping, write protect it both in the parent and the child */
if
(
cow
)
{
if
(
cow
&&
pte_write
(
pte
)
)
{
ptep_set_wrprotect
(
src_pte
);
pte
=
*
src_pte
;
}
...
...
@@ -492,20 +492,25 @@ static inline struct page * get_page_map(struct page *page)
int
get_user_pages
(
struct
task_struct
*
tsk
,
struct
mm_struct
*
mm
,
unsigned
long
start
,
int
len
,
int
write
,
int
force
,
struct
page
**
pages
,
struct
vm_area_struct
**
vmas
)
{
int
i
=
0
;
int
i
;
unsigned
int
flags
;
/*
* Require read or write permissions.
* If 'force' is set, we only require the "MAY" flags.
*/
flags
=
write
?
(
VM_WRITE
|
VM_MAYWRITE
)
:
(
VM_READ
|
VM_MAYREAD
);
flags
&=
force
?
(
VM_MAYREAD
|
VM_MAYWRITE
)
:
(
VM_READ
|
VM_WRITE
);
i
=
0
;
do
{
struct
vm_area_struct
*
vma
;
vma
=
find_extend_vma
(
mm
,
start
);
if
(
!
vma
||
(
!
force
&&
((
write
&&
(
!
(
vma
->
vm_flags
&
VM_WRITE
)))
||
(
!
write
&&
(
!
(
vma
->
vm_flags
&
VM_READ
)))
)
))
{
if
(
i
)
return
i
;
return
-
EFAULT
;
}
if
(
!
vma
||
!
(
flags
&
vma
->
vm_flags
)
)
return
i
?
:
-
EFAULT
;
spin_lock
(
&
mm
->
page_table_lock
);
do
{
...
...
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