Skip to contentSkip to conversation

proc: fix reported unit for RLIMIT_CPU

PATCH In review Kees Cook 3 participants 3 messages Jul 8, 2009 Proc filesystem

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 proc: fix reported unit for RLIMIT_CPU

/proc/$pid/limits should show RLIMIT_CPU as seconds, which is the unit used in kernel/posix-cpu-timers.c:

        unsigned long psecs = cputime_to_secs(ptime);
        ...
        if (psecs >= sig->rlim[RLIMIT_CPU].rlim_max) {
                ...
                __group_send_sig_info(SIGKILL, SEND_SIG_PRIV, tsk);
---
 fs/proc/base.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/proc/base.c +1 -1
index 3ce5ae9..5891360 100644
@@ -461,7 +461,7 @@ struct limit_names {
 };
 
 static const struct limit_names lnames[RLIM_NLIMITS] = {
-	[RLIMIT_CPU] = {"Max cpu time", "ms"},
+	[RLIMIT_CPU] = {"Max cpu time", "seconds"},
 	[RLIMIT_FSIZE] = {"Max file size", "bytes"},
 	[RLIMIT_DATA] = {"Max data size", "bytes"},
 	[RLIMIT_STACK] = {"Max stack size", "bytes"},
Signature · 5 lines
1.6.3.3

-- 
Kees Cook
Ubuntu Security Team
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Kees Cook

/proc/$pid/limits should show RLIMIT_CPU as seconds, which is the unit used in kernel/posix-cpu-timers.c:

       unsigned long psecs = cputime_to_secs(ptime);
       ...
       if (psecs >= sig->rlim[RLIMIT_CPU].rlim_max) {
               ...
               __group_send_sig_info(SIGKILL, SEND_SIG_PRIV, tsk);
Quoted 28 lines

---
fs/proc/base.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
fs/proc/base.c +1 -1
index 3ce5ae9..5891360 100644
@@ -461,7 +461,7 @@ struct limit_names {
 };
 
 static const struct limit_names lnames[RLIM_NLIMITS] = {
-	[RLIMIT_CPU] = {"Max cpu time", "ms"},
+	[RLIMIT_CPU] = {"Max cpu time", "seconds"},
 	[RLIMIT_FSIZE] = {"Max file size", "bytes"},
 	[RLIMIT_DATA] = {"Max data size", "bytes"},
 	[RLIMIT_STACK] = {"Max stack size", "bytes"},
Signature · 10 lines
1.6.3.3

-- 
Kees Cook
Ubuntu Security Team
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Acked-by on v1 1/1
#2 lore raw
In reply to Kees Cook
Quoted 19 lines · Kees Cook

/proc/$pid/limits should show RLIMIT_CPU as seconds, which is the unit used in kernel/posix-cpu-timers.c:

        unsigned long psecs = cputime_to_secs(ptime);
        ...
        if (psecs >= sig->rlim[RLIMIT_CPU].rlim_max) {
                ...
                __group_send_sig_info(SIGKILL, SEND_SIG_PRIV, tsk);
---
 fs/proc/base.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/proc/base.c +0 -0
index 3ce5ae9..5891360 100644

fs/proc/base.c struct limit_names { · line 467

Quoted 8 lines
fs/proc/base.c +1 -1
@@ -461,7 +461,7 @@ struct limit_names {
 };
 
 static const struct limit_names lnames[RLIM_NLIMITS] = {
-	[RLIMIT_CPU] = {"Max cpu time", "ms"},
+	[RLIMIT_CPU] = {"Max cpu time", "seconds"},
 	[RLIMIT_FSIZE] = {"Max file size", "bytes"},
 	[RLIMIT_DATA] = {"Max data size", "bytes"},
 	[RLIMIT_STACK] = {"Max stack size", "bytes"},

Yup, thanks!