Commit graph

1569 commits

Author SHA1 Message Date
John Johansen
29c6f7e3ac Re-enable the ability to invoke remove-unreachable-states.
Now that removing unreachable states is not on by default re-enable the
ability to turn it on.
2010-11-09 11:56:58 -08:00
John Johansen
14e7d94701 Add ability to dump unique permission sets 2010-11-09 11:56:28 -08:00
John Johansen
318351376c Add the ability to dump NodeSet to dfa state mapping 2010-11-09 11:55:40 -08:00
John Johansen
af8b3b84ef Use nodemap.size() to label state node
The nodemap.size() increases by one with each node added, every time we
add a state we label it so this provides the proper labeling without needing
a separate variable.
2010-11-09 11:55:05 -08:00
John Johansen
b64921a5ec Add tracking of the node set (proto state) max, and average size 2010-11-09 11:54:20 -08:00
John Johansen
f1a3f66515 Add -D stats and -D progress options
add short options to turn on all stats, and all progress indicators,
also allow adding "no-" prefix to dump options to allow subtracting
individual options when short options are used.

eg.
  -D stats -D no-expr-simplify
2010-11-09 11:53:38 -08:00
John Johansen
6b4dff4bee Move -O and -D options and documentation into tables
Move the -O and -D options into tables, that keep the option and its
description.  This will help keep the options consistent and the description
up to date, as all information is now in one place.

Previously the options, and descriptions kept getting out of sync as all
relavent parts were spread out.
2010-11-09 11:52:38 -08:00
John Johansen
de2dec2bec Reduce the number of -O flag options by factoring our no- prefix
Factor out the "no-" prefix so that optimization flags and their no-
counter parts are handled by the same code.
2010-11-09 11:50:13 -08:00
John Johansen
fae7cac15c Rename trans-XXXX transition to compress- compression
trans- isn't a very good name for this phase of compilation.  It is the
compression phase, rename to trans- to compress- to reflect this.
2010-11-09 11:49:18 -08:00
John Johansen
8972e4f577 Generic cleanup pass of -D and -O options 2010-11-09 11:48:53 -08:00
John Johansen
0ad84d93f9 Factor out expr tree rotation into its own function 2010-11-09 11:48:29 -08:00
John Johansen
ac9553de19 Rework tests against Epsnodes to compare to the singleton
Dynamic casts are slower than plain comparisons so rework epsnode comparison
to use comparisons to the singleton epsnode instead of dynamic_casts.
2010-11-09 11:47:37 -08:00
John Johansen
6801346b81 Add cnode class as a base class of all expr nodes that contain character info 2010-11-09 11:46:05 -08:00
John Johansen
04d6c727e1 Add a leafnode class to clearly indicate what node types are leaf nodes 2010-11-09 11:44:26 -08:00
John Johansen
aec77cecde Move nodes around to put one child node together and two child nodes together 2010-11-09 11:38:20 -08:00
John Johansen
0f26d8f097 Further split up innernode, to be able to better identify the types of
inner nodes.

This is part of a serious of patches to cleanup expr nodes, by separating
out functionality and reducing the number of dynamic casts.
2010-11-09 11:36:14 -08:00
John Johansen
cb2ebc3102 Rework the depth first traversal of expr trees, to remove the use of the
unneeded visited table, and give a little speed up and cleanup.
2010-11-09 11:35:38 -08:00
John Johansen
d2581332db This is part of a serious of patches to cleanup expr nodes, by separating
out functionality and reducing the number of dynamic casts.
2010-11-09 11:34:59 -08:00
John Johansen
adb0973d61 Update Makefile to pass CFLAGS into libapparmor_re 2010-11-09 11:33:40 -08:00
John Johansen
7f987f93d1 As from a library pov they should be seperately callable fns, and this will
help reduce peak memory usage in some cases.

Also disbale remove_unreachable, as the current dfa code isn't generating
unreachable states, and minimization removes any states that are connected
but redundant.
2010-11-09 11:28:56 -08:00
John Johansen
c5fa0e98b3 Reference counting of Nodes exists to shared the special accept nodes that
hold permission information.  We currently keep them in a table with a
refcount so that they don't go away, until we delete the table.

