[apparmor] [patch 13/18] parser: add rttime rlimit support

Steve Beattie steve at nxnw.org
Thu Jan 16 22:06:21 UTC 2014


This patch adds support for the rttime rlimit (aka RLIMIT_RTTIME),
available since the 2.6.25 kernel, according to the getrlimit(2)
man page; see that man page for more details on this rlimit.
An acceptance test is also added.

Signed-off-by: Steve Beattie <steve at nxnw.org>
---
 parser/parser_misc.c                            |    3 +++
 parser/parser_yacc.y                            |    1 +
 parser/tst/simple_tests/rlimits/ok_rlimit_18.sd |    7 +++++++
 3 files changed, 11 insertions(+)

Index: b/parser/parser_misc.c
===================================================================
--- a/parser/parser_misc.c
+++ b/parser/parser_misc.c
@@ -175,6 +175,9 @@ static struct keyword_table rlimit_table
 #ifdef RLIMIT_RTPRIO
 	{"rtprio",		RLIMIT_RTPRIO},
 #endif
+#ifdef RLIMIT_RTTIME
+	{"rttime",		RLIMIT_RTTIME},
+#endif
 	/* terminate */
 	{NULL, 0}
 };
Index: b/parser/parser_yacc.y
===================================================================
--- a/parser/parser_yacc.y
+++ b/parser/parser_yacc.y
@@ -764,6 +764,7 @@ rules: rules TOK_SET TOK_RLIMIT TOK_ID T
 			tmp = strtoll($6, &end, 0);
 			switch (limit) {
 			case RLIMIT_CPU:
+			case RLIMIT_RTTIME:
 				if (!end || $6 == end || tmp < 0)
 					yyerror("RLIMIT '%s' invalid value %s\n", $4, $6);
 				if (*end == '\0' ||
Index: b/parser/tst/simple_tests/rlimits/ok_rlimit_18.sd
===================================================================
--- /dev/null
+++ b/parser/tst/simple_tests/rlimits/ok_rlimit_18.sd
@@ -0,0 +1,7 @@
+#
+#=DESCRIPTION simple realtime time rlimit test
+#=EXRESULT PASS
+
+profile rlimit {
+  set rlimit rttime <= 60minutes,
+}




More information about the AppArmor mailing list