30 Jun, 2006

1 commit

  • The proposed NFS key type uses its own method of passing key requests to
    userspace (upcalling) rather than invoking /sbin/request-key. This is
    because the responsible userspace daemon should already be running and will
    be contacted through rpc_pipefs.

    This patch permits the NFS filesystem to pass auxiliary data to the upcall
    operation (struct key_type::request_key) so that the upcaller can use a
    pre-existing communications channel more easily.

    Signed-off-by: David Howells
    Acked-By: Kevin Coffman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     

28 Jun, 2006

2 commits

  • Add more poison values to include/linux/poison.h. It's not clear to me
    whether some others should be added or not, so I haven't added any of
    these:

    ./include/linux/libata.h:#define ATA_TAG_POISON 0xfafbfcfdU
    ./arch/ppc/8260_io/fcc_enet.c:1918: memset((char *)(&(immap->im_dprambase[(mem_addr+64)])), 0x88, 32);
    ./drivers/usb/mon/mon_text.c:429: memset(mem, 0xe5, sizeof(struct mon_event_text));
    ./drivers/char/ftape/lowlevel/ftape-ctl.c:738: memset(ft_buffer[i]->address, 0xAA, FT_BUFF_SIZE);
    ./drivers/block/sx8.c:/* 0xf is just arbitrary, non-zero noise; this is sorta like poisoning */

    Signed-off-by: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     
  • Update SELinux to cause the keycreate process attribute held in
    /proc/self/attr/keycreate to be inherited across a fork and reset upon
    execve. This is consistent with the handling of the other process
    attributes provided by SELinux and also makes it simpler to adapt logon
    programs to properly handle the keycreate attribute.

    Signed-off-by: Michael LeMay
    Signed-off-by: David Howells
    Acked-by: Stephen Smalley
    Acked-by: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael LeMay
     

27 Jun, 2006

7 commits

  • Below is a patch to add a new /proc/self/attr/sockcreate A process may write a
    context into this interface and all subsequent sockets created will be labeled
    with that context. This is the same idea as the fscreate interface where a
    process can specify the label of a file about to be created. At this time one
    envisioned user of this will be xinetd. It will be able to better label
    sockets for the actual services. At this time all sockets take the label of
    the creating process, so all xinitd sockets would just be labeled the same.

    I tested this by creating a tcp sender and listener. The sender was able to
    write to this new proc file and then create sockets with the specified label.
    I am able to be sure the new label was used since the avc denial messages
    kicked out by the kernel included both the new security permission
    setsockcreate and all the socket denials were for the new label, not the label
    of the running process.

    Signed-off-by: Eric Paris
    Signed-off-by: James Morris
    Cc: Chris Wright
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Paris
     
  • Add a /proc//attr/keycreate entry that stores the appropriate context for
    newly-created keys. Modify the selinux_key_alloc hook to make use of the new
    entry. Update the flask headers to include a new "setkeycreate" permission
    for processes. Update the flask headers to include a new "create" permission
    for keys. Use the create permission to restrict which SIDs each task can
    assign to newly-created keys. Add a new parameter to the security hook
    "security_key_alloc" to indicate whether it is being invoked by the kernel, or
    from userspace. If it is being invoked by the kernel, the security hook
    should never fail. Update the documentation to reflect these changes.

    Signed-off-by: Michael LeMay
    Signed-off-by: James Morris
    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael LeMay
     
  • Restrict /proc/keys such that only those keys to which the current task is
    granted View permission are presented.

    The documentation is also updated to reflect these changes.

    Signed-off-by: Michael LeMay
    Signed-off-by: James Morris
    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael LeMay
     
  • Cause key_alloc_serial() to generate key serial numbers randomly rather than
    in linear sequence.

    Using an linear sequence permits a covert communication channel to be
    established, in which one process can communicate with another by creating or
    not creating new keys within a certain timeframe. The second process can
    probe for the expected next key serial number and judge its existence by the
    error returned.

    This is a problem as the serial number namespace is globally shared between
    all tasks, regardless of their context.

    For more information on this topic, this old TCSEC guide is recommended:

    http://www.radium.ncsc.mil/tpep/library/rainbow/NCSC-TG-030.html

    Signed-off-by: Michael LeMay
    Signed-off-by: James Morris
    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael LeMay
     
  • Let keyctl_chown() change a key's owner, including attempting to transfer the
    quota burden to the new user.

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fredrik Tolf
     
  • Cause the keys linked to a keyring to be unlinked from it when revoked and it
    causes the data attached to a user-defined key to be discarded when revoked.

    This frees up most of the quota a key occupied at that point, rather than
    waiting for the key to actually be destroyed.

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Add the ability for key creation to overrun the user's quota in some
    circumstances - notably when a session keyring is created and assigned to a
    process that didn't previously have one.

    This means it's still possible to log in, should PAM require the creation of a
    new session keyring, and fix an overburdened key quota.

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     