We can simulate this by getting rid of the refcount, and making dup and release
virtual, and overriding it for the special accept nodes.
2010-11-09 11:28:22 -08:00
John Johansen
a84844cea5 Do not use permission hashing for minimization by default. While this
improves minimization performance, it can slow down total creation time and
result in larger compressed dfas.

This is because it results in the dfa not being completely minimized which
with the current O(n2) dfa table compression algorithm can result in slower
compressed dfa generation.
2010-11-09 11:27:36 -08:00
John Johansen
51f443c7b6 Update state progress/stats output to dump the number of accepting
states/partitions occur in the minimized dfa.
2010-11-09 11:26:50 -08:00
John Johansen
c2601dbd30 Cleanup the perm_map as soon as it is no longer needed. Cleaning up the map
before the end of the functions reduces the peak memory of the function
2010-11-09 11:26:18 -08:00
John Johansen
2fb64fa85e When hashing Nodes ensure that cases.otherwise == NULL is treated the same
as pointing to the nonmatching state.  Having this mix shouldn't currently
exist but adding the extra check makes the code more robust.
2010-11-09 11:25:44 -08:00
John Johansen
4e80416a4f Do permission accumulation in dfa minimization. This is necessary if accept
states with different permissions are to ever share a partition.
2010-11-09 11:24:51 -08:00
John Johansen
a949b075b4 The dfa flags currently are a weird mix of position and negative assertions.
Its cleaner just to have them all assert one way and let the cmd line
options apply them correctly.
2010-11-09 11:23:45 -08:00
John Johansen
36e99af7fb Split dfa minimizing hashing into two seperately controllable hashes. The
first hash does hashing on state just state transitions, which always results
in a performance improvement.

The second does hashing based off of accept permissions, which can create
more initial states but can result in not being able to achieve a true
minimum dfa.  This can also lead to slowing down total dfa creation because
while minimization, compression can take longer if the dfa isn't completely
minimized.

permission hashing is currently required, as minimization does not accumulate
redundant Node permissions.
2010-11-09 11:22:54 -08:00
John Johansen
9b99039fdb Convert Nodemap comparision to use a hash value. This uses a little more
memory than just using the NodeSet size to short circuit comparison but it
improves on the case where compared sets have the same size.  It is possible
that this will slow down small dfa generation slightly but the trade off for
large dfa's (which are the slow ones to generate) is worth it.

This results in another performance bump over using the NodeSize is NodeSet
comparison, and the amount of improvement increases with larger dfas
2010-11-09 11:20:08 -08:00
John Johansen
344e11a539 Use set size as part of set comparison, short circuiting comparing sets
of pointers when it isn't necessary.  This results in a nice little
performance increase in dfa creation.

This is more of a proof of concept patch, and is replaced by the next
patch which does better short circuiting via hashing
2010-11-09 11:18:46 -08:00
John Johansen
ca1d891799 This patch reworks the internal structures used to compute the dfa. It is on
the large side, and I experimented with different ways to split this up but in
the end, anything I could do would result in a series of dependent patches
that would require all of them to be applied to get meaningful functional
changes.

The patch structural reworks the dfa so that
- there is a new State class, it takes the place of sets of nodes in the
  dfa, and allows storing state information within the state
- removes the dfa transition table, which mapped sets of nodes to a
  transition table, by moving the transition into the new state class
- computes dfa state permissions once (stored in the state)
- expression tree nodes are independent from a created dfa.  This allows
  computed expression trees, and sets of Nodes (used as protostates when
  computing the dfa).  To be managed independent of the dfa life time.
  This will allow reducing the amount of memory used, in the future,
  and will also allow separating the expression tree logic out into
  its own file.


The patch has some effect on reducing peak memory usage, and computation
time.  The actual amount of reduction is dependent on the number of states
in the dfa with larger saving being achieved on larger dfas.  Eg. for
the test evince profile I was using it makes the parser about 7% faster with a
peak memory usage about 12% less.

