Skip to content

Parse wildcards in genfscon rules #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lex.l
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ userdebug_or_eng { return USERDEBUG_OR_ENG; }
[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\/[0-9]{1,2} { yylval->string = xstrdup(yytext); return IPV4_CIDR; }
([0-9A-Fa-f]{1,4})?\:([0-9A-Fa-f\:])*\:([0-9A-Fa-f]{1,4})?(\:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})? { yylval->string = xstrdup(yytext); return IPV6; }
([0-9A-Fa-f]{1,4})?\:([0-9A-Fa-f\:])*\:([0-9A-Fa-f]{1,4})?(\:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})?\/[0-9]{1,3} { yylval->string = xstrdup(yytext); return IPV6_CIDR; }
\"[a-zA-Z0-9_\.\-\:~\$\[\]\/@]*\" { yylval->string = xstrdup(yytext); return QUOTED_STRING; }
\"[a-zA-Z0-9_\.\-\:~\$\[\]\/@\*\?]*\" { yylval->string = xstrdup(yytext); return QUOTED_STRING; }
\-[\-ldbcsp][ \t] { return FILE_TYPE_SPECIFIER; }
\( { return OPEN_PAREN; }
\) { return CLOSE_PAREN; }
Expand Down
4 changes: 4 additions & 0 deletions tests/sample_policy_files/uncommon.te
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,7 @@ optional_policy(`
filetrans_pattern(foo_t, bar_run_t, baz_run_t, dir, ``"interface"'')

allowxperm src_t tgt_t: netlink_route_socket nlmsg { RTM_GETROUTE 0x44 };

# RFC for new genfscon wildcard support
genfscon sysfs "/sys/devices/*/wakeup/*/uevent" -- gen_context(u:r:some_context, s0)
genfscon sysfs "/sys/devices/*/wakeup/?/uevent" -- gen_context(u:r:some_context, s0)
Loading