25 Jun, 2006

1 commit


23 Jun, 2006

6 commits

  • This patch adds new security hook, task_movememory, to be called when memory
    owened by a task is to be moved (e.g. when migrating pages to a this hook is
    identical to the setscheduler implementation, but a separate hook introduced
    to allow this check to be specialized in the future if necessary.

    Since the last posting, the hook has been renamed following feedback from
    Christoph Lameter.

    Signed-off-by: David Quigley
    Acked-by: Stephen Smalley
    Signed-off-by: James Morris
    Cc: Christoph Lameter
    Cc: Andi Kleen
    Acked-by: Chris Wright
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Quigley
     
  • Implement an LSM hook for setting a task's IO priority, similar to the hook
    for setting a tasks's nice value.

    A previous version of this LSM hook was included in an older version of
    multiadm by Jan Engelhardt, although I don't recall it being submitted
    upstream.

    Also included is the corresponding SELinux hook, which re-uses the setsched
    permission in the proccess class.

    Signed-off-by: James Morris
    Acked-by: Stephen Smalley
    Cc: Jan Engelhardt
    Cc: Chris Wright
    Cc: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    James Morris
     
  • Give the statfs superblock operation a dentry pointer rather than a superblock
    pointer.

    This complements the get_sb() patch. That reduced the significance of
    sb->s_root, allowing NFS to place a fake root there. However, NFS does
    require a dentry to use as a target for the statfs operation. This permits
    the root in the vfsmount to be used instead.

    linux/mount.h has been added where necessary to make allyesconfig build
    successfully.

    Interest has also been expressed for use with the FUSE and XFS filesystems.

    Signed-off-by: David Howells
    Acked-by: Al Viro
    Cc: Nathan Scott
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Extend the get_sb() filesystem operation to take an extra argument that
    permits the VFS to pass in the target vfsmount that defines the mountpoint.

    The filesystem is then required to manually set the superblock and root dentry
    pointers. For most filesystems, this should be done with simple_set_mnt()
    which will set the superblock pointer and then set the root dentry to the
    superblock's s_root (as per the old default behaviour).

    The get_sb() op now returns an integer as there's now no need to return the
    superblock pointer.

    This patch permits a superblock to be implicitly shared amongst several mount
    points, such as can be done with NFS to avoid potential inode aliasing. In
    such a case, simple_set_mnt() would not be called, and instead the mnt_root
    and mnt_sb would be set directly.

    The patch also makes the following changes:

    (*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
    pointer argument and return an integer, so most filesystems have to change
    very little.

    (*) If one of the convenience function is not used, then get_sb() should
    normally call simple_set_mnt() to instantiate the vfsmount. This will
    always return 0, and so can be tail-called from get_sb().

    (*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
    dcache upon superblock destruction rather than shrink_dcache_anon().

    This is required because the superblock may now have multiple trees that
    aren't actually bound to s_root, but that still need to be cleaned up. The
    currently called functions assume that the whole tree is rooted at s_root,
    and that anonymous dentries are not the roots of trees which results in
    dentries being left unculled.

    However, with the way NFS superblock sharing are currently set to be
    implemented, these assumptions are violated: the root of the filesystem is
    simply a dummy dentry and inode (the real inode for '/' may well be
    inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
    with child trees.

    [*] Anonymous until discovered from another tree.

    (*) The documentation has been adjusted, including the additional bit of
    changing ext2_* into foo_* in the documentation.

    [akpm@osdl.org: convert ipath_fs, do other stuff]
    Signed-off-by: David Howells
    Acked-by: Al Viro
    Cc: Nathan Scott
    Cc: Roland Dreier
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Add a revocation notification method to the key type and calls it whilst
    the key's semaphore is still write-locked after setting the revocation
    flag.

    The patch then uses this to maintain a reference on the task_struct of the
    process that calls request_key() for as long as the authorisation key
    remains unrevoked.

    This fixes a potential race between two processes both of which have
    assumed the authority to instantiate a key (one may have forked the other
    for example). The problem is that there's no locking around the check for
    revocation of the auth key and the use of the task_struct it points to, nor
    does the auth key keep a reference on the task_struct.

    Access to the "context" pointer in the auth key must thenceforth be done
    with the auth key semaphore held. The revocation method is called with the
    target key semaphore held write-locked and the search of the context
    process's keyrings is done with the auth key semaphore read-locked.

    The check for the revocation state of the auth key just prior to searching
    it is done after the auth key is read-locked for the search. This ensures
    that the auth key can't be revoked between the check and the search.

    The revocation notification method is added so that the context task_struct
    can be released as soon as instantiation happens rather than waiting for
    the auth key to be destroyed, thus avoiding the unnecessary pinning of the
    requesting process.

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Introduce SELinux hooks to support the access key retention subsystem
    within the kernel. Incorporate new flask headers from a modified version
    of the SELinux reference policy, with support for the new security class
    representing retained keys. Extend the "key_alloc" security hook with a
    task parameter representing the intended ownership context for the key
    being allocated. Attach security information to root's default keyrings
    within the SELinux initialization routine.

    Has passed David's testsuite.

    Signed-off-by: Michael LeMay
    Signed-off-by: David Howells
    Signed-off-by: James Morris
    Acked-by: Chris Wright
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael LeMay
     

21 Jun, 2006

3 commits

  • Conflicts:

    include/linux/nfs_fs.h

    Fixed up conflict with kernel header updates.

    Trond Myklebust
     
  • * 'audit.b21' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current: (25 commits)
    [PATCH] make set_loginuid obey audit_enabled
    [PATCH] log more info for directory entry change events
    [PATCH] fix AUDIT_FILTER_PREPEND handling
    [PATCH] validate rule fields' types
    [PATCH] audit: path-based rules
    [PATCH] Audit of POSIX Message Queue Syscalls v.2
    [PATCH] fix se_sen audit filter
    [PATCH] deprecate AUDIT_POSSBILE
    [PATCH] inline more audit helpers
    [PATCH] proc_loginuid_write() uses simple_strtoul() on non-terminated array
    [PATCH] update of IPC audit record cleanup
    [PATCH] minor audit updates
    [PATCH] fix audit_krule_to_{rule,data} return values
    [PATCH] add filtering by ppid
    [PATCH] log ppid
    [PATCH] collect sid of those who send signals to auditd
    [PATCH] execve argument logging
    [PATCH] fix deadlocks in AUDIT_LIST/AUDIT_LIST_RULES
    [PATCH] audit_panic() is audit-internal
    [PATCH] inotify (5/5): update kernel documentation
    ...

    Manual fixup of conflict in unclude/linux/inotify.h

    Linus Torvalds
     
  • * git://git.infradead.org/~dwmw2/rbtree-2.6:
    [RBTREE] Switch rb_colour() et al to en_US spelling of 'color' for consistency
    Update UML kernel/physmem.c to use rb_parent() accessor macro
    [RBTREE] Update hrtimers to use rb_parent() accessor macro.
    [RBTREE] Add explicit alignment to sizeof(long) for struct rb_node.
    [RBTREE] Merge colour and parent fields of struct rb_node.
    [RBTREE] Remove dead code in rb_erase()
    [RBTREE] Update JFFS2 to use rb_parent() accessor macro.
    [RBTREE] Update eventpoll.c to use rb_parent() accessor macro.
    [RBTREE] Update key.c to use rb_parent() accessor macro.
    [RBTREE] Update ext3 to use rb_parent() accessor macro.
    [RBTREE] Change rbtree off-tree marking in I/O schedulers.
    [RBTREE] Add accessor macros for colour and parent fields of rb_node

    Linus Torvalds
     

20 Jun, 2006

2 commits


18 Jun, 2006

5 commits

  • Add new per-packet access controls to SELinux, replacing the old
    packet controls.

    Packets are labeled with the iptables SECMARK and CONNSECMARK targets,
    then security policy for the packets is enforced with these controls.

    To allow for a smooth transition to the new controls, the old code is
    still present, but not active by default. To restore previous
    behavior, the old controls may be activated at runtime by writing a
    '1' to /selinux/compat_net, and also via the kernel boot parameter
    selinux_compat_net. Switching between the network control models
    requires the security load_policy permission. The old controls will
    probably eventually be removed and any continued use is discouraged.

    With this patch, the new secmark controls for SElinux are disabled by
    default, so existing behavior is entirely preserved, and the user is
    not affected at all.

    It also provides a config option to enable the secmark controls by
    default (which can always be overridden at boot and runtime). It is
    also noted in the kconfig help that the user will need updated
    userspace if enabling secmark controls for SELinux and that they'll
    probably need the SECMARK and CONNMARK targets, and conntrack protocol
    helpers, although such decisions are beyond the scope of kernel
    configuration.

    Signed-off-by: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: David S. Miller

    James Morris
     
  • Add and export new functions to the in-kernel SELinux API in support of the
    new secmark-based packet controls.

    Signed-off-by: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: David S. Miller

    James Morris
     
  • Secmark implements a new scheme for adding security markings to
    packets via iptables, as well as changes to SELinux to use these
    markings for security policy enforcement. The rationale for this
    scheme is explained and discussed in detail in the original threads:

    http://thread.gmane.org/gmane.linux.network/34927/
    http://thread.gmane.org/gmane.linux.network/35244/

    Examples of policy and rulesets, as well as a full archive of patches
    for iptables and SELinux userland, may be found at:

    http://people.redhat.com/jmorris/selinux/secmark/

    The code has been tested with various compilation options and in
    several scenarios, including with 'complicated' protocols such as FTP
    and also with the new generic conntrack code with IPv6 connection
    tracking.

    This patch:

    Add support for a new object class ('packet'), and associated
    permissions ('send', 'recv', 'relabelto'). These are used to enforce
    security policy for network packets labeled with SECMARK, and for
    adding labeling rules.

    Signed-off-by: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: David S. Miller

    James Morris
     
  • Add a security class for appletalk sockets so that they can be
    distinguished in SELinux policy. Please apply.

    Signed-off-by: Stephen Smalley
    Acked-by: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: David S. Miller

    Christopher J. PeBenito
     
  • This patch contains a fix for the previous patch that adds security
    contexts to IPsec policies and security associations. In the previous
    patch, no authorization (besides the check for write permissions to
    SAD and SPD) is required to delete IPsec policies and security
    assocations with security contexts. Thus a user authorized to change
    SAD and SPD can bypass the IPsec policy authorization by simply
    deleteing policies with security contexts. To fix this security hole,
    an additional authorization check is added for removing security
    policies and security associations with security contexts.

    Note that if no security context is supplied on add or present on
    policy to be deleted, the SELinux module allows the change
    unconditionally. The hook is called on deletion when no context is
    present, which we may want to change. At present, I left it up to the
    module.

    LSM changes:

    The patch adds two new LSM hooks: xfrm_policy_delete and
    xfrm_state_delete. The new hooks are necessary to authorize deletion
    of IPsec policies that have security contexts. The existing hooks
    xfrm_policy_free and xfrm_state_free lack the context to do the
    authorization, so I decided to split authorization of deletion and
    memory management of security data, as is typical in the LSM
    interface.

    Use:

    The new delete hooks are checked when xfrm_policy or xfrm_state are
    deleted by either the xfrm_user interface (xfrm_get_policy,
    xfrm_del_sa) or the pfkey interface (pfkey_spddelete, pfkey_delete).

    SELinux changes:

    The new policy_delete and state_delete functions are added.

    Signed-off-by: Catherine Zhang
    Signed-off-by: Trent Jaeger
    Acked-by: James Morris
    Signed-off-by: David S. Miller

    Catherine Zhang
     

09 Jun, 2006

1 commit


06 Jun, 2006

1 commit


22 May, 2006

1 commit


16 May, 2006

1 commit


04 May, 2006

1 commit


01 May, 2006

4 commits

  • The below patch should be applied after the inode and ipc sid patches.
    This patch is a reworking of Tim's patch that has been updated to match
    the inode and ipc patches since its similar.

    [updated:
    > Stephen Smalley also wanted to change a variable from isec to tsec in the
    > user sid patch. ]

    Signed-off-by: Steve Grubb
    Signed-off-by: Al Viro

    Steve Grubb
     
  • Hi,

    The patch below converts IPC auditing to collect sid's and convert to context
    string only if it needs to output an audit record. This patch depends on the
    inode audit change patch already being applied.

    Signed-off-by: Steve Grubb

    Signed-off-by: Al Viro

    Steve Grubb
     
  • Previously, we were gathering the context instead of the sid. Now in this patch,
    we gather just the sid and convert to context only if an audit event is being
    output.

    This patch brings the performance hit from 146% down to 23%

    Signed-off-by: Al Viro

    Steve Grubb
     
  • The following patch provides selinux interfaces that will allow the audit
    system to perform filtering based on the process context (user, role, type,
    sensitivity, and clearance). These interfaces will allow the selinux
    module to perform efficient matches based on lower level selinux constructs,
    rather than relying on context retrievals and string comparisons within
    the audit module. It also allows for dominance checks on the mls portion
    of the contexts that are impossible with only string comparisons.

    Signed-off-by: Darrel Goeddel
    Signed-off-by: Al Viro

    Darrel Goeddel
     

21 Apr, 2006

1 commit


20 Apr, 2006

1 commit

  • Fix an off-by-one error in the MLS compatibility code that was causing
    contexts with a MLS suffix to be rejected, preventing sharing partitions
    between FC4 and FC5. Bug reported in

    https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=188068

    Signed-off-by: Stephen Smalley
    Acked-by: James Morris
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ron Yorston
     

11 Apr, 2006

2 commits

  • Remove an unnecessary memory barrier (implicit in rcu_dereference()) from
    install_session_keyring().

    install_session_keyring() is also rearranged a little to make it slightly
    more efficient.

    As install_*_keyring() may schedule (in synchronize_rcu() or
    keyring_alloc()), they may not be entered with interrupts disabled - and so
    there's no point saving the interrupt disablement state over the critical
    section.

    exec_keys() will also be invoked with interrupts enabled, and so that doesn't
    need to save the interrupt state either.

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • This fixes the problem of an oops occuring when a user attempts to add a
    key to a non-keyring key [CVE-2006-1522].

    The problem is that __keyring_search_one() doesn't check that the
    keyring it's been given is actually a keyring.

    I've fixed this problem by:

    (1) declaring that caller of __keyring_search_one() must guarantee that
    the keyring is a keyring; and

    (2) making key_create_or_update() check that the keyring is a keyring,
    and return -ENOTDIR if it isn't.

    This can be tested by:

    keyctl add user b b `keyctl add user a a @s`

    Signed-off-by: David Howells
    Signed-off-by: Linus Torvalds

    David Howells