11 Aug, 2010
2 commits
-
* 'writable_limits' of git://decibel.fi.muni.cz/~xslaby/linux:
unistd: add __NR_prlimit64 syscall numbers
rlimits: implement prlimit64 syscall
rlimits: switch more rlimit syscalls to do_prlimit
rlimits: redo do_setrlimit to more generic do_prlimit
rlimits: add rlimit64 structure
rlimits: do security check under task_lock
rlimits: allow setrlimit to non-current tasks
rlimits: split sys_setrlimit
rlimits: selinux, do rlimits changes under task_lock
rlimits: make sure ->rlim_max never grows in sys_setrlimit
rlimits: add task_struct to update_rlimit_cpu
rlimits: security, add task_struct to setrlimitFix up various system call number conflicts. We not only added fanotify
system calls in the meantime, but asm-generic/unistd.h added a wait4
along with a range of reserved per-architecture system calls. -
* 'for-linus' of git://git.infradead.org/users/eparis/notify: (132 commits)
fanotify: use both marks when possible
fsnotify: pass both the vfsmount mark and inode mark
fsnotify: walk the inode and vfsmount lists simultaneously
fsnotify: rework ignored mark flushing
fsnotify: remove global fsnotify groups lists
fsnotify: remove group->mask
fsnotify: remove the global masks
fsnotify: cleanup should_send_event
fanotify: use the mark in handler functions
audit: use the mark in handler functions
dnotify: use the mark in handler functions
inotify: use the mark in handler functions
fsnotify: send fsnotify_mark to groups in event handling functions
fsnotify: Exchange list heads instead of moving elements
fsnotify: srcu to protect read side of inode and vfsmount locks
fsnotify: use an explicit flag to indicate fsnotify_destroy_mark has been called
fsnotify: use _rcu functions for mark list traversal
fsnotify: place marks on object in order of group memory address
vfs/fsnotify: fsnotify_close can delay the final work in fput
fsnotify: store struct file not struct path
...Fix up trivial delete/modify conflict in fs/notify/inotify/inotify.c.
08 Aug, 2010
1 commit
-
…s/security-testing-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6:
SELINUX: Fix build error.
07 Aug, 2010
2 commits
-
Fix build error caused by a stale security/selinux/av_permissions.h in the $(src)
directory which will override a more recent version in $(obj) that is it
appears to strike only when building with a separate object directory.Signed-off-by: Ralf Baechle
Acked-by: Eric Paris
Signed-off-by: James Morris -
request_key() should return -ENOKEY if the key it constructs has been
negatively instantiated.Without this, request_key() can return an unusable key to its caller,
and if the caller then does key_validate() that won't catch the problem.Signed-off-by: David Howells
Signed-off-by: Linus Torvalds
05 Aug, 2010
2 commits
-
SECURITY_APPARMOR should depend on NET since AUDIT needs
(depends on) NET.Fixes 70-80 errors that occur when CONFIG_NET is not enabled,
but APPARMOR selects AUDIT without qualification. E.g.:audit.c:(.text+0x33361): undefined reference to `netlink_unicast'
(.text+0x333df): undefined reference to `netlink_unicast'
audit.c:(.text+0x3341d): undefined reference to `skb_queue_tail'
audit.c:(.text+0x33424): undefined reference to `kfree_skb'
audit.c:(.text+0x334cb): undefined reference to `kfree_skb'
audit.c:(.text+0x33597): undefined reference to `skb_put'
audit.c:(.text+0x3369b): undefined reference to `__alloc_skb'
audit.c:(.text+0x336d7): undefined reference to `kfree_skb'
(.text+0x3374c): undefined reference to `__alloc_skb'
auditfilter.c:(.text+0x35305): undefined reference to `skb_queue_tail'
lsm_audit.c:(.text+0x2873): undefined reference to `init_net'
lsm_audit.c:(.text+0x2878): undefined reference to `dev_get_by_index'Signed-off-by: Randy Dunlap
Signed-off-by: John Johansen
Signed-off-by: James Morris -
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (48 commits)
Documentation: update broken web addresses.
fix comment typo "choosed" -> "chosen"
hostap:hostap_hw.c Fix typo in comment
Fix spelling contorller -> controller in comments
Kconfig.debug: FAIL_IO_TIMEOUT: typo Faul -> Fault
fs/Kconfig: Fix typo Userpace -> Userspace
Removing dead MACH_U300_BS26
drivers/infiniband: Remove unnecessary casts of private_data
fs/ocfs2: Remove unnecessary casts of private_data
libfc: use ARRAY_SIZE
scsi: bfa: use ARRAY_SIZE
drm: i915: use ARRAY_SIZE
drm: drm_edid: use ARRAY_SIZE
synclink: use ARRAY_SIZE
block: cciss: use ARRAY_SIZE
comment typo fixes: charater => character
fix comment typos concerning "challenge"
arm: plat-spear: fix typo in kerneldoc
reiserfs: typo comment fix
update email address
...
04 Aug, 2010
1 commit
02 Aug, 2010
32 commits
-
Fix build warnings for non-const use of get_task_cred.
Signed-off-by: James Morris
-
Current selinux policy can have over 3000 types. The type_attr_map in
policy is an array sized by the number of types times sizeof(struct ebitmap)
(12 on x86_64). Basic math tells us the array is going to be of length
3000 x 12 = 36,000 bytes. The largest 'safe' allocation on a long running
system is 16k. Most of the time a 32k allocation will work. But on long
running systems a 64k allocation (what we need) can fail quite regularly.
In order to deal with this I am converting the type_attr_map to use
flex_arrays. Let the library code deal with breaking this into PAGE_SIZE
pieces.-v2
rework some of the if(!obj) BUG() to be BUG_ON(!obj)
drop flex_array_put() calls and just use a _get() object directly-v3
make apply to James' tree (drop the policydb_write changes)Signed-off-by: Eric Paris
Acked-by: Stephen D. Smalley
Signed-off-by: James Morris -
Kconfig and Makefiles to enable configuration and building of AppArmor.
Signed-off-by: John Johansen
Signed-off-by: James Morris -
Commit c9e69318 "TOMOYO: Allow wildcard for execute permission." changed execute
permission and domainname to accept wildcards. But tomoyo_find_next_domain()
was using pathname passed to execve() rather than pathname specified by the
execute permission. As a result, processes were not able to transit to domains
which contain wildcards in their domainnames.This patch passes pathname specified by the execute permission back to
tomoyo_find_next_domain() so that processes can transit to domains which
contain wildcards in their domainnames.Signed-off-by: Tetsuo Handa
Signed-off-by: James Morris -
Remove extraneous path_truncate arguments from the AppArmor hook,
as they've been removed from the LSM API.Signed-off-by: James Morris
-
The basic routines and defines for AppArmor policy. AppArmor policy
is defined by a few basic components.
profiles - the basic unit of confinement contain all the information
to enforce policy on a taskProfiles tend to be named after an executable that they
will attach to but this is not required.
namespaces - a container for a set of profiles that will be used
during attachment and transitions between profiles.
sids - which provide a unique id for each profileSigned-off-by: John Johansen
Signed-off-by: James Morris -
AppArmor policy is loaded in a platform independent flattened binary
stream. Verify and unpack the data converting it to the internal
format needed for enforcement.Signed-off-by: John Johansen
Signed-off-by: James Morris -
ipc:
AppArmor ipc is currently limited to mediation done by file mediation
and basic ptrace tests. Improved mediation is a wip.rlimits:
AppArmor provides basic abilities to set and control rlimits at
a per profile level. Only resources specified in a profile are controled
or set. AppArmor rules set the hard limit to a value
Signed-off-by: James Morris -
AppArmor hooks to interface with the LSM, module parameters and module
initialization.Signed-off-by: John Johansen
Signed-off-by: James Morris -
Kconfig and Makefiles to enable configuration and building of AppArmor.
Signed-off-by: John Johansen
Signed-off-by: James Morris -
AppArmor routines for controling domain transitions, which can occur at
exec or through self directed change_profile/change_hat calls.Unconfined tasks are checked at exec against the profiles in the confining
profile namespace to determine if a profile should be attached to the task.Confined tasks execs are controlled by the profile which provides rules
determining which execs are allowed and if so which profiles should be
transitioned to.Self directed domain transitions allow a task to request transition
to a given profile. If the transition is allowed then the profile will
be applied, either immeditately or at exec time depending on the request.
Immeditate self directed transitions have several security limitations
but have uses in setting up stub transition profiles and other limited
cases.Signed-off-by: John Johansen
Signed-off-by: James Morris -
AppArmor does files enforcement via pathname matching. Matching is done
at file open using a dfa match engine. Permission is against the final
file object not parent directories, ie. the traversal of directories
as part of the file match is implicitly allowed. In the case of nonexistant
files (creation) permissions are checked against the target file not the
directory. eg. In case of creating the file /dir/new, permissions are
checked against the match /dir/new not against /dir/.The permissions for matches are currently stored in the dfa accept table,
but this will change to allow for dfa reuse and also to allow for sharing
of wider accept states.Signed-off-by: John Johansen
Signed-off-by: James Morris -
The /proc//attr/* interface is used for process introspection and
commands. While the apparmorfs interface is used for global introspection
and loading and removing policy.The interface currently only contains the files necessary for loading
policy, and will be extended in the future to include sysfs style
single per file introspection inteface.The old AppArmor 2.4 interface files have been removed into a compatibility
patch, that distros can use to maintain backwards compatibility.Signed-off-by: John Johansen
Signed-off-by: James Morris -
A basic dfa matching engine based off the dfa engine in the Dragon
Book. It uses simple row comb compression with a check field.This allows AppArmor to do pattern matching in linear time, and also
avoids stack issues that an nfa based engine may have. The dfa
engine uses a byte based comparison, with all values being valid.
Any potential character encoding are handled user side when the dfa
tables are created. By convention AppArmor uses \0 to separate two
dependent path matches since \0 is not a valid path character
(this is done in the link permission check).The dfa tables are generated in user space and are verified at load
time to be internally consistent.There are several future improvements planned for the dfa engine:
* The dfa engine may be converted to a hybrid nfa-dfa engine, with
a fixed size limited stack. This would allow for size time
tradeoffs, by inserting limited nfa states to help control
state explosion that can occur with dfas.
* The dfa engine may pickup the ability to do limited dynamic
variable matching, instead of fixing all variables at policy
load time.Signed-off-by: John Johansen
Signed-off-by: James Morris -
AppArmor contexts attach profiles and state to tasks, files, etc. when
a direct profile reference is not sufficient.Signed-off-by: John Johansen
Signed-off-by: James Morris -
Update lsm_audit for AppArmor specific data, and add the core routines for
AppArmor uses for auditing.Signed-off-by: John Johansen
Signed-off-by: James Morris -
Miscellaneous functions and defines needed by AppArmor, including
the base path resolution routines.Signed-off-by: John Johansen
Signed-off-by: James Morris -
Signed-off-by: Tetsuo Handa
Signed-off-by: James Morris -
Commit d74725b9 "TOMOYO: Use callback for updating entries." broke
tomoyo_domain_quota_is_ok() by counting deleted entries. It needs to
count non-deleted entries.Signed-off-by: Tetsuo Handa
Signed-off-by: James Morris -
execmod "could" show up on non regular files and non chr files. The current
implementation would actually make these checks against non-existant bits
since the code assumes the execmod permission is same for all file types.
To make this line up for chr files we had to define execute_no_trans and
entrypoint permissions. These permissions are unreachable and only existed
to to make FILE__EXECMOD and CHR_FILE__EXECMOD the same. This patch drops
those needless perms as well.Signed-off-by: Eric Paris
Acked-by: Stephen D. Smalley
Signed-off-by: James Morris -
kernel can dynamically remap perms. Drop the open lookup table and put open
in the common file perms.Signed-off-by: Eric Paris
Acked-by: Stephen D. Smalley
Signed-off-by: James Morris -
Currently there are a number of applications (nautilus being the main one) which
calls access() on files in order to determine how they should be displayed. It
is normal and expected that nautilus will want to see if files are executable
or if they are really read/write-able. access() should return the real
permission. SELinux policy checks are done in access() and can result in lots
of AVC denials as policy denies RWX on files which DAC allows. Currently
SELinux must dontaudit actual attempts to read/write/execute a file in
order to silence these messages (and not flood the logs.) But dontaudit rules
like that can hide real attacks. This patch addes a new common file
permission audit_access. This permission is special in that it is meaningless
and should never show up in an allow rule. Instead the only place this
permission has meaning is in a dontaudit rule like so:dontaudit nautilus_t sbin_t:file audit_access
With such a rule if nautilus just checks access() we will still get denied and
thus userspace will still get the correct answer but we will not log the denial.
If nautilus attempted to actually perform one of the forbidden actions
(rather than just querying access(2) about it) we would still log a denial.
This type of dontaudit rule should be used sparingly, as it could be a
method for an attacker to probe the system permissions without detection.Signed-off-by: Eric Paris
Acked-by: Stephen D. Smalley
Signed-off-by: James Morris -
SELinux needs to pass the MAY_ACCESS flag so it can handle auditting
correctly. Presently the masking of MAY_* flags is done in the VFS. In
order to allow LSMs to decide what flags they care about and what flags
they don't just pass them all and the each LSM mask off what they don't
need. This patch should contain no functional changes to either the VFS or
any LSM.Signed-off-by: Eric Paris
Acked-by: Stephen D. Smalley
Signed-off-by: James Morris -
Move the reading of ocontext type data out of policydb_read() in a separate
function ocontext_read()Signed-off-by: Eric Paris
Acked-by: Stephen D. Smalley
Signed-off-by: James Morris -
move genfs read functionality out of policydb_read() and into a new
function called genfs_read()Signed-off-by: Eric Paris
Acked-by: Stephen D. Smalley
Signed-off-by: James Morris -
hashtab_create() only returns NULL on allocation failures to -ENOMEM is
appropriate here.Signed-off-by: Dan Carpenter
Acked-by: Eric Paris
Acked-by: Stephen D. Smalley
Signed-off-by: James Morris -
The original code always returned -1 (-EPERM) on error. The new code
returns either -ENOMEM, or -EINVAL or it propagates the error codes from
lower level functions next_entry() or hashtab_insert().next_entry() returns -EINVAL.
hashtab_insert() returns -EINVAL, -EEXIST, or -ENOMEM.Signed-off-by: Dan Carpenter
Acked-by: Stephen D. Smalley
Signed-off-by: James Morris -
It's better to propagate the error code from avtab_init() instead of
returning -1 (-EPERM). It turns out that avtab_init() never fails so
this patch doesn't change how the code runs but it's still a clean up.Signed-off-by: Dan Carpenter
Acked-by: Stephen D. Smalley
Signed-off-by: James Morris -
Originally cond_read_node() returned -1 (-EPERM) on errors which was
incorrect. Now it either propagates the error codes from lower level
functions next_entry() or cond_read_av_list() or it returns -ENOMEM or
-EINVAL.next_entry() returns -EINVAL.
cond_read_av_list() returns -EINVAL or -ENOMEM.Signed-off-by: Dan Carpenter
Acked-by: Stephen D. Smalley
Signed-off-by: James Morris -
After this patch cond_read_av_list() no longer returns -1 for any
errors. It just propagates error code back from lower levels. Those can
either be -EINVAL or -ENOMEM.I also modified cond_insertf() since cond_read_av_list() passes that as a
function pointer to avtab_read_item(). It isn't used anywhere else.Signed-off-by: Dan Carpenter
Acked-by: Stephen D. Smalley
Signed-off-by: James Morris -
These are passed back when the security module gets loaded.
The original code always returned -1 (-EPERM) on error but after this
patch it can return -EINVAL, or -ENOMEM or propagate the error code from
cond_read_node(). cond_read_node() still returns -1 all the time, but I
fix that in a later patch.Signed-off-by: Dan Carpenter
Acked-by: Stephen D. Smalley
Signed-off-by: James Morris -
The avtab_read_item() function tends to return -1 as a default error
code which is wrong (-1 means -EPERM). I modified it to return
appropriate error codes which is -EINVAL or the error code from
next_entry() or insertf().next_entry() returns -EINVAL.
insertf() is a function pointer to either avtab_insert() or
cond_insertf().
avtab_insert() returns -EINVAL, -ENOMEM, and -EEXIST.
cond_insertf() currently returns -1, but I will fix it in a later patch.There is code in avtab_read() which translates the -1 returns from
avtab_read_item() to -EINVAL. The translation is no longer needed, so I
removed it.Signed-off-by: Dan Carpenter
Acked-by: Stephen D. Smalley
Signed-off-by: James Morris