05 Oct, 2016

1 commit

  • 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
     

31 Aug, 2016

1 commit

  • Unfortunately we record PIDs in audit records using a variety of
    methods despite the correct way being the use of task_tgid_nr().
    This patch converts all of these callers, except for the case of
    AUDIT_SET in audit_receive_msg() (see the comment in the code).

    Reported-by: Jeff Vander Stoep
    Signed-off-by: Paul Moore

    Paul Moore
     

30 Jul, 2016

1 commit

  • Pull audit updates from Paul Moore:
    "Six audit patches for 4.8.

    There are a couple of style and minor whitespace tweaks for the logs,
    as well as a minor fixup to catch errors on user filter rules, however
    the major improvements are a fix to the s390 syscall argument masking
    code (reviewed by the nice s390 folks), some consolidation around the
    exclude filtering (less code, always a win), and a double-fetch fix
    for recording the execve arguments"

    * 'stable-4.8' of git://git.infradead.org/users/pcmoore/audit:
    audit: fix a double fetch in audit_log_single_execve_arg()
    audit: fix whitespace in CWD record
    audit: add fields to exclude filter by reusing user filter
    s390: ensure that syscall arguments are properly masked on s390
    audit: fix some horrible switch statement style crimes
    audit: fixup: log on errors from filter user rules

    Linus Torvalds
     

30 Jun, 2016

1 commit

  • Pull audit fixes from Paul Moore:
    "Two small patches to fix audit problems in 4.7-rcX: the first fixes a
    potential kref leak, the second removes some header file noise.

    The first is an important bug fix that really should go in before 4.7
    is released, the second is not critical, but falls into the very-nice-
    to-have category so I'm including in the pull request.

    Both patches are straightforward, self-contained, and pass our
    testsuite without problem"

    * 'stable-4.7' of git://git.infradead.org/users/pcmoore/audit:
    audit: move audit_get_tty to reduce scope and kabi changes
    audit: move calcs after alloc and check when logging set loginuid

    Linus Torvalds
     

29 Jun, 2016

1 commit


27 Jun, 2016

1 commit

  • RFE: add additional fields for use in audit filter exclude rules
    https://github.com/linux-audit/audit-kernel/issues/5

    Re-factor and combine audit_filter_type() with audit_filter_user() to
    use audit_filter_user_rules() to enable the exclude filter to
    additionally filter on PID, UID, GID, AUID, LOGINUID_SET, SUBJ_*.

    The process of combining the similar audit_filter_user() and
    audit_filter_type() functions, required inverting the meaning and
    including the ALWAYS action of the latter.

    Include audit_filter_user_rules() into audit_filter(), removing
    unneeded logic in the process.

    Keep the check to quit early if the list is empty.

    Signed-off-by: Richard Guy Briggs
    [PM: checkpatch.pl fixes - whitespace damage, wrapped description]
    Signed-off-by: Paul Moore

    Richard Guy Briggs
     

19 May, 2016

1 commit

  • Pull audit updates from Paul Moore:
    "Four small audit patches for 4.7.

    Two are simple cleanups around the audit thread management code, one
    adds a tty field to AUDIT_LOGIN events, and the final patch makes
    tty_name() usable regardless of CONFIG_TTY.

    Nothing controversial, and it all passes our regression test"

    * 'stable-4.7' of git://git.infradead.org/users/pcmoore/audit:
    tty: provide tty_name() even without CONFIG_TTY
    audit: add tty field to LOGIN event
    audit: we don't need to __set_current_state(TASK_RUNNING)
    audit: cleanup prune_tree_thread

    Linus Torvalds
     

27 Apr, 2016

1 commit

  • The tty field was missing from AUDIT_LOGIN events.

    Refactor code to create a new function audit_get_tty(), using it to
    replace the call in audit_log_task_info() and to add it to
    audit_log_set_loginuid(). Lock and bump the kref to protect it, adding
    audit_put_tty() alias to decrement it.

    Signed-off-by: Richard Guy Briggs
    Signed-off-by: Paul Moore

    Richard Guy Briggs
     

05 Apr, 2016

1 commit


20 Mar, 2016

