Commit graph

1757 commits

Author SHA1 Message Date
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
Steve Beattie
b19f77d5c7 This patch adds toplevel support for creating release and snapshot
tarballs and converts some of the common/Make.rules targets to get
version information from bzr. As part of this, the tarball generation
creates a .stamp_rev file in the common directory which contains both
the name of the bzr repo exported from as well as the revision.
2010-10-07 15:25:21 -07:00
Steve Beattie
7e0969bf82 From: Jesse Michael <jesse@lonelyrhinoceros.com>
This just adds prototypes to all functions to make further cleanup
slightly easier by getting perl to complain if not enough args are
passed to a function.  Perl doesn't appear to complain about this in
every case even with prototypes, which is kind of annoying.
2010-10-06 13:06:05 -07:00
Steve Beattie
8e51a7b31e From: Jesse Michael <jesse@lonelyrhinoceros.com>
One of the uses of eval { } wasn't checking $@ for errors, so if
something bad happened, it'd be silently ignored.  This just adds in
an extra check to die if we hit a failure.
2010-10-06 12:21:56 -07:00
Steve Beattie
317197a6b5 This patch modifies the xattr regression test to use a separate
loopback mounted filesystem to operate on, to guarantee that the mount
option user_xattr is enabled (it's disabled by default on Ubuntu).

With this change, a number of the user xattr testcases that were
expected to pass but weren't started working; however, some of the
ones that were failing as expected are now passing. I've touched up
the expectations as well.
2010-09-30 10:49:26 -07:00
Jamie Strandboge
39902eff28 abstractions/ubuntu-email: adjustment for ever-changing path of thunderbird
(LP: #648900)
2010-09-27 08:47:08 -05:00
Jamie Strandboge
2cb3463cc8 add ubuntu-integration-xul for firefox-notify 2010-09-23 08:16:56 -05:00
Steve Beattie
60b014667a When loading without the 2.4 compatibility patch, the parser needs the
following patch or it will explode when it can't find the "features"
file.

Bug: https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/626984
From: Kees Cook <kees@ubuntu.com>
2010-09-16 10:24:50 -07:00
Steve Beattie
d7fde9d109 Reorders the timstamp check to move it to the beginning of the
script and add an additional sleep before the parser invocation that
generates the cache file for the first time, to avoid failures in the
"Profiles are cached when requested:" test on ext3 and other filesystems
without fine-grained enough timestamps.
2010-09-15 14:28:35 -07:00
Kees Cook
72701bd2a0 drop duplicate extern from rev 1496 2010-09-15 12:24:12 -07:00
Jamie Strandboge
6b81b50d36 ubuntu-browsers.d/multimedia: allow lpr and lpstat for printing from flash
plugin
2010-09-15 08:20:21 -05:00
Kees Cook
862836548d Fix write_cache to not be a privileged operation so that the caching tests
can be added to the build. Update caching tests to detect non-ns-resolution
filesystems and back off on the timing test.
2010-09-14 12:45:34 -07:00
Kees Cook
feb70284bc Effectively revert revno 1471, and fix the misdetected error condition
so that caching will work again without needing kernel_load.
2010-09-14 12:38:38 -07:00