This patch changes the initial partition hashing of minimization resulting
in slightly smaller dfas.
2010-11-09 11:14:55 -08:00
Kees Cook
485df894ab This fixes a few typos in documentation that lintian noticed. 2010-11-04 14:27:30 -07:00
Kees Cook
38cefc358a add symlink for manpage as well 2010-11-04 13:36:38 -07:00
Kees Cook
6d2d55057c retain one backward compat symlink for the heavily-documented "apparmor_status" command 2010-11-04 11:52:33 -07:00
Kees Cook
4b9a2683ed include release version in manpage 2010-11-04 11:32:06 -07:00
Kees Cook
06b4d7db0d Make the manpage release distro agnostic though configurable. 2010-11-03 23:49:41 -07:00
Kees Cook
225c779225 This patch cleans up the testsuite output harder, and removes a bashism in
another clean target.
2010-11-03 17:04:43 -07:00
Kees Cook
6717e29909 Here is a patch to standardize on all utils using the "aa-" prefix instead
of a mix of symlinks to non-prefixed comands, and "apparmor_" prefixed
commands.

This also refactors the manpage generation slightly since we no longer
need special cases for the manpages, and drops aa-eventd from the default
list of tools to install (it also lacks a manpage).
2010-11-03 17:03:52 -07:00
Jamie Strandboge
7f1b117675 abstractions/ubuntu-browsers: adjust sensible browser to use Pixr 2010-10-22 07:43:23 -05:00
John Johansen
632b6aaf1f Add the compatibility patches for the 2.6.36 upstream kernel version of
AppArmor.
2010-10-21 10:58:18 -07:00
John Johansen
3e8a61d626 Move kernel patches for old versions of the module to deprecated 2010-10-21 10:56:01 -07:00
Jamie Strandboge
fb418015e3 add /usr/bin/emacs-snapshot-gtk PUxr to ubuntu-browsers.d/text-editors 2010-10-21 09:03:09 -05:00
Steve Beattie
db30c2bc19 This patch fixes the common/Make.rules file to not do bzr versioninfo
on every make invocation; instead it defines a command as a variable
that then is evaluated into shell variables when needed.
2010-10-18 12:12:37 -07:00
Steve Beattie
f6b043b434 Bump version up to prevent confusion at the request of jjohansen. 2010-10-18 11:18:03 -07:00
Steve Beattie
abcd1f2975 This patch makes the parser's makefile honor CFLAGS that have been
exported in the environment. Without it, merely setting the CFLAGS
environment variable would not affect the compilation of the parser,
though it was still possible to override it by passing the variable
as an argument (e.g. make all CFLAGS="-Oinsane -Wextra-special").

It also makes the default CFLAGS for the parser consistent with
the default for the C++ dfa library, and passes the flags on to
the library.

An audit of the other bits of C showed that they either supported
CFLAGS during configure or were otherwise honoring CFLAGS when set
as environment variable.
2010-10-09 14:15:59 -07:00
Steve Beattie
5849c7ab78 This patch removes a bunch of crufty old stuff, including some
subversion deritrus, the slackware tarball build support as well as
the aborted attempt to make auto building debian packages.
2010-10-07 15:42:36 -07:00
Steve Beattie
19fa8a3ed9 This patch takes the revision info from the stamp file if things are
being built outside of a working bzr tree.
2010-10-07 15:39:55 -07:00
Steve Beattie
875a06b9d7 This corrects a couple of build issues on openSUSE, as the version
of rpm there no longer defines %{_host_vendor}.
2010-10-07 15:38:31 -07:00
Steve Beattie
c90b199488 This patch moves the overall version definition of the software out of
the common/Make.rules file into common/Version so that libapparmor's
configure.in can make use of it, meaning there's one less thing to
adjust when updating the version. It also bumps the trunk version
from 2.5 to 2.5.90 in (perhaps excessively long) preparation for the
2.6.0 release, and to indicate that it's newer than the 2.5.x branch.
2010-10-07 15:37:30 -07:00
Steve Beattie
0e1158c71d This patch adds a toplevel target to add a bzr tag in a consistent
format.
2010-10-07 15:33:11 -07:00