Commit graph

330 commits

Author SHA1 Message Date
Steve Beattie
030d97e3f1 Merge from r1430: fix for LP: #599450
Changes the table resizing so that there is always sufficient high
entries in the table, preventing bounds violations from occurring.

Nominated-by: John Johansen <john.johansen@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2010-07-24 16:16:14 +02:00
Steve Beattie
0eb5d7c050 Merge from r1429: combine the two separate table resize code segments
into a single functionally equivalent segment.

Nominated-by: John Johansen <john.johansen@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2010-07-24 16:09:25 +02:00
Steve Beattie
1c1de08f11 Partial merge r1419: add the -p flag to support the output of
flattened profiles.

Submitted-by: John Johansen <john.johansen@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2010-07-17 18:39:37 -07:00
Steve Beattie
1ad455c6da Merge r1385: Fix memory leak during dfa minimization.
Nominated-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-By: Marc Deslauriers <marc.deslauriers@canonical.com>
2010-07-13 16:36:47 -07:00
Steve Beattie
b5c8c2bdaf Merge r1379: Fix leaking file descriptors on included files.
Nominated-by: Steve Beattie <sbeattie@ubuntu.com>
Acked-By: Marc Deslauriers <marc.deslauriers@canonical.com>
2010-07-13 16:31:57 -07:00
Steve Beattie
ac1a585bbe Merge from trunk rev 1424: Move expression tree node labeling into expr
node themselves to reduce memory usage and make node labeling per dfa
rather than global.

Nominated-by: John Johansen <john.johansen@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2010-07-12 15:53:51 -07:00
Steve Beattie
8187d02864 Merge in rev 1422 from trunk: Cleaning up the sets firstpos, lastpos,
and followpos early reduces peak memory usage.

Nominated-by: John Johansen <john.johansen@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
2010-07-12 15:28:26 -07:00
Steve Beattie
8525087270 Merge in r1413 and r1418: report correct filename/line number on errors
in the parser.

r1413 Nominated-by: Kees Cook <kees@ubuntu.com>
r1413 Acked-By: Steve Beattie <sbeattie@ubuntu.com>
r1418 Nominated-by: Steve Beattie <sbeattie@ubuntu.com>
r1418 Acked-By: Kees Cook <kees@ubuntu.com>
r1418 Acked-By: John Johansen <john.johansen@canonical.com>
2010-06-25 12:58:17 -07:00
Steve Beattie
21875a520d Fix leaking file descriptors on included files. 2010-03-12 01:50:26 -08:00
Steve Beattie
4094043011 Fix up some testcase description fields 2010-03-10 21:38:10 -08:00
John Johansen
04a872f927 Add some new profile flag tests to validate parsing of the new flags
controlling nameresolution.
2010-03-10 17:00:24 -08:00
Steve Beattie
69d59f80ed Don't (un)load flattened hats on removal, as the kernel pulls them out
automatically (and the parser emits an error due to this).
2010-03-09 01:38:12 -08:00
Steve Beattie
ebe59ca483 Add a simple 'cx' mode testcase. I *think* I'm specifying it correctly. 2010-03-08 22:28:22 -08:00
Steve Beattie
fc669861fe Yuck, fix up bogus type conversions. Also fix up some PDEBUG statements,
to make debugging why things are going wrong in specific examples
easier.
2010-03-08 21:49:16 -08:00
Steve Beattie
61c61f9aab Add some unit tests for processunquoted() -- sadly it handles octals
fairly wrong. Need to fix, but not tonight. Le sigh
2010-03-08 20:38:54 -08:00
John Johansen
5709d94710 Add the ability to control how path mediation is done at the profile level 2010-02-17 12:21:52 -08:00
Kees Cook
4f5686901b include *.dpkg-bak in files to ignore 2010-02-16 12:56:04 -08:00
John Johansen
725328c209 Allow for a location to alias to multiple locations. Ie.
alias / -> /rofs,
alias / -> /rwfs,
2010-02-12 13:51:27 -08:00
John Johansen
ee00b0cea2 Update aliases so that they apply properly to profile names.
Instead of updating the profile name, allow a profile to have multiple
alternate names.  Aliases are now added as alternate names and matched
through the xmatch dfa.
2010-02-12 13:49:58 -08:00
John Johansen
eafddd3cea Fix alias to keep old rule and add new one instead of updating old rule.
Alias was broken because it when an alias was made the old path was completely
removed and there was no way to specify it.  Update it so aliases just add
an new duplicate rule instead.
2010-02-12 13:46:55 -08:00
John Johansen
94b2a345f2 Fix -S flag so the profile can be dumped to stdout again
The changes to the loader permission logic broke the -S flag, so update
the test so that we can dump out the profile again.
2010-02-12 13:44:00 -08:00
John Johansen
8dd795dec1 Rework the partitioning to take advantage of Partitions now being a list 2010-01-31 23:21:00 -08:00
John Johansen
8bcfa1a32f Move partitions from using sets to lists as this is a better match
for what is being done.
2010-01-31 23:19:54 -08:00
John Johansen
e984b6ff74 Seperate Partition definition for States. This is a small step to cleaning
up the code
2010-01-31 23:18:14 -08:00
John Johansen
1179c1a42c Improve partitioning performance slightly by inserting new partitions
imediately after the current partition being considered, instead of
at the back of the parition list.  This does two things, it makes it
more likely the data is in cache, and it also in general results in
more partitions being created in a single pass.
2010-01-31 23:12:33 -08:00
John Johansen
80c7ee74a2 Speedup transition table compression. This is a basic improvement and
not an algorithmic improvement.  It does the same basic algorithm of
test until it can insert the data, but instead of only tracking the
first free entry (and recomputing it each pass).  It tracks all
free entries reducing the number of comparisons done and the table
grows in size.

