From cafbfe7cd37018e44ee85fdbfbc24a96b68b06b3 Mon Sep 17 00:00:00 2001 From: John Johansen Date: Fri, 4 Aug 2006 17:14:06 +0000 Subject: [PATCH] [https://bugzilla.novell.com/show_bug.cgi?id=175388] This (updated) patch to trunk adds the m flag to the parser language. The m flag explicitly does -not- conflict with px, ux, or ix. It does not add exec mmap as implicit to inherited execs, as it was asserted that the module should do this. I have not fixed up the testcases to match. --- parser/immunix.h | 4 +++- parser/parser.h | 1 + parser/parser_lex.l | 2 +- parser/parser_misc.c | 9 ++++++++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/parser/immunix.h b/parser/immunix.h index 83ee897c3..c45b7e2ed 100644 --- a/parser/immunix.h +++ b/parser/immunix.h @@ -33,7 +33,8 @@ #define POS_KERN_COD_EXEC_INHERIT (POS_KERN_COD_MAY_LINK + 1) #define POS_KERN_COD_EXEC_UNCONSTRAINED (POS_KERN_COD_EXEC_INHERIT + 1) #define POS_KERN_COD_EXEC_PROFILE (POS_KERN_COD_EXEC_UNCONSTRAINED + 1) -#define POS_KERN_COD_FILE_MAX POS_KERN_COD_EXEC_PROFILE +#define POS_KERN_COD_EXEC_MMAP (POS_KERN_COD_EXEC_PROFILE + 1) +#define POS_KERN_COD_FILE_MAX POS_KERN_COD_EXEC_MMAP #define POS_KERN_COD_NET_MIN (POS_KERN_COD_FILE_MAX + 1) #define POS_KERN_COD_TCP_CONNECT POS_KERN_COD_NET_MIN @@ -60,6 +61,7 @@ #define KERN_COD_EXEC_INHERIT (0x01 << POS_KERN_COD_EXEC_INHERIT) #define KERN_COD_EXEC_UNCONSTRAINED (0x01 << POS_KERN_COD_EXEC_UNCONSTRAINED) #define KERN_COD_EXEC_PROFILE (0x01 << POS_KERN_COD_EXEC_PROFILE) +#define KERN_COD_EXEC_MMAP (0x01 << POS_KERN_COD_EXEC_MMAP) #define KERN_EXEC_MODIFIERS(X) (X & (KERN_COD_EXEC_INHERIT | \ KERN_COD_EXEC_UNCONSTRAINED | \ KERN_COD_EXEC_PROFILE)) diff --git a/parser/parser.h b/parser/parser.h index 145fd06eb..d8f2134e2 100644 --- a/parser/parser.h +++ b/parser/parser.h @@ -107,6 +107,7 @@ struct var_string { #define COD_LINK_CHAR 'l' #define COD_UNCONSTRAINED_CHAR 'u' #define COD_PROFILE_CHAR 'p' +#define COD_MMAP_CHAR 'm' #define OPTION_ADD 1 #define OPTION_REMOVE 2 diff --git a/parser/parser_lex.l b/parser/parser_lex.l index 17577c60b..93a7f4e69 100644 --- a/parser/parser_lex.l +++ b/parser/parser_lex.l @@ -52,7 +52,7 @@ COLON : END_OF_RULE [,] SEPERATOR {UP} RANGE - -MODES [RrWwXxIiLlUuPp] +MODES [RrWwXxIiLlUuPpMm] WS [[:blank:]] NUMBER [[:digit:]]+ ID [^ \t\n"^!] diff --git a/parser/parser_misc.c b/parser/parser_misc.c index be693402c..543162ea8 100644 --- a/parser/parser_misc.c +++ b/parser/parser_misc.c @@ -335,9 +335,14 @@ int parse_mode(const char *str_mode) } break; + case COD_MMAP_CHAR: + PDEBUG("Parsing mode: found MMAP\n"); + mode |= KERN_COD_EXEC_MMAP; + break; + case COD_EXEC_CHAR: PDEBUG("Parsing mode: found EXEC\n"); - yyerror(_("Invalid mode, 'x' must be preceded by exec qualifier 'i', 'u' or 'p'")); + yyerror(_("Invalid mode, 'x' must be preceded by exec qualifier 'i', 'p', or 'u'")); break; default: @@ -518,6 +523,8 @@ void debug_cod_entries(struct cod_entry *list) printf("u"); if (item->mode & KERN_COD_EXEC_PROFILE) printf("p"); + if (item->mode & KERN_COD_EXEC_MMAP) + printf("%c", COD_MMAP_CHAR); if (item->name) printf("\tName:\t(%s)\n", item->name);