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
d9e968cb
Commit
d9e968cb
authored
May 31, 2017
by
Al Viro
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getrlimit()/setrlimit(): move compat to native
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
ca2406ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
38 deletions
+48
-38
kernel/compat.c
kernel/compat.c
+0
-38
kernel/sys.c
kernel/sys.c
+48
-0
No files found.
kernel/compat.c
View file @
d9e968cb
...
...
@@ -427,44 +427,6 @@ COMPAT_SYSCALL_DEFINE3(sigprocmask, int, how,
#endif
COMPAT_SYSCALL_DEFINE2
(
setrlimit
,
unsigned
int
,
resource
,
struct
compat_rlimit
__user
*
,
rlim
)
{
struct
rlimit
r
;
if
(
!
access_ok
(
VERIFY_READ
,
rlim
,
sizeof
(
*
rlim
))
||
__get_user
(
r
.
rlim_cur
,
&
rlim
->
rlim_cur
)
||
__get_user
(
r
.
rlim_max
,
&
rlim
->
rlim_max
))
return
-
EFAULT
;
if
(
r
.
rlim_cur
==
COMPAT_RLIM_INFINITY
)
r
.
rlim_cur
=
RLIM_INFINITY
;
if
(
r
.
rlim_max
==
COMPAT_RLIM_INFINITY
)
r
.
rlim_max
=
RLIM_INFINITY
;
return
do_prlimit
(
current
,
resource
,
&
r
,
NULL
);
}
COMPAT_SYSCALL_DEFINE2
(
getrlimit
,
unsigned
int
,
resource
,
struct
compat_rlimit
__user
*
,
rlim
)
{
struct
rlimit
r
;
int
ret
;
ret
=
do_prlimit
(
current
,
resource
,
NULL
,
&
r
);
if
(
!
ret
)
{
if
(
r
.
rlim_cur
>
COMPAT_RLIM_INFINITY
)
r
.
rlim_cur
=
COMPAT_RLIM_INFINITY
;
if
(
r
.
rlim_max
>
COMPAT_RLIM_INFINITY
)
r
.
rlim_max
=
COMPAT_RLIM_INFINITY
;
if
(
!
access_ok
(
VERIFY_WRITE
,
rlim
,
sizeof
(
*
rlim
))
||
__put_user
(
r
.
rlim_cur
,
&
rlim
->
rlim_cur
)
||
__put_user
(
r
.
rlim_max
,
&
rlim
->
rlim_max
))
return
-
EFAULT
;
}
return
ret
;
}
int
put_compat_rusage
(
const
struct
rusage
*
r
,
struct
compat_rusage
__user
*
ru
)
{
if
(
!
access_ok
(
VERIFY_WRITE
,
ru
,
sizeof
(
*
ru
))
||
...
...
kernel/sys.c
View file @
d9e968cb
...
...
@@ -1332,6 +1332,54 @@ SYSCALL_DEFINE2(getrlimit, unsigned int, resource, struct rlimit __user *, rlim)
return
ret
;
}
#ifdef CONFIG_COMPAT
COMPAT_SYSCALL_DEFINE2
(
setrlimit
,
unsigned
int
,
resource
,
struct
compat_rlimit
__user
*
,
rlim
)
{
struct
rlimit
r
;
struct
compat_rlimit
r32
;
if
(
copy_from_user
(
&
r32
,
rlim
,
sizeof
(
struct
compat_rlimit
)))
return
-
EFAULT
;
if
(
r32
.
rlim_cur
==
COMPAT_RLIM_INFINITY
)
r
.
rlim_cur
=
RLIM_INFINITY
;
else
r
.
rlim_cur
=
r32
.
rlim_cur
;
if
(
r32
.
rlim_max
==
COMPAT_RLIM_INFINITY
)
r
.
rlim_max
=
RLIM_INFINITY
;
else
r
.
rlim_max
=
r32
.
rlim_max
;
return
do_prlimit
(
current
,
resource
,
&
r
,
NULL
);
}
COMPAT_SYSCALL_DEFINE2
(
getrlimit
,
unsigned
int
,
resource
,
struct
compat_rlimit
__user
*
,
rlim
)
{
struct
rlimit
r
;
int
ret
;
ret
=
do_prlimit
(
current
,
resource
,
NULL
,
&
r
);
if
(
!
ret
)
{
struct
rlimit
r32
;
if
(
r
.
rlim_cur
>
COMPAT_RLIM_INFINITY
)
r32
.
rlim_cur
=
COMPAT_RLIM_INFINITY
;
else
r32
.
rlim_cur
=
r
.
rlim_cur
;
if
(
r
.
rlim_max
>
COMPAT_RLIM_INFINITY
)
r32
.
rlim_max
=
COMPAT_RLIM_INFINITY
;
else
r32
.
rlim_max
=
r
.
rlim_max
;
if
(
copy_to_user
(
rlim
,
&
r32
,
sizeof
(
struct
compat_rlimit
)))
return
-
EFAULT
;
}
return
ret
;
}
#endif
#ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT
/*
...
...
Kirill Smelkov
@kirr
mentioned in commit
58c7ffc0
·
Sep 27, 2017
mentioned in commit
58c7ffc0
mentioned in commit 58c7ffc0747a3a9145629d4966291f0586703767
Toggle commit list
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