This may actually result in a small loss on small tables, but is a win
for larger tables.
2010-01-27 17:20:13 -08:00
John Johansen
f9906a9584 Update hash calculation
Update the hash calculation to guarentee that states with a different
number of transition entries will be placed in seperate partitions.

This will allow for a better character transition based state comparison.
2010-01-20 05:10:38 -08:00
John Johansen
91dd7527d9 Dfa minimization and unreachable state removal
Add basic Hopcroft based dfa minimization.  It currently does a simple
straight state comparison that can be quadratic in time to split partitions.
This is offset however by using hashing to setup the initial partitions so
that the number of states within a partition are relative few.

The hashing of states for initial partition setup is linear in time.  This
means the closer the initial partition set is to the final set, the closer
the algorithm is to completing in a linear time.  The hashing works as
follows:  For each state we know the number of transitions that are not
the default transition.  For each of of these we hash the set of letters
it can transition on using a simple djb2 hash algorithm.  This creates
a unique hash based on the number of transitions and the input it can
transition on.  If a state does not have the same hash we know it can not
the same as another because it either has a different number of transitions
or or transitions on a different set.

To further distiguish states, the number of transitions of each transitions
target state are added into the hash.  This serves to further distiguish
states as a transition to a state with a different number of transitions
can not possibly be reduced to an equivalent state.

A further distinction of states is made for accepting states in that
we know each state with a unique set of accept permissions must be in
its own partition to ensure the unique accept permissions are in the
final dfa.

The unreachable state removal is a basic walk of the dfa from the start
state marking all states that are reached.  It then sweeps any state not
reached away.  This does not do dead state removal where a non accepting
state gets into a loop that will never result in an accepting state.
2010-01-20 03:32:34 -08:00
Jamie Strandboge
d98c8ae8b5 add commented, but blank tunables/alias
profiles/apparmor.d/tunables/global: include tunables/alias
parser/apparmor.d.pod: add alias rules and home.d. clean up
 HOMEDIRS
2010-01-11 14:19:35 -06:00
Steve Beattie
b8b2b48949 Add long optimization option along with case-insensitive help options 2010-01-08 14:33:35 -08:00
John Johansen
636ee4a11a Update option parsing for help to add in Short flag form and Optimize
help.
2010-01-08 14:04:56 -08:00
John Johansen
fe08d62e91 Abort if bad option is passed to optimize option parsing 2010-01-08 12:48:10 -08:00
John Johansen
d87145ad23 Update trans table reporting to include some statistics 2010-01-08 05:29:25 -08:00
John Johansen
dce395e7ad Add basic controls for dfa optimization 2010-01-08 04:30:56 -08:00
John Johansen
926b0c72e8 Update the output of transtable creation 2010-01-08 03:18:59 -08:00
John Johansen
4f044e753c Add basic dfa stats and debug dumps for
equivelence classes
expr tree (add stats, update parser switch)
dfa
transition table
2010-01-08 02:17:45 -08:00
John Johansen
b69c5e9972 Fix -S so that it implies there is no kernel_load 2010-01-07 18:31:44 -08:00
John Johansen
fc597b736b Update what is considered an unprivileged op, so that only actual loading
and writing of cache trigger the privilege messages
2010-01-07 18:20:19 -08:00
John Johansen
56a9fded36 Update parser to allow for multiple debugs dump options 2010-01-07 18:09:37 -08:00
John Johansen
17a67d7227 Update parser to allow for multiple debug dump options via -D or --dump.
This will allow turning on and off various debug dumps as needed.
Multiple dump options can be specified as needed by using multiple
options.
  eg. apparmor_parser -D variables
      apparmor_parser -D dfa-tree -D dfa-simple-tree


The help option has also been updated to take an optional argument
to display help about give parameters, currently only dump is supported.

  eg.  apparmor_parser -h       # standard help
       apparmor_parser -h=dump  # dump info about --dump options

Also Enable the dfa expression tree dumps
2010-01-07 16:21:02 -08:00
Steve Beattie
09ced81ee5 Add debugging reporting for the other capability entry types (audit,
deny).
2010-01-07 15:48:14 -08:00
Steve Beattie
8304b7db87 * disable reading cache files when debugging
* rearrange action ordering so that the symbol table can be dumped
  before and after exapansion
* formatting rearrangement.
2010-01-07 14:44:42 -08:00
Steve Beattie
2f9259a215 Add debugging dump for Set Capabilities. 2010-01-07 14:17:07 -08:00
Steve Beattie
fd07a7b17a Remove obsolete data structure. 2010-01-07 14:15:36 -08:00
Kees Cook
369a280f64 Document the --skip-kernel-load parameter 2010-01-07 10:03:49 -08:00
Kees Cook
8d760811b8 do not load cache when using -S option 2010-01-06 09:04:04 -08:00
Kees Cook
b2952da4bd use ctime for profiles, to detect newly installed profiles 2009-11-11 15:08:09 -08:00
Kees Cook
b4c355e17e actually add caching tests 2009-11-11 11:07:50 -08:00
Kees Cook
4173f0a558 deal with socket types to ignore, handle backward compat for earlier AF_MAX value 2009-11-11 10:58:57 -08:00
Kees Cook
0d2518551f provide kernel version caching, along with ability to test caching subsystem 2009-11-11 10:56:04 -08:00