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
0abb013e
Commit
0abb013e
authored
Feb 19, 2020
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
binfmt_elf_fdpic: don't use __... uaccess primitives
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
646e84de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
12 deletions
+19
-12
fs/binfmt_elf_fdpic.c
fs/binfmt_elf_fdpic.c
+19
-12
No files found.
fs/binfmt_elf_fdpic.c
View file @
0abb013e
...
...
@@ -537,7 +537,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
platform_len
=
strlen
(
k_platform
)
+
1
;
sp
-=
platform_len
;
u_platform
=
(
char
__user
*
)
sp
;
if
(
__
copy_to_user
(
u_platform
,
k_platform
,
platform_len
)
!=
0
)
if
(
copy_to_user
(
u_platform
,
k_platform
,
platform_len
)
!=
0
)
return
-
EFAULT
;
}
...
...
@@ -552,7 +552,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
platform_len
=
strlen
(
k_base_platform
)
+
1
;
sp
-=
platform_len
;
u_base_platform
=
(
char
__user
*
)
sp
;
if
(
__
copy_to_user
(
u_base_platform
,
k_base_platform
,
platform_len
)
!=
0
)
if
(
copy_to_user
(
u_base_platform
,
k_base_platform
,
platform_len
)
!=
0
)
return
-
EFAULT
;
}
...
...
@@ -604,11 +604,13 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
/* put the ELF interpreter info on the stack */
#define NEW_AUX_ENT(id, val) \
do { \
struct { unsigned long _id, _val; } __user *ent; \
struct { unsigned long _id, _val; } __user *ent
, v
; \
\
ent = (void __user *) csp; \
__put_user((id), &ent[nr]._id); \
__put_user((val), &ent[nr]._val); \
v._id = (id); \
v._val = (val); \
if (copy_to_user(ent + nr, &v, sizeof(v))) \
return -EFAULT; \
nr++; \
} while (0)
...
...
@@ -675,7 +677,8 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
/* stack argc */
csp
-=
sizeof
(
unsigned
long
);
__put_user
(
bprm
->
argc
,
(
unsigned
long
__user
*
)
csp
);
if
(
put_user
(
bprm
->
argc
,
(
unsigned
long
__user
*
)
csp
))
return
-
EFAULT
;
BUG_ON
(
csp
!=
sp
);
...
...
@@ -689,25 +692,29 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
p
=
(
char
__user
*
)
current
->
mm
->
arg_start
;
for
(
loop
=
bprm
->
argc
;
loop
>
0
;
loop
--
)
{
__put_user
((
elf_caddr_t
)
p
,
argv
++
);
if
(
put_user
((
elf_caddr_t
)
p
,
argv
++
))
return
-
EFAULT
;
len
=
strnlen_user
(
p
,
MAX_ARG_STRLEN
);
if
(
!
len
||
len
>
MAX_ARG_STRLEN
)
return
-
EINVAL
;
p
+=
len
;
}
__put_user
(
NULL
,
argv
);
if
(
put_user
(
NULL
,
argv
))
return
-
EFAULT
;
current
->
mm
->
arg_end
=
(
unsigned
long
)
p
;
/* fill in the envv[] array */
current
->
mm
->
env_start
=
(
unsigned
long
)
p
;
for
(
loop
=
bprm
->
envc
;
loop
>
0
;
loop
--
)
{
__put_user
((
elf_caddr_t
)(
unsigned
long
)
p
,
envp
++
);
if
(
put_user
((
elf_caddr_t
)(
unsigned
long
)
p
,
envp
++
))
return
-
EFAULT
;
len
=
strnlen_user
(
p
,
MAX_ARG_STRLEN
);
if
(
!
len
||
len
>
MAX_ARG_STRLEN
)
return
-
EINVAL
;
p
+=
len
;
}
__put_user
(
NULL
,
envp
);
if
(
put_user
(
NULL
,
envp
))
return
-
EFAULT
;
current
->
mm
->
env_end
=
(
unsigned
long
)
p
;
mm
->
start_stack
=
(
unsigned
long
)
sp
;
...
...
@@ -849,8 +856,8 @@ static int elf_fdpic_map_file(struct elf_fdpic_params *params,
tmp
=
phdr
->
p_memsz
/
sizeof
(
Elf32_Dyn
);
dyn
=
(
Elf32_Dyn
__user
*
)
params
->
dynamic_addr
;
__get_user
(
d_tag
,
&
dyn
[
tmp
-
1
].
d_tag
);
if
(
d_tag
!=
0
)
if
(
get_user
(
d_tag
,
&
dyn
[
tmp
-
1
].
d_tag
)
||
d_tag
!=
0
)
goto
dynamic_error
;
break
;
}
...
...
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