1 commit

  • Pull audit updates from Paul Moore:
    "A small set of patches for audit this time; just three in total and
    one is a spelling fix.

    The two patches with actual content are designed to help prevent new
    instances of auditd from displacing an existing, functioning auditd
    and to generate a log of the attempt. Not to worry, dead/stuck auditd
    instances can still be replaced by a new instance without problem.

    Nothing controversial, and everything passes our regression suite"

    * 'stable-4.6' of git://git.infradead.org/users/pcmoore/audit:
    audit: Fix typo in comment
    audit: log failed attempts to change audit_pid configuration
    audit: stop an old auditd being starved out by a new auditd

    Linus Torvalds
     

28 Jan, 2016

2 commits

  • The audit_tty and audit_tty_log_passwd fields are actually bool
    values, so merge into single memory location to access atomically.

    NB: audit log operations may still occur after tty audit is disabled
    which is consistent with the existing functionality

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • tty_audit_push() and tty_audit_push_current() perform identical
    tasks; eliminate the tty_audit_push() implementation and the
    tty_audit_push_current() name.

    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     

26 Jan, 2016

2 commits

  • Failed attempts to change the audit_pid configuration are not presently
    logged. One case is an attempt to starve an old auditd by starting up
    a new auditd when the old one is still alive and active. The other
    case is an attempt to orphan a new auditd when an old auditd shuts
    down.

    Log both as AUDIT_CONFIG_CHANGE messages with failure result.

    Signed-off-by: Richard Guy Briggs
    Signed-off-by: Paul Moore

    Richard Guy Briggs
     
  • Nothing prevents a new auditd starting up and replacing a valid
    audit_pid when an old auditd is still running, effectively starving out
    the old auditd since audit_pid no longer points to the old valid
    auditd.

    If no message to auditd has been attempted since auditd died
    unnaturally or got killed, audit_pid will still indicate it is alive.
    There isn't an easy way to detect if an old auditd is still running on
    the existing audit_pid other than attempting to send a message to see
    if it fails. An -ECONNREFUSED almost certainly means it disappeared
    and can be replaced. Other errors are not so straightforward and may
    indicate transient problems that will resolve themselves and the old
    auditd will recover. Yet others will likely need manual intervention
    for which a new auditd will not solve the problem.

    Send a new message type (AUDIT_REPLACE) to the old auditd containing a
    u32 with the PID of the new auditd. If the audit replace message
    succeeds (or doesn't fail with certainty), fail to register the new
    auditd and return an error (-EEXIST).

    This is expected to make the patch preventing an old auditd orphaning a
    new auditd redundant.

    V3: Switch audit message type from 1000 to 1300 block.

    Signed-off-by: Richard Guy Briggs
    Signed-off-by: Paul Moore

    Richard Guy Briggs
     

18 Jan, 2016

1 commit

  • Pull security subsystem updates from James Morris:

    - EVM gains support for loading an x509 cert from the kernel
    (EVM_LOAD_X509), into the EVM trusted kernel keyring.

    - Smack implements 'file receive' process-based permission checking for
    sockets, rather than just depending on inode checks.

    - Misc enhancments for TPM & TPM2.

    - Cleanups and bugfixes for SELinux, Keys, and IMA.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (41 commits)
    selinux: Inode label revalidation performance fix
    KEYS: refcount bug fix
    ima: ima_write_policy() limit locking
    IMA: policy can be updated zero times
    selinux: rate-limit netlink message warnings in selinux_nlmsg_perm()
    selinux: export validatetrans decisions
    gfs2: Invalid security labels of inodes when they go invalid
    selinux: Revalidate invalid inode security labels
    security: Add hook to invalidate inode security labels
    selinux: Add accessor functions for inode->i_security
    security: Make inode argument of inode_getsecid non-const
    security: Make inode argument of inode_getsecurity non-const
    selinux: Remove unused variable in selinux_inode_init_security
    keys, trusted: seal with a TPM2 authorization policy
    keys, trusted: select hash algorithm for TPM2 chips
    keys, trusted: fix: *do not* allow duplicate key options
    tpm_ibmvtpm: properly handle interrupted packet receptions
    tpm_tis: Tighten IRQ auto-probing
    tpm_tis: Refactor the interrupt setup
    tpm_tis: Get rid of the duplicate IRQ probing code
    ...

    Linus Torvalds
     

13 Jan, 2016

5 commits


25 Dec, 2015

1 commit


07 Nov, 2015

1 commit

  • …d avoiding waking kswapd

    __GFP_WAIT has been used to identify atomic context in callers that hold
    spinlocks or are in interrupts. They are expected to be high priority and
    have access one of two watermarks lower than "min" which can be referred
    to as the "atomic reserve". __GFP_HIGH users get access to the first
    lower watermark and can be called the "high priority reserve".

    Over time, callers had a requirement to not block when fallback options
    were available. Some have abused __GFP_WAIT leading to a situation where
    an optimisitic allocation with a fallback option can access atomic
    reserves.

    This patch uses __GFP_ATOMIC to identify callers that are truely atomic,
    cannot sleep and have no alternative. High priority users continue to use
    __GFP_HIGH. __GFP_DIRECT_RECLAIM identifies callers that can sleep and
    are willing to enter direct reclaim. __GFP_KSWAPD_RECLAIM to identify
    callers that want to wake kswapd for background reclaim. __GFP_WAIT is
    redefined as a caller that is willing to enter direct reclaim and wake
    kswapd for background reclaim.

    This patch then converts a number of sites

    o __GFP_ATOMIC is used by callers that are high priority and have memory
    pools for those requests. GFP_ATOMIC uses this flag.

    o Callers that have a limited mempool to guarantee forward progress clear
    __GFP_DIRECT_RECLAIM but keep __GFP_KSWAPD_RECLAIM. bio allocations fall
    into this category where kswapd will still be woken but atomic reserves
    are not used as there is a one-entry mempool to guarantee progress.

    o Callers that are checking if they are non-blocking should use the
    helper gfpflags_allow_blocking() where possible. This is because
    checking for __GFP_WAIT as was done historically now can trigger false
    positives. Some exceptions like dm-crypt.c exist where the code intent
    is clearer if __GFP_DIRECT_RECLAIM is used instead of the helper due to
    flag manipulations.

    o Callers that built their own GFP flags instead of starting with GFP_KERNEL
    and friends now also need to specify __GFP_KSWAPD_RECLAIM.

    The first key hazard to watch out for is callers that removed __GFP_WAIT
    and was depending on access to atomic reserves for inconspicuous reasons.
    In some cases it may be appropriate for them to use __GFP_HIGH.

    The second key hazard is callers that assembled their own combination of
    GFP flags instead of starting with something like GFP_KERNEL. They may
    now wish to specify __GFP_KSWAPD_RECLAIM. It's almost certainly harmless
    if it's missed in most cases as other activity will wake kswapd.

    Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Acked-by: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Vitaly Wool <vitalywool@gmail.com>
    Cc: Rik van Riel <riel@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

    Mel Gorman
     

04 Nov, 2015

4 commits

  • It always returns zero and no one is checking the return value.

    Signed-off-by: Paul Moore

    Paul Moore
     
  • Variable rc in not required as it is just used for unchanged for return,
    and return is always 0 in the function.

    Signed-off-by: Saurabh Sengar
    [PM: fixed spelling errors in description]
    Signed-off-by: Paul Moore

    Saurabh Sengar
     
  • This patch makes audit_string_contains_control return bool to improve
    readability due to this particular function only using either one or
    zero as its return value.

    Signed-off-by: Yaowei Bai
    [PM: tweaked subject line]
    Signed-off-by: Paul Moore

    Yaowei Bai
     
  • There are several reports of the kernel losing contact with auditd when
    it is, in fact, still running. When this happens, kernel syslogs show:
    "audit: *NO* daemon at audit_pid="
    although auditd is still running, and is apparently happy, listening on
    the netlink socket. The pid in the "*NO* daemon" message matches the pid
    of the running auditd process. Restarting auditd solves this.

    The problem appears to happen randomly, and doesn't seem to be strongly
    correlated to the rate of audit events being logged. The problem
    happens fairly regularly (every few days), but not yet reproduced to
    order.

    On production kernels, BUG_ON() is a no-op, so any error will trigger
    this.

    Commit 34eab0a7cd45 ("audit: prevent an older auditd shutdown from
    orphaning a newer auditd startup") eliminates one possible cause. This
    isn't the case here, since the PID in the error message and the PID of
    the running auditd match.

    The primary expected cause of error here is -ECONNREFUSED when the audit
    daemon goes away, when netlink_getsockbyportid() can't find the auditd
    portid entry in the netlink audit table (or there is no receive
    function). If -EPERM is returned, that situation isn't likely to be
    resolved in a timely fashion without administrator intervention. In
    both cases, reset the audit_pid. This does not rule out a race
    condition. SELinux is expected to return zero since this isn't an INET
    or INET6 socket. Other LSMs may have other return codes. Log the error
    code for better diagnosis in the future.

    In the case of -ENOMEM, the situation could be temporary, based on local
    or general availability of buffers. -EAGAIN should never happen since
    the netlink audit (kernel) socket is set to MAX_SCHEDULE_TIMEOUT.
    -ERESTARTSYS and -EINTR are not expected since this kernel thread is not
    expected to receive signals. In these cases (or any other unexpected
    ones for now), report the error and re-schedule the thread, retrying up
    to 5 times.

    v2:
    Removed BUG_ON().
    Moved comma in pr_*() statements.
    Removed audit_strerror() text.

    Reported-by: Vipin Rathor
    Reported-by:
    Signed-off-by: Richard Guy Briggs
    [PM: applied rgb's fixup patch to correct audit_log_lost() format issues]
    Signed-off-by: Paul Moore

    Richard Guy Briggs
     

09 Sep, 2015

1 commit

  • Pull audit update from Paul Moore:
    "This is one of the larger audit patchsets in recent history,
    consisting of eight patches and almost 400 lines of changes.

    The bulk of the patchset is the new "audit by executable"
    functionality which allows admins to set an audit watch based on the
    executable on disk. Prior to this, admins could only track an
    application by PID, which has some obvious limitations.

    Beyond the new functionality we also have some refcnt fixes and a few
    minor cleanups"

    * 'upstream' of git://git.infradead.org/users/pcmoore/audit:
    fixup: audit: implement audit by executable
    audit: implement audit by executable
    audit: clean simple fsnotify implementation
    audit: use macros for unset inode and device values
    audit: make audit_del_rule() more robust
    audit: fix uninitialized variable in audit_add_rule()
    audit: eliminate unnecessary extra layer of watch parent references
    audit: eliminate unnecessary extra layer of watch references

    Linus Torvalds
     

07 Aug, 2015

1 commit


28 Jun, 2015

1 commit

  • Pull audit updates from Paul Moore:
    "Four small audit patches for v4.2, all bug fixes. Only 10 lines of
    change this time so very unremarkable, the patch subject lines pretty
    much tell the whole story"

    * 'upstream' of git://git.infradead.org/users/pcmoore/audit:
    audit: Fix check of return value of strnlen_user()
    audit: obsolete audit_context check is removed in audit_filter_rules()
    audit: fix for typo in comment to function audit_log_link_denied()
    lsm: rename duplicate labels in LSM_AUDIT_DATA_TASK audit message type

    Linus Torvalds
     

30 May, 2015

1 commit


27 Apr, 2015

1 commit

  • Pull fourth vfs update from Al Viro:
    "d_inode() annotations from David Howells (sat in for-next since before
    the beginning of merge window) + four assorted fixes"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    RCU pathwalk breakage when running into a symlink overmounting something
    fix I_DIO_WAKEUP definition
    direct-io: only inc/dec inode->i_dio_count for file systems
    fs/9p: fix readdir()
    VFS: assorted d_backing_inode() annotations
    VFS: fs/inode.c helpers: d_inode() annotations
    VFS: fs/cachefiles: d_backing_inode() annotations
    VFS: fs library helpers: d_inode() annotations
    VFS: assorted weird filesystems: d_inode() annotations
    VFS: normal filesystems (and lustre): d_inode() annotations
    VFS: security/: d_inode() annotations
    VFS: security/: d_backing_inode() annotations
    VFS: net/: d_inode() annotations
    VFS: net/unix: d_backing_inode() annotations
    VFS: kernel/: d_inode() annotations
    VFS: audit: d_backing_inode() annotations
    VFS: Fix up some ->d_inode accesses in the chelsio driver
    VFS: Cachefiles should perform fs modifications on the top layer only
    VFS: AF_UNIX sockets should call mknod on the top layer only

    Linus Torvalds
     

23 Apr, 2015

1 commit

  • Pull audit fixes from Paul Moore:
    "Seven audit patches for v4.1, all bug fixes.

    The largest, and perhaps most significant commit helps resolve some
    memory pressure issues related to the inode cache and audit, there are
    also a few small commits which help resolve some timing issues with
    the audit log queue, and the rest fall into the always popular "code
    clean-up" category.

    In general, nothing really substantial, just a nice set of maintenance
    patches"

    * 'upstream' of git://git.infradead.org/users/pcmoore/audit:
    audit: Remove condition which always evaluates to false
    audit: reduce mmap_sem hold for mm->exe_file
    audit: consolidate handling of mm->exe_file
    audit: code clean up
    audit: don't reset working wait time accidentally with auditd
    audit: don't lose set wait time on first successful call to audit_log_start()
    audit: move the tree pruning to a dedicated thread

    Linus Torvalds
     

16 Apr, 2015

1 commit


14 Mar, 2015

1 commit

  • After commit 3e1d0bb6224f019893d1c498cc3327559d183674 ("audit: Convert int limit
    uses to u32"), by converting an int to u32, few conditions will always evaluate
    to false.

    These warnings were emitted during compilation:

    kernel/audit.c: In function ‘audit_set_enabled’:
    kernel/audit.c:347:2: warning: comparison of unsigned expression < 0 is always
    false [-Wtype-limits]
    if (state < AUDIT_OFF || state > AUDIT_LOCKED)
    ^
    kernel/audit.c: In function ‘audit_receive_msg’:
    kernel/audit.c:880:9: warning: comparison of unsigned expression < 0 is
    always false [-Wtype-limits]
    if (s.backlog_wait_time < 0 ||

    The following patch removes those unnecessary conditions.

    Signed-off-by: Pranith Kumar
    Signed-off-by: Paul Moore

    Pranith Kumar
     

24 Feb, 2015

5 commits


31 Dec, 2014

1 commit

  • Pull networking fixes from David Miller:

    1) Fix double SKB free in bluetooth 6lowpan layer, from Jukka Rissanen.

    2) Fix receive checksum handling in enic driver, from Govindarajulu
    Varadarajan.

    3) Fix NAPI poll list corruption in virtio_net and caif_virtio, from
    Herbert Xu. Also, add code to detect drivers that have this mistake
    in the future.

    4) Fix doorbell endianness handling in mlx4 driver, from Amir Vadai.

    5) Don't clobber IP6CB() before xfrm6_policy_check() is called in TCP
    input path,f rom Nicolas Dichtel.

    6) Fix MPLS action validation in openvswitch, from Pravin B Shelar.

    7) Fix double SKB free in vxlan driver, also from Pravin.

    8) When we scrub a packet, which happens when we are switching the
    context of the packet (namespace, etc.), we should reset the
    secmark. From Thomas Graf.

    9) ->ndo_gso_check() needs to do more than return true/false, it also
    has to allow the driver to clear netdev feature bits in order for
    the caller to be able to proceed properly. From Jesse Gross.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (62 commits)
    genetlink: A genl_bind() to an out-of-range multicast group should not WARN().
    netlink/genetlink: pass network namespace to bind/unbind
    ne2k-pci: Add pci_disable_device in error handling
    bonding: change error message to debug message in __bond_release_one()
    genetlink: pass multicast bind/unbind to families
    netlink: call unbind when releasing socket
    netlink: update listeners directly when removing socket
    genetlink: pass only network namespace to genl_has_listeners()
    netlink: rename netlink_unbind() to netlink_undo_bind()
    net: Generalize ndo_gso_check to ndo_features_check
    net: incorrect use of init_completion fixup
    neigh: remove next ptr from struct neigh_table
    net: xilinx: Remove unnecessary temac_property in the driver
    net: phy: micrel: use generic config_init for KSZ8021/KSZ8031
    net/core: Handle csum for CHECKSUM_COMPLETE VXLAN forwarding
    openvswitch: fix odd_ptr_err.cocci warnings
    Bluetooth: Fix accepting connections when not using mgmt
    Bluetooth: Fix controller configuration with HCI_QUIRK_INVALID_BDADDR
    brcmfmac: Do not crash if platform data is not populated
    ipw2200: select CFG80211_WEXT
    ...

    Linus Torvalds