Commit graph

561 commits

Author SHA1 Message Date
John Johansen
ee3f92d459 add test for the renaming of a directory over and existing directory. Remove the patch that does the same from for-mainline since it is no longer necessary 2007-03-23 17:33:25 +00:00
John Johansen
e981282bd4 add tests for mediate of the creation of the symlink link file. Remove the patch from for-mainline since it is no longer necessary 2007-03-23 17:31:32 +00:00
Steve Beattie
c7c33eee45 Kill no longer needed filesystem type #defines; checking MS_NOUSER
obviates the need for them (and they're no longer refeenced).
2007-03-23 17:23:15 +00:00
John Johansen
be282c5eba fix a subtle race in freeing a profile.
AppArmor's use of RCU is non-standard in that the profile is RCU protected
and ref count protected at the same time.  A race can occur between
removing a task removing profile reference from the subdomain and another
task getting a reference to the profile from the subdomain.

Task A					Task B
					tmp = read subdomain->profile
subdomain->profile = NULL
aa_put_profile(subdomain->profile) <- ref_count goes to 0
					aa_get_profile(tmp)
profile is put on rcu_callback list
					aa_put_profile(profile)
					profile is put on rcu_callback list
					again using same rcu_head

The problem lies in the subtle distinction of the profile reference count
held by a subdomain, vs. all other profile reference counts.

The reference count held by the subdomain is an RCU protected reference
count so the profile it references can only be freed after an rcu cycle.
The reference being only read side RCU protected can be read at any
point is the rcu cycle before the subdomain->profile reference is updated.
The updating of the profile reference count is not atomic to this
resulting in the race.

Using seperate put functions for the rcu protected subdomain->profile
reference vs other profile references, where the rcu put adds the profile
to the rcu callback list and the regular put frees the profile directly
won't work either since rcu reference count has the same race.
This just results in the profile being freed twice instead of putting the
profile on the rcu callback list twice.
2007-03-23 17:01:29 +00:00
John Johansen
4d9fde38db Allow capability to stack under AppArmor. This is a fake stacking
however in that the capability hooks never get called.  This shouldn't
be a big problem since AppArmor already composes capability through
use of common cap.

This just prevents the user from having to deal with/understand the
error message that occurs when the capability module fails to stack
with AppArmor.
2007-03-23 16:41:43 +00:00
John Johansen
399561b10d Allow the dazukoo module to stack under AppArmor 2007-03-23 16:38:18 +00:00
John Johansen
93bce9f127 Use the MS_NOUSER flag to detect mediated filesystems. This is better
than the VALID_FS_CHECK because it is simpler and can account for
all filesystem types that shouldn't be mediated.  Where the old
VALID_FS_CHECK would fail for filesystem not in its list.
2007-03-23 16:37:40 +00:00
John Johansen
0df473374a Fix dir rename bug. There was a bug where if directory A already existed
a rename of directory B to directory A would always succeed even if the
profile didn't allow write access on directory A.
2007-03-23 16:34:51 +00:00
John Johansen
3e9c934528 Add mediation of symlink file creation. This doesn't mediate that the
path that the link points to is valid.  Rather it checks whether the
profile allows the creation of the link file.
2007-03-23 16:32:07 +00:00
John Johansen
7c3e6cf525 A small optimization used to calculate the size of the pathname 2007-03-23 16:29:29 +00:00
John Johansen
0060caec1a Fix a race between path lookup and removal of " (deleted)" that could
result in incorrect removal of " (deleted)" from the pathname.

The race is as follows:
the path contains " (deleted)", which is unlikely but valid
during path lookup the path is valid
after path lookup before the deleted test the dentry is unhashed
the deleted test now succeeds but the pathname never had " (deleted)"
appended by d_path.  The paths " (deleted)" string is removed
and an incorrect path is returned
2007-03-23 16:28:10 +00:00
Andreas Gruenbacher
38fe3a0bf6 Add further locking improvement proposal. 2007-03-22 22:34:19 +00:00
Matt Barringer
19efd07a71 Fixed formatting. 2007-03-22 20:42:36 +00:00
Andreas Gruenbacher
6814e22b73 Add changes missing in rcu-task-context-2.diff 2007-03-22 13:05:13 +00:00
Andreas Gruenbacher
98f6ce46d1 A cleanup in aa_change_hat() 2007-03-22 10:10:59 +00:00
Andreas Gruenbacher
504721f4f4 Add rcu-task-context-2.diff and no-inline-aa_change_task_context.diff. 2007-03-22 09:38:56 +00:00
Andreas Gruenbacher
c377d49bf9 Add comment 2007-03-22 08:20:24 +00:00
Matt Barringer
371f984e09 Initial checkin of the netdomain test suite. It requires
dejagnu (which, in turn, requires tcl).
2007-03-21 22:27:37 +00:00
John Johansen
f6244becd4 use rcu for aa_task_context 2007-03-21 22:21:13 +00:00
Jesse Michael
fd5aa90427 remove last vestiges of Immunix::Ycp from yast2-apparmor 2007-03-21 16:53:41 +00:00
Jesse Michael
360ffc756e re-enable warnings for the utils perl modules and fix a couple initial
problems exposed by that.  there are likely to be more fixes coming.
2007-03-21 16:49:39 +00:00
Jesse Michael
e5ac6de656 fix typo in fork tracking code that could result in applications that
are currently running while logprof/genprof is used being left in the 
null-complain profile instead of being moved to the profile the user
has just specified.  

the profiles are updated correctly though, so if the application is 
stopped and restarted, it will be confined by the appropriate profile.
2007-03-21 15:54:57 +00:00
Steve Beattie
5ec36e6c2b I cretanily maek lost fo tyops, smoetimes. 2007-03-21 02:01:49 +00:00
Seth Arnold
263843da4b typo fix; usernmae --> username 2007-03-20 22:04:21 +00:00
Jesse Michael
d8ae032328 used perltidy to clean up the formatting for the perl scripts in the
utils package and manually fixed some places where perltidy's
reformatting made it harder to read.  the options used were--

-i=4    # 4-space indentation
-l=0    # unlimited line length (for now)
-pt=2   # slightly tightened parens
-ce     # cuddled elses
-nolq   # don't outdent long quotes
-nsfs   # don't add spaces in front of semi-colons in for ( ) statements
-isbc   # only indent block comments that have whitespace in front of them
-otr    # don't place a break between a comma and an opening brace

the code will be refactored to make it possible to switch to using 
80-column line-breaks without resorting to really nasty formatting 
constructs.
2007-03-20 21:58:38 +00:00
Andreas Gruenbacher
f29097e401 Improved version of the last format string fix 2007-03-20 17:41:36 +00:00
Andreas Gruenbacher
fb62f5c553 Replace force_dir_on_negative_dentry.diff with rename-file-type.diff 2007-03-20 17:39:51 +00:00
Andreas Gruenbacher
d1e9b24234 Drop obsolete audit-unterminated-string.diff, and add apparmor_getprocattr.diff. 2007-03-20 16:10:56 +00:00
Andreas Gruenbacher
96f896c193 Fix warning 2007-03-20 15:56:50 +00:00
John Johansen
78ba031fc7 Add basic script used to convert module/apparmor into kernel patch snapshot 2007-03-19 11:13:05 +00:00
John Johansen
6f03656049 Add brief readme used to explain layout of kernel-patches snapshots 2007-03-19 11:11:05 +00:00
John Johansen
31b181fcf8 update namespace semaphore patch for changes in 2.6.20 2007-03-19 11:10:01 +00:00
John Johansen
9aae261afd remove temporary development branches of the parser 2007-03-19 07:19:04 +00:00
Jesse Michael
7780d79c8d remove last vestiges of Immunix::Ycp in deference to official ycp module 2007-03-19 02:29:47 +00:00
Jesse Michael
c878e09840 fixes for bz #179656 - missing localization in subdomain.pm 2007-03-18 20:25:25 +00:00
Jesse Michael
5b2dd25bb1 revert broken commit. i'll check in the discrete fixes from the last checkin
in a second and then follow those up with the corrected cleanup fixes.
2007-03-18 19:44:57 +00:00
John Johansen
5643deb42e patch to make dfa table numbers match flex table numbers 2007-03-15 22:26:45 +00:00
Steve Beattie
5fe5803aa7 Fix a couple of warnings in the recent trailing slash commit. 2007-03-14 22:35:55 +00:00
John Johansen
e5cced8ba0 change dfa table entry numbering to match flex 2007-03-14 22:02:50 +00:00
John Johansen
ef7a0adff8 change dfa table numbering to match flex 2007-03-14 22:01:16 +00:00
John Johansen
51b25bd3e5 Handle differentation of directories and files via / for the dfa engine.
This causes the dfa engine to not strip trailing /
and to handle /*/ /**/ and /* and /** cases specially so that directories
don't get matched unintentionally

aare       pcre
/foo/* -> /foo/[^/][^/]*	so the dir /foo/ will not match the rule
/foo/** -> /foo/[^/].*
/*/foo -> /[^/][^/]*/foo	so the rule won't match //foo
/**/foo -> /[^/].*/foo

rules that contain more than a * or ** between dir / elements do not
get converted, ie.

/foo*
/foo**
/foo*/
/foo**/
/*foo
/**foo
/*foo/
/**foo/

there is a known case where this patch is incomplete.  When there
exists an alternation that can be empty and * or ** ie.
/{foo,}*
/{foo,*}
2007-03-14 22:00:39 +00:00
Steve Beattie
a39a3b0410 Add tests to openat to test what names apparmor sees when a rename
occurs between the open(dir) and openat(file) calls.
2007-03-14 19:53:10 +00:00
Steve Beattie
94d4ac649e Fixup the openat.sh test as well. 2007-03-13 22:10:45 +00:00
John Johansen
e102bd2651 fixes to issues that came up in updating the regression tests 2007-03-13 21:44:05 +00:00
Steve Beattie
063bb1b26e Fix up some of the patches after I messed them up by incorporating some of their changes. 2007-03-13 18:27:21 +00:00
Jesse Michael
1de5bdbacc fix missing include to silence compiler warnings 2007-03-13 16:52:28 +00:00
Jesse Michael
505155a48e use the appropriate pam_modutil_* wrapper functions if possible 2007-03-13 16:29:03 +00:00
Steve Beattie
30a2252adf Add some basic tests for openat(). Need to add tests that delete the
opened directory before the openat() call occurs.
2007-03-13 11:57:36 +00:00
Steve Beattie
3f32351793 Misc cleanups. 2007-03-13 11:32:04 +00:00
Jesse Michael
c0b7fc812d add minor cleanup to match up with recommendations from the kernel
CodingStyle documentation
2007-03-12 18:39:53 +00:00