15 Feb, 2017

1 commit

  • commit 0c461cb727d146c9ef2d3e86214f498b78b7d125 upstream.

    SELinux tries to support setting/clearing of /proc/pid/attr attributes
    from the shell by ignoring terminating newlines and treating an
    attribute value that begins with a NUL or newline as an attempt to
    clear the attribute. However, the test for clearing attributes has
    always been wrong; it has an off-by-one error, and this could further
    lead to reading past the end of the allocated buffer since commit
    bb646cdb12e75d82258c2f2e7746d5952d3e321a ("proc_pid_attr_write():
    switch to memdup_user()"). Fix the off-by-one error.

    Even with this fix, setting and clearing /proc/pid/attr attributes
    from the shell is not straightforward since the interface does not
    support multiple write() calls (so shells that write the value and
    newline separately will set and then immediately clear the attribute,
    requiring use of echo -n to set the attribute), whereas trying to use
    echo -n "" to clear the attribute causes the shell to skip the
    write() call altogether since POSIX says that a zero-length write
    causes no side effects. Thus, one must use echo -n to set and echo
    without -n to clear, as in the following example:
    $ echo -n unconfined_u:object_r:user_home_t:s0 > /proc/$$/attr/fscreate
    $ cat /proc/$$/attr/fscreate
    unconfined_u:object_r:user_home_t:s0
    $ echo "" > /proc/$$/attr/fscreate
    $ cat /proc/$$/attr/fscreate

    Note the use of /proc/$$ rather than /proc/self, as otherwise
    the cat command will read its own attribute value, not that of the shell.

    There are no users of this facility to my knowledge; possibly we
    should just get rid of it.

    UPDATE: Upon further investigation it appears that a local process
    with the process:setfscreate permission can cause a kernel panic as a
    result of this bug. This patch fixes CVE-2017-2618.

    Signed-off-by: Stephen Smalley
    [PM: added the update about CVE-2017-2618 to the commit description]
    Signed-off-by: Paul Moore
    Signed-off-by: Greg Kroah-Hartman

    Signed-off-by: James Morris

    Stephen Smalley
     

12 Jan, 2017

1 commit

  • commit 9a11a18902bc3b904353063763d06480620245a6 upstream.

    When the "policy" securityfs file is opened for read, it is opened as a
    sequential file. However, when it is eventually released, there is no
    cleanup for the sequential file, therefore some memory is leaked.

    This patch adds a call to seq_release() in ima_release_policy() to clean up
    the memory when the file is opened for read.

    Fixes: 80eae209d63a IMA: allow reading back the current policy
    Reported-by: Colin Ian King
    Signed-off-by: Eric Richter
    Tested-by: Colin Ian King
    Signed-off-by: Mimi Zohar
    Signed-off-by: Greg Kroah-Hartman

    Eric Richter
     

21 Nov, 2016

1 commit

  • After a policy replacement, the task cred may be out of date and need
    to be updated. However change_hat is using the stale profiles from
    the out of date cred resulting in either: a stale profile being applied
    or, incorrect failure when searching for a hat profile as it has been
    migrated to the new parent profile.

    Fixes: 01e2b670aa898a39259bc85c78e3d74820f4d3b6 (failure to find hat)
    Fixes: 898127c34ec03291c86f4ff3856d79e9e18952bc (stale policy being applied)
    Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1000287
    Cc: stable@vger.kernel.org
    Signed-off-by: John Johansen
    Signed-off-by: James Morris

    John Johansen
     

27 Oct, 2016

3 commits

  • Since BIG_KEYS can't be compiled as module it requires one of the "stdrng"
    providers to be compiled into kernel. Otherwise big_key_crypto_init() fails
    on crypto_alloc_rng step and next dereference of big_key_skcipher (e.g. in
    big_key_preparse()) results in a NULL pointer dereference.

    Fixes: 13100a72f40f5748a04017e0ab3df4cf27c809ef ('Security: Keys: Big keys stored encrypted')
    Signed-off-by: Artem Savkov
    Signed-off-by: David Howells
    cc: Stephan Mueller
    cc: Kirill Marinushkin
    cc: stable@vger.kernel.org
    Signed-off-by: James Morris

    Artem Savkov
     
  • big_key has two separate initialisation functions, one that registers the
    key type and one that registers the crypto. If the key type fails to
    register, there's no problem if the crypto registers successfully because
    there's no way to reach the crypto except through the key type.

    However, if the key type registers successfully but the crypto does not,
    big_key_rng and big_key_blkcipher may end up set to NULL - but the code
    neither checks for this nor unregisters the big key key type.

    Furthermore, since the key type is registered before the crypto, it is
    theoretically possible for the kernel to try adding a big_key before the
    crypto is set up, leading to the same effect.

    Fix this by merging big_key_crypto_init() and big_key_init() and calling
    the resulting function late. If they're going to be encrypted, we
    shouldn't be creating big_keys before we have the facilities to do the
    encryption available. The key type registration is also moved after the
    crypto initialisation.

    The fix also includes message printing on failure.

    If the big_key type isn't correctly set up, simply doing:

    dd if=/dev/zero bs=4096 count=1 | keyctl padd big_key a @s

    ought to cause an oops.

    Fixes: 13100a72f40f5748a04017e0ab3df4cf27c809ef ('Security: Keys: Big keys stored encrypted')
    Signed-off-by: David Howells
    cc: Peter Hlavaty
    cc: Kirill Marinushkin
    cc: Artem Savkov
    cc: stable@vger.kernel.org
    Signed-off-by: James Morris

    David Howells
     
  • This fixes CVE-2016-7042.

    Fix a short sprintf buffer in proc_keys_show(). If the gcc stack protector
    is turned on, this can cause a panic due to stack corruption.

    The problem is that xbuf[] is not big enough to hold a 64-bit timeout
    rendered as weeks:

    (gdb) p 0xffffffffffffffffULL/(60*60*24*7)
    $2 = 30500568904943

    That's 14 chars plus NUL, not 11 chars plus NUL.

    Expand the buffer to 16 chars.

    I think the unpatched code apparently works if the stack-protector is not
    enabled because on a 32-bit machine the buffer won't be overflowed and on a
    64-bit machine there's a 64-bit aligned pointer at one side and an int that
    isn't checked again on the other side.

    The panic incurred looks something like:

    Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff81352ebe
    CPU: 0 PID: 1692 Comm: reproducer Not tainted 4.7.2-201.fc24.x86_64 #1
    Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
    0000000000000086 00000000fbbd2679 ffff8800a044bc00 ffffffff813d941f
    ffffffff81a28d58 ffff8800a044bc98 ffff8800a044bc88 ffffffff811b2cb6
    ffff880000000010 ffff8800a044bc98 ffff8800a044bc30 00000000fbbd2679
    Call Trace:
    [] dump_stack+0x63/0x84
    [] panic+0xde/0x22a
    [] ? proc_keys_show+0x3ce/0x3d0
    [] __stack_chk_fail+0x19/0x30
    [] proc_keys_show+0x3ce/0x3d0
    [] ? key_validate+0x50/0x50
    [] ? key_default_cmp+0x20/0x20
    [] seq_read+0x2cc/0x390
    [] proc_reg_read+0x42/0x70
    [] __vfs_read+0x37/0x150
    [] ? security_file_permission+0xa0/0xc0
    [] vfs_read+0x96/0x130
    [] SyS_read+0x55/0xc0
    [] entry_SYSCALL_64_fastpath+0x1a/0xa4

    Reported-by: Ondrej Kozina
    Signed-off-by: David Howells
    Tested-by: Ondrej Kozina
    cc: stable@vger.kernel.org
    Signed-off-by: James Morris

    David Howells
     

23 Oct, 2016

1 commit

  • Pull vmap stack fixes from Ingo Molnar:
    "This is fallout from CONFIG_HAVE_ARCH_VMAP_STACK=y on x86: stack
    accesses that used to be just somewhat questionable are now totally
    buggy.

    These changes try to do it without breaking the ABI: the fields are
    left there, they are just reporting zero, or reporting narrower
    information (the maps file change)"

    * 'mm-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    mm: Change vm_is_stack_for_task() to vm_is_stack_for_current()
    fs/proc: Stop trying to report thread stacks
    fs/proc: Stop reporting eip and esp in /proc/PID/stat
    mm/numa: Remove duplicated include from mprotect.c

    Linus Torvalds
     

20 Oct, 2016

1 commit

  • Asking for a non-current task's stack can't be done without races
    unless the task is frozen in kernel mode. As far as I know,
    vm_is_stack_for_task() never had a safe non-current use case.

    The __unused annotation is because some KSTK_ESP implementations
    ignore their parameter, which IMO is further justification for this
    patch.

    Signed-off-by: Andy Lutomirski
    Acked-by: Thomas Gleixner
    Cc: Al Viro
    Cc: Andrew Morton
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Jann Horn
    Cc: Kees Cook
    Cc: Linus Torvalds
    Cc: Linux API
    Cc: Peter Zijlstra
    Cc: Tycho Andersen
    Link: http://lkml.kernel.org/r/4c3f68f426e6c061ca98b4fc7ef85ffbb0a25b0c.1475257877.git.luto@kernel.org
    Signed-off-by: Ingo Molnar

    Andy Lutomirski
     

19 Oct, 2016

1 commit


11 Oct, 2016

5 commits

  • Pull more vfs updates from Al Viro:
    ">rename2() work from Miklos + current_time() from Deepa"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs: Replace current_fs_time() with current_time()
    fs: Replace CURRENT_TIME_SEC with current_time() for inode timestamps
    fs: Replace CURRENT_TIME with current_time() for inode timestamps
    fs: proc: Delete inode time initializations in proc_alloc_inode()
    vfs: Add current_time() api
    vfs: add note about i_op->rename changes to porting
    fs: rename "rename2" i_op to "rename"
    vfs: remove unused i_op->rename
    fs: make remaining filesystems use .rename2
    libfs: support RENAME_NOREPLACE in simple_rename()
    fs: support RENAME_NOREPLACE for local filesystems
    ncpfs: fix unused variable warning

    Linus Torvalds
     
  • Al Viro
     
  • Pull vfs xattr updates from Al Viro:
    "xattr stuff from Andreas

    This completes the switch to xattr_handler ->get()/->set() from
    ->getxattr/->setxattr/->removexattr"

    * 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    vfs: Remove {get,set,remove}xattr inode operations
    xattr: Stop calling {get,set,remove}xattr inode operations
    vfs: Check for the IOP_XATTR flag in listxattr
    xattr: Add __vfs_{get,set,remove}xattr helpers
    libfs: Use IOP_XATTR flag for empty directory handling
    vfs: Use IOP_XATTR flag for bad-inode handling
    vfs: Add IOP_XATTR inode operations flag
    vfs: Move xattr_resolve_name to the front of fs/xattr.c
    ecryptfs: Switch to generic xattr handlers
    sockfs: Get rid of getxattr iop
    sockfs: getxattr: Fail with -EOPNOTSUPP for invalid attribute names
    kernfs: Switch to generic xattr handlers
    hfs: Switch to generic xattr handlers
    jffs2: Remove jffs2_{get,set,remove}xattr macros
    xattr: Remove unnecessary NULL attribute name check

    Linus Torvalds
     
  • Pull misc vfs updates from Al Viro:
    "Assorted misc bits and pieces.

    There are several single-topic branches left after this (rename2
    series from Miklos, current_time series from Deepa Dinamani, xattr
    series from Andreas, uaccess stuff from from me) and I'd prefer to
    send those separately"

    * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (39 commits)
    proc: switch auxv to use of __mem_open()
    hpfs: support FIEMAP
    cifs: get rid of unused arguments of CIFSSMBWrite()
    posix_acl: uapi header split
    posix_acl: xattr representation cleanups
    fs/aio.c: eliminate redundant loads in put_aio_ring_file
    fs/internal.h: add const to ns_dentry_operations declaration
    compat: remove compat_printk()
    fs/buffer.c: make __getblk_slow() static
    proc: unsigned file descriptors
    fs/file: more unsigned file descriptors
    fs: compat: remove redundant check of nr_segs
    cachefiles: Fix attempt to read i_blocks after deleting file [ver #2]
    cifs: don't use memcpy() to copy struct iov_iter
    get rid of separate multipage fault-in primitives
    fs: Avoid premature clearing of capabilities
    fs: Give dentry to inode_change_ok() instead of inode
    fuse: Propagate dentry down to inode_change_ok()
    ceph: Propagate dentry down to inode_change_ok()
    xfs: Propagate dentry down to inode_change_ok()
    ...

    Linus Torvalds
     
  • Merge my system logging cleanups, triggered by the broken '\n' patches.

    The line continuation handling has been broken basically forever, and
    the code to handle the system log records was both confusing and
    dubious. And it would do entirely the wrong thing unless you always had
    a terminating newline, partly because it couldn't actually see whether a
    message was marked KERN_CONT or not (but partly because the LOG_CONT
    handling in the recording code was rather confusing too).

    This re-introduces a real semantically meaningful KERN_CONT, and fixes
    the few places I noticed where it was missing. There are probably more
    missing cases, since KERN_CONT hasn't actually had any semantic meaning
    for at least four years (other than the checkpatch meaning of "no log
    level necessary, this is a continuation line").

    This also allows the combination of KERN_CONT and a log level. In that
    case the log level will be ignored if the merging with a previous line
    is successful, but if a new record is needed, that new record will now
    get the right log level.

    That also means that you can at least in theory combine KERN_CONT with
    the "pr_info()" style helpers, although any use of pr_fmt() prefixing
    would make that just result in a mess, of course (the prefix would end
    up in the middle of a continuing line).

    * printk-cleanups:
    printk: make reading the kernel log flush pending lines
    printk: re-organize log_output() to be more legible
    printk: split out core logging code into helper function
    printk: reinstate KERN_CONT for printing continuation lines

    Linus Torvalds
     

10 Oct, 2016

1 commit

  • Long long ago the kernel log buffer was a buffered stream of bytes, very
    much like stdio in user space. It supported log levels by scanning the
    stream and noticing the log level markers at the beginning of each line,
    but if you wanted to print a partial line in multiple chunks, you just
    did multiple printk() calls, and it just automatically worked.

    Except when it didn't, and you had very confusing output when different
    lines got all mixed up with each other. Then you got fragment lines
    mixing with each other, or with non-fragment lines, because it was
    traditionally impossible to tell whether a printk() call was a
    continuation or not.

    To at least help clarify the issue of continuation lines, we added a
    KERN_CONT marker back in 2007 to mark continuation lines:

    474925277671 ("printk: add KERN_CONT annotation").

    That continuation marker was initially an empty string, and didn't
    actuall make any semantic difference. But it at least made it possible
    to annotate the source code, and have check-patch notice that a printk()
    didn't need or want a log level marker, because it was a continuation of
    a previous line.

    To avoid the ambiguity between a continuation line that had that
    KERN_CONT marker, and a printk with no level information at all, we then
    in 2009 made KERN_CONT be a real log level marker which meant that we
    could now reliably tell the difference between the two cases.

    5fd29d6ccbc9 ("printk: clean up handling of log-levels and newlines")

    and we could take advantage of that to make sure we didn't mix up
    continuation lines with lines that just didn't have any loglevel at all.

    Then, in 2012, the kernel log buffer was changed to be a "record" based
    log, where each line was a record that has a loglevel and a timestamp.

    You can see the beginning of that conversion in commits

    e11fea92e13f ("kmsg: export printk records to the /dev/kmsg interface")
    7ff9554bb578 ("printk: convert byte-buffer to variable-length record buffer")

    with a number of follow-up commits to fix some painful fallout from that
    conversion. Over all, it took a couple of months to sort out most of
    it. But the upside was that you could have concurrent readers (and
    writers) of the kernel log and not have lines with mixed output in them.

    And one particular pain-point for the record-based kernel logging was
    exactly the fragmentary lines that are generated in smaller chunks. In
    order to still log them as one recrod, the continuation lines need to be
    attached to the previous record properly.

    However the explicit continuation record marker that is actually useful
    for this exact case was actually removed in aroundm the same time by commit

    61e99ab8e35a ("printk: remove the now unnecessary "C" annotation for KERN_CONT")

    due to the incorrect belief that KERN_CONT wasn't meaningful. The
    ambiguity between "is this a continuation line" or "is this a plain
    printk with no log level information" was reintroduced, and in fact
    became an even bigger pain point because there was now the whole
    record-level merging of kernel messages going on.

    This patch reinstates the KERN_CONT as a real non-empty string marker,
    so that the ambiguity is fixed once again.

    But it's not a plain revert of that original removal: in the four years
    since we made KERN_CONT an empty string again, not only has the format
    of the log level markers changed, we've also had some usage changes in
    this area.

    For example, some ACPI code seems to use KERN_CONT _together_ with a log
    level, and now uses both the KERN_CONT marker and (for example) a
    KERN_INFO marker to show that it's an informational continuation of a
    line.

    Which is actually not a bad idea - if the continuation line cannot be
    attached to its predecessor, without the log level information we don't
    know what log level to assign to it (and we traditionally just assigned
    it the default loglevel). So having both a log level and the KERN_CONT
    marker is not necessarily a bad idea, but it does mean that we need to
    actually iterate over potentially multiple markers, rather than just a
    single one.

    Also, since KERN_CONT was still conceptually needed, and encouraged, but
    didn't actually _do_ anything, we've also had the reverse problem:
    rather than having too many annotations it has too few, and there is bit
    rot with code that no longer marks the continuation lines with the
    KERN_CONT marker.

    So this patch not only re-instates the non-empty KERN_CONT marker, it
    also fixes up the cases of bit-rot I noticed in my own logs.

    There are probably other cases where KERN_CONT will be needed to be
    added, either because it is new code that never dealt with the need for
    KERN_CONT, or old code that has bitrotted without anybody noticing.

    That said, we should strive to avoid the need for KERN_CONT. It does
    result in real problems for logging, and should generally not be seen as
    a good feature. If we some day can get rid of the feature entirely,
    because nobody does any fragmented printk calls, that would be lovely.

    But until that point, let's at mark the code that relies on the hacky
    multi-fragment kernel printk's. Not only does it avoid the ambiguity,
    it also annotates code as "maybe this would be good to fix some day".

    (That said, particularly during single-threaded bootup, the downsides of
    KERN_CONT are very limited. Things get much hairier when you have
    multiple threads going on and user level reading and writing logs too).

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

08 Oct, 2016

3 commits


05 Oct, 2016

2 commits

  • Pull security subsystem updates from James Morris:

    SELinux/LSM:
    - overlayfs support, necessary for container filesystems

    LSM:
    - finally remove the kernel_module_from_file hook

    Smack:
    - treat signal delivery as an 'append' operation

    TPM:
    - lots of bugfixes & updates

    Audit:
    - new audit data type: LSM_AUDIT_DATA_FILE

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (47 commits)
    Revert "tpm/tpm_crb: implement tpm crb idle state"
    Revert "tmp/tpm_crb: fix Intel PTT hw bug during idle state"
    Revert "tpm/tpm_crb: open code the crb_init into acpi_add"
    Revert "tmp/tpm_crb: implement runtime pm for tpm_crb"
    lsm,audit,selinux: Introduce a new audit data type LSM_AUDIT_DATA_FILE
    tmp/tpm_crb: implement runtime pm for tpm_crb
    tpm/tpm_crb: open code the crb_init into acpi_add
    tmp/tpm_crb: fix Intel PTT hw bug during idle state
    tpm/tpm_crb: implement tpm crb idle state
    tpm: add check for minimum buffer size in tpm_transmit()
    tpm: constify TPM 1.x header structures
    tpm/tpm_crb: fix the over 80 characters checkpatch warring
    tpm/tpm_crb: drop useless cpu_to_le32 when writing to registers
    tpm/tpm_crb: cache cmd_size register value.
    tmp/tpm_crb: drop include to platform_device
    tpm/tpm_tis: remove unused itpm variable
    tpm_crb: fix incorrect values of cmdReady and goIdle bits
    tpm_crb: refine the naming of constants
    tpm_crb: remove wmb()'s
    tpm_crb: fix crb_req_canceled behavior
    ...

    Linus Torvalds
     
  • Pull audit updates from Paul Moore:
    "Another relatively small pull request for v4.9 with just two patches.

    The patch from Richard updates the list of features we support and
    report back to userspace; this should have been sent earlier with the
    rest of the v4.8 patches but it got lost in my inbox.

    The second patch fixes a problem reported by our Android friends where
    we weren't very consistent in recording PIDs"

    * 'stable-4.9' of git://git.infradead.org/users/pcmoore/audit:
    audit: add exclude filter extension to feature bitmap
    audit: consistently record PIDs with task_tgid_nr()

    Linus Torvalds
     

29 Sep, 2016

1 commit

  • If there is an error creating a directory with securityfs_create_dir,
    the error is propagated via ERR_PTR but the function comment claims that
    NULL is returned.

    This is a similar commit to 88e6c94cda322ff2b32f72bb8d96f9675cdad8aa
    ("fix long-broken securityfs_create_file comment") that did not fix
    securityfs_create_dir comment at the same time.

    Signed-off-by: Laurent Georget
    Signed-off-by: Jiri Kosina

    Laurent Georget
     

28 Sep, 2016

1 commit

  • CURRENT_TIME macro is not appropriate for filesystems as it
    doesn't use the right granularity for filesystem timestamps.
    Use current_time() instead.

    CURRENT_TIME is also not y2038 safe.

    This is also in preparation for the patch that transitions
    vfs timestamps to use 64 bit time and hence make them
    y2038 safe. As part of the effort current_time() will be
    extended to do range checks. Hence, it is necessary for all
    file system timestamps to use current_time(). Also,
    current_time() will be transitioned along with vfs to be
    y2038 safe.

    Note that whenever a single call to current_time() is used
    to change timestamps in different inodes, it is because they
    share the same time granularity.

    Signed-off-by: Deepa Dinamani
    Reviewed-by: Arnd Bergmann
    Acked-by: Felipe Balbi
    Acked-by: Steven Whitehouse
    Acked-by: Ryusuke Konishi
    Acked-by: David Sterba
    Signed-off-by: Al Viro

    Deepa Dinamani
     

27 Sep, 2016

2 commits


24 Sep, 2016

1 commit


22 Sep, 2016

1 commit


21 Sep, 2016

1 commit


20 Sep, 2016

1 commit

  • Right now LSM_AUDIT_DATA_PATH type contains "struct path" in union "u"
    of common_audit_data. This information is used to print path of file
    at the same time it is also used to get to dentry and inode. And this
    inode information is used to get to superblock and device and print
    device information.

    This does not work well for layered filesystems like overlay where dentry
    contained in path is overlay dentry and not the real dentry of underlying
    file system. That means inode retrieved from dentry is also overlay
    inode and not the real inode.

    SELinux helpers like file_path_has_perm() are doing checks on inode
    retrieved from file_inode(). This returns the real inode and not the
    overlay inode. That means we are doing check on real inode but for audit
    purposes we are printing details of overlay inode and that can be
    confusing while debugging.

    Hence, introduce a new type LSM_AUDIT_DATA_FILE which carries file
    information and inode retrieved is real inode using file_inode(). That
    way right avc denied information is given to user.

    For example, following is one example avc before the patch.

    type=AVC msg=audit(1473360868.399:214): avc: denied { read open } for
    pid=1765 comm="cat"
    path="/root/.../overlay/container1/merged/readfile"
    dev="overlay" ino=21443
    scontext=unconfined_u:unconfined_r:test_overlay_client_t:s0:c10,c20
    tcontext=unconfined_u:object_r:test_overlay_files_ro_t:s0
    tclass=file permissive=0

    It looks as follows after the patch.

    type=AVC msg=audit(1473360017.388:282): avc: denied { read open } for
    pid=2530 comm="cat"
    path="/root/.../overlay/container1/merged/readfile"
    dev="dm-0" ino=2377915
    scontext=unconfined_u:unconfined_r:test_overlay_client_t:s0:c10,c20
    tcontext=unconfined_u:object_r:test_overlay_files_ro_t:s0
    tclass=file permissive=0

    Notice that now dev information points to "dm-0" device instead of
    "overlay" device. This makes it clear that check failed on underlying
    inode and not on the overlay inode.

    Signed-off-by: Vivek Goyal
    [PM: slight tweaks to the description to make checkpatch.pl happy]
    Signed-off-by: Paul Moore

    Vivek Goyal
     

19 Sep, 2016

1 commit


16 Sep, 2016

1 commit

  • Ima tries to call ->setxattr() on overlayfs dentry after having locked
    underlying inode, which results in a deadlock.

    Reported-by: Krisztian Litkey
    Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay and f_inode to the underlay")
    Signed-off-by: Miklos Szeredi
    Cc: # v4.2
    Cc: Mimi Zohar

    Miklos Szeredi
     

14 Sep, 2016

1 commit

  • Fix to return error code -EINVAL from the error handling case instead
    of 0 (rc is overwrite to 0 when policyvers >=
    POLICYDB_VERSION_ROLETRANS), as done elsewhere in this function.

    Signed-off-by: Wei Yongjun
    [PM: normalize "selinux" in patch subject, description line wrap]
    Signed-off-by: Paul Moore

    Wei Yongjun
     

09 Sep, 2016

1 commit

  • Under a strict subject/object security policy delivering a
    signal or delivering network IPC could be considered either
    a write or an append operation. The original choice to make
    both write operations leads to an issue where IPC delivery
    is desired under policy, but delivery of signals is not.
    This patch provides the option of making signal delivery
    an append operation, allowing Smack rules that deny signal
    delivery while allowing IPC. This was requested for Tizen.

    Signed-off-by: Casey Schaufler

    Casey Schaufler
     

08 Sep, 2016

2 commits

  • Pull more hardened usercopyfixes from Kees Cook:

    - force check_object_size() to be inline too

    - move page-spanning check behind a CONFIG since it's triggering false
    positives

    [ Changed the page-spanning config option to depend on EXPERT in the
    merge. That way it still gets build testing, and you can enable it if
    you want to, but is never enabled for "normal" configurations ]

    * tag 'usercopy-v4.8-rc6-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
    usercopy: remove page-spanning test for now
    usercopy: force check_object_size() inline

    Linus Torvalds
     
  • A custom allocator without __GFP_COMP that copies to userspace has been
    found in vmw_execbuf_process[1], so this disables the page-span checker
    by placing it behind a CONFIG for future work where such things can be
    tracked down later.

    [1] https://bugzilla.redhat.com/show_bug.cgi?id=1373326

    Reported-by: Vinson Lee
    Fixes: f5509cc18daa ("mm: Hardened usercopy")
    Signed-off-by: Kees Cook

    Kees Cook
     

31 Aug, 2016

2 commits


30 Aug, 2016

2 commits

  • libsepol pointed out an issue where its possible to have
    an unitialized jmp and invalid dereference, fix this.
    While we're here, zero allocate all the *_val_to_struct
    structures.

    Signed-off-by: William Roberts
    Signed-off-by: Paul Moore

    William Roberts
     
  • When count is 0 and the highbit is not zero, the ebitmap is not
    valid and the internal node is not allocated. This causes issues
    when routines, like mls_context_isvalid() attempt to use the
    ebitmap_for_each_bit() and ebitmap_node_get_bit() as they assume
    a highbit > 0 will have a node allocated.

    Signed-off-by: William Roberts
    Signed-off-by: Paul Moore

    William Roberts
     

24 Aug, 2016

1 commit


20 Aug, 2016

1 commit

  • The kernel test robot reported a usercopy failure in the new hardened
    sanity checks, due to a page-crossing copy of the FPU state into the
    task structure.

    This happened because the kernel test robot was testing with SLOB, which
    doesn't actually do the required book-keeping for slab allocations, and
    as a result the hardening code didn't realize that the task struct
    allocation was one single allocation - and the sanity checks fail.

    Since SLOB doesn't even claim to support hardening (and you really
    shouldn't use it), the straightforward solution is to just make the
    usercopy hardening code depend on the allocator supporting it.

    Reported-by: kernel test robot
    Cc: Kees Cook
    Signed-off-by: Linus Torvalds

    Linus Torvalds