04 Mar, 2013

2 commits

  • Dave Jones writes:
    > Just hit this on Linus' current tree.
    >
    > [ 89.621770] BUG: unable to handle kernel NULL pointer dereference at 00000000000000c8
    > [ 89.623111] IP: [] commit_creds+0x250/0x2f0
    > [ 89.624062] PGD 122bfd067 PUD 122bfe067 PMD 0
    > [ 89.624901] Oops: 0000 [#1] PREEMPT SMP
    > [ 89.625678] Modules linked in: caif_socket caif netrom bridge hidp 8021q garp stp mrp rose llc2 af_rxrpc phonet af_key binfmt_misc bnep l2tp_ppp can_bcm l2tp_core pppoe pppox can_raw scsi_transport_iscsi ppp_generic slhc nfnetlink can ipt_ULOG ax25 decnet irda nfc rds x25 crc_ccitt appletalk atm ipx p8023 psnap p8022 llc lockd sunrpc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_conntrack nf_conntrack ip6table_filter ip6_tables btusb bluetooth snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_pcm vhost_net snd_page_alloc snd_timer tun macvtap usb_debug snd rfkill microcode macvlan edac_core pcspkr serio_raw kvm_amd soundcore kvm r8169 mii
    > [ 89.637846] CPU 2
    > [ 89.638175] Pid: 782, comm: trinity-main Not tainted 3.8.0+ #63 Gigabyte Technology Co., Ltd. GA-MA78GM-S2H/GA-MA78GM-S2H
    > [ 89.639850] RIP: 0010:[] [] commit_creds+0x250/0x2f0
    > [ 89.641161] RSP: 0018:ffff880115657eb8 EFLAGS: 00010207
    > [ 89.641984] RAX: 00000000000003e8 RBX: ffff88012688b000 RCX: 0000000000000000
    > [ 89.643069] RDX: 0000000000000000 RSI: ffffffff81c32960 RDI: ffff880105839600
    > [ 89.644167] RBP: ffff880115657ed8 R08: 0000000000000000 R09: 0000000000000000
    > [ 89.645254] R10: 0000000000000001 R11: 0000000000000246 R12: ffff880105839600
    > [ 89.646340] R13: ffff88011beea490 R14: ffff88011beea490 R15: 0000000000000000
    > [ 89.647431] FS: 00007f3ac063b740(0000) GS:ffff88012b200000(0000) knlGS:0000000000000000
    > [ 89.648660] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    > [ 89.649548] CR2: 00000000000000c8 CR3: 0000000122bfc000 CR4: 00000000000007e0
    > [ 89.650635] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    > [ 89.651723] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    > [ 89.652812] Process trinity-main (pid: 782, threadinfo ffff880115656000, task ffff88011beea490)
    > [ 89.654128] Stack:
    > [ 89.654433] 0000000000000000 ffff8801058396a0 ffff880105839600 ffff88011beeaa78
    > [ 89.655769] ffff880115657ef8 ffffffff812c7d9b ffffffff82079be0 0000000000000000
    > [ 89.657073] ffff880115657f28 ffffffff8106c665 0000000000000002 ffff880115657f58
    > [ 89.658399] Call Trace:
    > [ 89.658822] [] key_change_session_keyring+0xfb/0x140
    > [ 89.659845] [] task_work_run+0xa5/0xd0
    > [ 89.660698] [] do_notify_resume+0x71/0xb0
    > [ 89.661581] [] int_signal+0x12/0x17
    > [ 89.662385] Code: 24 90 00 00 00 48 8b b3 90 00 00 00 49 8b 4c 24 40 48 39 f2 75 08 e9 83 00 00 00 48 89 ca 48 81 fa 60 29 c3 81 0f 84 41 fe ff ff 8b 8a c8 00 00 00 48 39 ce 75 e4 3b 82 d0 00 00 00 0f 84 4b
    > [ 89.667778] RIP [] commit_creds+0x250/0x2f0
    > [ 89.668733] RSP
    > [ 89.669301] CR2: 00000000000000c8
    >
    > My fastest trinity induced oops yet!
    >
    >
    > Appears to be..
    >
    > if ((set_ns == subset_ns->parent) &&
    > 850: 48 8b 8a c8 00 00 00 mov 0xc8(%rdx),%rcx
    >
    > from the inlined cred_cap_issubset

    By historical accident we have been reading trying to set new->user_ns
    from new->user_ns. Which is totally silly as new->user_ns is NULL (as
    is every other field in new except session_keyring at that point).

    The intent is clearly to copy all of the fields from old to new so copy
    old->user_ns into into new->user_ns.

    Cc: stable@vger.kernel.org
    Reported-by: Dave Jones
    Tested-by: Dave Jones
    Acked-by: Serge Hallyn
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     
  • Pull more VFS bits from Al Viro:
    "Unfortunately, it looks like xattr series will have to wait until the
    next cycle ;-/

    This pile contains 9p cleanups and fixes (races in v9fs_fid_add()
    etc), fixup for nommu breakage in shmem.c, several cleanups and a bit
    more file_inode() work"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    constify path_get/path_put and fs_struct.c stuff
    fix nommu breakage in shmem.c
    cache the value of file_inode() in struct file
    9p: if v9fs_fid_lookup() gets to asking server, it'd better have hashed dentry
    9p: make sure ->lookup() adds fid to the right dentry
    9p: untangle ->lookup() a bit
    9p: double iput() in ->lookup() if d_materialise_unique() fails
    9p: v9fs_fid_add() can't fail now
    v9fs: get rid of v9fs_dentry
    9p: turn fid->dlist into hlist
    9p: don't bother with private lock in ->d_fsdata; dentry->d_lock will do just fine
    more file_inode() open-coded instances
    selinux: opened file can't have NULL or negative ->f_path.dentry

    (In the meantime, the hlist traversal macros have changed, so this
    required a semantic conflict fixup for the newly hlistified fid->dlist)

    Linus Torvalds
     

28 Feb, 2013

2 commits

  • I'm not sure why, but the hlist for each entry iterators were conceived

    list_for_each_entry(pos, head, member)

    The hlist ones were greedy and wanted an extra parameter:

    hlist_for_each_entry(tpos, pos, head, member)

    Why did they need an extra pos parameter? I'm not quite sure. Not only
    they don't really need it, it also prevents the iterator from looking
    exactly like the list iterator, which is unfortunate.

    Besides the semantic patch, there was some manual work required:

    - Fix up the actual hlist iterators in linux/list.h
    - Fix up the declaration of other iterators based on the hlist ones.
    - A very small amount of places were using the 'node' parameter, this
    was modified to use 'obj->member' instead.
    - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
    properly, so those had to be fixed up manually.

    The semantic patch which is mostly the work of Peter Senna Tschudin is here:

    @@
    iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

    type T;
    expression a,c,d,e;
    identifier b;
    statement S;
    @@

    -T b;

    [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
    [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
    [akpm@linux-foundation.org: checkpatch fixes]
    [akpm@linux-foundation.org: fix warnings]
    [akpm@linux-foudnation.org: redo intrusive kvm changes]
    Tested-by: Peter Senna Tschudin
    Acked-by: Paul E. McKenney
    Signed-off-by: Sasha Levin
    Cc: Wu Fengguang
    Cc: Marcelo Tosatti
    Cc: Gleb Natapov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasha Levin
     
  • Signed-off-by: Al Viro

    Al Viro
     

27 Feb, 2013

1 commit

  • Pull vfs pile (part one) from Al Viro:
    "Assorted stuff - cleaning namei.c up a bit, fixing ->d_name/->d_parent
    locking violations, etc.

    The most visible changes here are death of FS_REVAL_DOT (replaced with
    "has ->d_weak_revalidate()") and a new helper getting from struct file
    to inode. Some bits of preparation to xattr method interface changes.

    Misc patches by various people sent this cycle *and* ocfs2 fixes from
    several cycles ago that should've been upstream right then.

    PS: the next vfs pile will be xattr stuff."

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (46 commits)
    saner proc_get_inode() calling conventions
    proc: avoid extra pde_put() in proc_fill_super()
    fs: change return values from -EACCES to -EPERM
    fs/exec.c: make bprm_mm_init() static
    ocfs2/dlm: use GFP_ATOMIC inside a spin_lock
    ocfs2: fix possible use-after-free with AIO
    ocfs2: Fix oops in ocfs2_fast_symlink_readpage() code path
    get_empty_filp()/alloc_file() leave both ->f_pos and ->f_version zero
    target: writev() on single-element vector is pointless
    export kernel_write(), convert open-coded instances
    fs: encode_fh: return FILEID_INVALID if invalid fid_type
    kill f_vfsmnt
    vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op
    nfsd: handle vfs_getattr errors in acl protocol
    switch vfs_getattr() to struct path
    default SET_PERSONALITY() in linux/elf.h
    ceph: prepopulate inodes only when request is aborted
    d_hash_and_lookup(): export, switch open-coded instances
    9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate()
    9p: split dropping the acls from v9fs_set_create_acl()
    ...

    Linus Torvalds
     

26 Feb, 2013

2 commits

  • very few users left...

    Signed-off-by: Al Viro

    Al Viro
     
  • Commit "85865c1 ima: add policy support for file system uuid"
    introduced a CONFIG_BLOCK dependency. This patch defines a
    wrapper called blk_part_pack_uuid(), which returns -EINVAL,
    when CONFIG_BLOCK is not defined.

    security/integrity/ima/ima_policy.c:538:4: error: implicit declaration
    of function 'part_pack_uuid' [-Werror=implicit-function-declaration]

    Changelog v2:
    - Reference commit number in patch description
    Changelog v1:
    - rename ima_part_pack_uuid() to blk_part_pack_uuid()
    - resolve scripts/checkpatch.pl warnings
    Changelog v0:
    - fix UUID scripts/Lindent msgs

    Reported-by: Randy Dunlap
    Reported-by: David Rientjes
    Signed-off-by: Mimi Zohar
    Acked-by: David Rientjes
    Acked-by: Randy Dunlap
    Cc: Jens Axboe
    Signed-off-by: James Morris

    Mimi Zohar
     

25 Feb, 2013

1 commit

  • Commit "750943a ima: remove enforce checking duplication" combined
    the 'in IMA policy' and 'enforcing file integrity' checks. For
    the non-file, kernel module verification, a specific check for
    'enforcing file integrity' was not added. This patch adds the
    check.

    Signed-off-by: Mimi Zohar
    Signed-off-by: James Morris

    Mimi Zohar
     

23 Feb, 2013

1 commit


22 Feb, 2013

2 commits

  • Commit 103a197c0c4e ("security/device_cgroup: lock assert fails in
    dev_exception_clean()") grabs devcgroup_mutex to fix assert failure, but
    a mutex can't be grabbed in rcu callback. Since there shouldn't be any
    other references when css_free is called, mutex isn't needed for list
    cleanup in devcgroup_css_free().

    Signed-off-by: Jerry Snitselaar
    Acked-by: Tejun Heo
    Acked-by: Aristeu Rozanski
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jerry Snitselaar
     
  • Pull security subsystem updates from James Morris:
    "This is basically a maintenance update for the TPM driver and EVM/IMA"

    Fix up conflicts in lib/digsig.c and security/integrity/ima/ima_main.c

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (45 commits)
    tpm/ibmvtpm: build only when IBM pseries is configured
    ima: digital signature verification using asymmetric keys
    ima: rename hash calculation functions
    ima: use new crypto_shash API instead of old crypto_hash
    ima: add policy support for file system uuid
    evm: add file system uuid to EVM hmac
    tpm_tis: check pnp_acpi_device return code
    char/tpm/tpm_i2c_stm_st33: drop temporary variable for return value
    char/tpm/tpm_i2c_stm_st33: remove dead assignment in tpm_st33_i2c_probe
    char/tpm/tpm_i2c_stm_st33: Remove __devexit attribute
    char/tpm/tpm_i2c_stm_st33: Don't use memcpy for one byte assignment
    tpm_i2c_stm_st33: removed unused variables/code
    TPM: Wait for TPM_ACCESS tpmRegValidSts to go high at startup
    tpm: Fix cancellation of TPM commands (interrupt mode)
    tpm: Fix cancellation of TPM commands (polling mode)
    tpm: Store TPM vendor ID
    TPM: Work around buggy TPMs that block during continue self test
    tpm_i2c_stm_st33: fix oops when i2c client is unavailable
    char/tpm: Use struct dev_pm_ops for power management
    TPM: STMicroelectronics ST33 I2C BUILD STUFF
    ...

    Linus Torvalds
     

21 Feb, 2013

1 commit

  • A patch to fix some unreachable code in search_my_process_keyrings() got
    applied twice by two different routes upstream as commits e67eab39bee2
    and b010520ab3d2 (both "fix unreachable code").

    Unfortunately, the second application removed something it shouldn't
    have and this wasn't detected by GIT. This is due to the patch not
    having sufficient lines of context to distinguish the two places of
    application.

    The effect of this is relatively minor: inside the kernel, the keyring
    search routines may search multiple keyrings and then prioritise the
    errors if no keys or negative keys are found in any of them. With the
    extra deletion, the presence of a negative key in the thread keyring
    (causing ENOKEY) is incorrectly overridden by an error searching the
    process keyring.

    So revert the second application of the patch.

    Signed-off-by: David Howells
    Cc: Jiri Kosina
    Cc: Andrew Morton
    Cc: stable@vger.kernel.org
    Signed-off-by: Linus Torvalds

    David Howells
     

07 Feb, 2013

1 commit

  • Asymmetric keys were introduced in linux-3.7 to verify the signature on
    signed kernel modules. The asymmetric keys infrastructure abstracts the
    signature verification from the crypto details. This patch adds IMA/EVM
    signature verification using asymmetric keys. Support for additional
    signature verification methods can now be delegated to the asymmetric
    key infrastructure.

    Although the module signature header and the IMA/EVM signature header
    could use the same format, to minimize the signature length and save
    space in the extended attribute, this patch defines a new IMA/EVM
    header format. The main difference is that the key identifier is a
    sha1[12 - 19] hash of the key modulus and exponent, similar to the
    current implementation. The only purpose of the key identifier is to
    identify the corresponding key in the kernel keyring. ima-evm-utils
    was updated to support the new signature format.

    While asymmetric signature verification functionality supports many
    different hash algorithms, the hash used in this patch is calculated
    during the IMA collection phase, based on the configured algorithm.
    The default algorithm is sha1, but for backwards compatibility md5
    is supported. Due to this current limitation, signatures should be
    generated using a sha1 hash algorithm.

    Changes in this patch:
    - Functionality has been moved to separate source file in order to get rid of
    in source #ifdefs.
    - keyid is derived according to the RFC 3280. It does not require to assign
    IMA/EVM specific "description" when loading X509 certificate. Kernel
    asymmetric key subsystem automatically generate the description. Also
    loading a certificate does not require using of ima-evm-utils and can be
    done using keyctl only.
    - keyid size is reduced to 32 bits to save xattr space. Key search is done
    using partial match functionality of asymmetric_key_match().
    - Kconfig option title was changed

    Signed-off-by: Dmitry Kasatkin
    Acked-by: David Howells
    Signed-off-by: Mimi Zohar

    Dmitry Kasatkin
     

06 Feb, 2013

4 commits

  • Rename hash calculation functions to reflect meaning
    and change argument order in conventional way.

    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: Mimi Zohar

    Dmitry Kasatkin
     
  • Old crypto hash API internally uses shash API.
    Using shash API directly is more efficient.

    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: Mimi Zohar

    Dmitry Kasatkin
     
  • The IMA policy permits specifying rules to enable or disable
    measurement/appraisal/audit based on the file system magic number.
    If, for example, the policy contains an ext4 measurement rule,
    the rule is enabled for all ext4 partitions.

    Sometimes it might be necessary to enable measurement/appraisal/audit
    only for one partition and disable it for another partition of the
    same type. With the existing IMA policy syntax, this can not be done.

    This patch provides support for IMA policy rules to specify the file
    system by its UUID (eg. fsuuid=397449cd-687d-4145-8698-7fed4a3e0363).

    For partitions not being appraised, it might be a good idea to mount
    file systems with the 'noexec' option to prevent executing non-verified
    binaries.

    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: Mimi Zohar

    Dmitry Kasatkin
     
  • EVM uses the same key for all file systems to calculate the HMAC,
    making it possible to paste inodes from one file system on to another
    one, without EVM being able to detect it. To prevent such an attack,
    it is necessary to make the EVM HMAC file system specific.

    This patch uses the file system UUID, a file system unique identifier,
    to bind the EVM HMAC to the file system. The value inode->i_sb->s_uuid
    is used for the HMAC hash calculation, instead of using it for deriving
    the file system specific key. Initializing the key for every inode HMAC
    calculation is a bit more expensive operation than adding the uuid to
    the HMAC hash.

    Changing the HMAC calculation method or adding additional info to the
    calculation, requires existing EVM labeled file systems to be relabeled.
    This patch adds a Kconfig HMAC version option for backwards compatability.

    Changelog v1:
    - squash "hmac version setting"
    Changelog v0:
    - add missing Kconfig depends (Mimi)

    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: Mimi Zohar

    Dmitry Kasatkin
     

29 Jan, 2013

1 commit

  • Pull networking updates from David Miller:
    "Much more accumulated than I would have liked due to an unexpected
    bout with a nasty flu:

    1) AH and ESP input don't set ECN field correctly because the
    transport head of the SKB isn't set correctly, fix from Li
    RongQing.

    2) If netfilter conntrack zones are disabled, we can return an
    uninitialized variable instead of the proper error code. Fix from
    Borislav Petkov.

    3) Fix double SKB free in ath9k driver beacon handling, from Felix
    Feitkau.

    4) Remove bogus assumption about netns cleanup ordering in
    nf_conntrack, from Pablo Neira Ayuso.

    5) Remove a bogus BUG_ON in the new TCP fastopen code, from Eric
    Dumazet. It uses spin_is_locked() in it's test and is therefore
    unsuitable for UP.

    6) Fix SELINUX labelling regressions added by the tuntap multiqueue
    changes, from Paul Moore.

    7) Fix CRC errors with jumbo frame receive in tg3 driver, from Nithin
    Nayak Sujir.

    8) CXGB4 driver sets interrupt coalescing parameters only on first
    queue, rather than all of them. Fix from Thadeu Lima de Souza
    Cascardo.

    9) Fix regression in the dispatch of read/write registers in dm9601
    driver, from Tushar Behera.

    10) ipv6_append_data miscalculates header length, from Romain KUNTZ.

    11) Fix PMTU handling regressions on ipv4 routes, from Steffen
    Klassert, Timo Teräs, and Julian Anastasov.

    12) In 3c574_cs driver, add necessary parenthesis to "x << y & z"
    expression. From Nickolai Zeldovich.

    13) macvlan_get_size() causes underallocation netlink message space,
    fix from Eric Dumazet.

    14) Avoid division by zero in xfrm_replay_advance_bmp(), from Nickolai
    Zeldovich. Amusingly the zero check was already there, we were
    just performing it after the modulus :-)

    15) Some more splice bug fixes from Eric Dumazet, which fix things
    mostly eminating from how we now more aggressively use high-order
    pages in SKBs.

    16) Fix size calculation bug when freeing hash tables in the IPSEC
    xfrm code, from Michal Kubecek.

    17) Fix PMTU event propagation into socket cached routes, from Steffen
    Klassert.

    18) Fix off by one in TX buffer release in netxen driver, from Eric
    Dumazet.

    19) Fix rediculous memory allocation requirements introduced by the
    tuntap multiqueue changes, from Jason Wang.

    20) Remove bogus AMD platform workaround in r8169 driver that causes
    major problems in normal operation, from Timo Teräs.

    21) virtio-net set affinity and select queue don't handle
    discontiguous cpu numbers properly, fix from Wanlong Gao.

    22) Fix a route refcounting issue in loopback driver, from Eric
    Dumazet. There's a similar fix coming that we might add to the
    macvlan driver as well.

    23) Fix SKB leaks in batman-adv's distributed arp table code, from
    Matthias Schiffer.

    24) r8169 driver gives descriptor ownership back the hardware before
    we're done reading the VLAN tag out of it, fix from Francois
    Romieu.

    25) Checksums not calculated properly in GRE tunnel driver fix from
    Pravin B Shelar.

    26) Fix SCTP memory leak on namespace exit."

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (101 commits)
    dm9601: support dm9620 variant
    SCTP: Free the per-net sysctl table on net exit. v2
    net: phy: icplus: fix broken INTR pin settings
    net: phy: icplus: Use the RGMII interface mode to configure clock delays
    IP_GRE: Fix kernel panic in IP_GRE with GRE csum.
    sctp: set association state to established in dupcook_a handler
    ip6mr: limit IPv6 MRT_TABLE identifiers
    r8169: fix vlan tag read ordering.
    net: cdc_ncm: use IAD provided by the USB core
    batman-adv: filter ARP packets with invalid MAC addresses in DAT
    batman-adv: check for more types of invalid IP addresses in DAT
    batman-adv: fix skb leak in batadv_dat_snoop_incoming_arp_reply()
    net: loopback: fix a dst refcounting issue
    virtio-net: reset virtqueue affinity when doing cpu hotplug
    virtio-net: split out clean affinity function
    virtio-net: fix the set affinity bug when CPU IDs are not consecutive
    can: pch_can: fix invalid error codes
    can: ti_hecc: fix invalid error codes
    can: c_can: fix invalid error codes
    r8169: remove the obsolete and incorrect AMD workaround
    ...

    Linus Torvalds
     

23 Jan, 2013

4 commits

  • Different hooks can require different methods for appraising a
    file's integrity. As a result, an integrity appraisal status is
    cached on a per hook basis.

    Only a hook specific rule, requires the inode to be re-appraised.
    This patch eliminates unnecessary appraisals.

    Signed-off-by: Mimi Zohar
    Signed-off-by: Dmitry Kasatkin

    Mimi Zohar
     
  • With the new IMA policy 'appraise_type=' option, different hooks
    can require different methods for appraising a file's integrity.

    For example, the existing 'ima_appraise_tcb' policy defines a
    generic rule, requiring all root files to be appraised, without
    specfying the appraisal method. A more specific rule could require
    all kernel modules, for example, to be signed.

    appraise fowner=0 func=MODULE_CHECK appraise_type=imasig
    appraise fowner=0

    As a result, the integrity appraisal results for the same inode, but
    for different hooks, could differ. This patch caches the integrity
    appraisal results on a per hook basis.

    Changelog v2:
    - Rename ima_cache_status() to ima_set_cache_status()
    - Rename and move get_appraise_status() to ima_get_cache_status()
    Changelog v0:
    - include IMA_APPRAISE/APPRAISED_SUBMASK in IMA_DO/DONE_MASK (Dmitry)
    - Support independent MODULE_CHECK appraise status.
    - fixed IMA_XXXX_APPRAISE/APPRAISED flags

    Signed-off-by: Mimi Zohar
    Signed-off-by: Dmitry Kasatkin

    Mimi Zohar
     
  • In preparation for hook specific appraise status results, increase
    the iint flags size.

    Signed-off-by: Mimi Zohar
    Signed-off-by: Dmitry Kasatkin

    Mimi Zohar
     
  • The 'security.ima' extended attribute may contain either the file data's
    hash or a digital signature. This patch adds support for requiring a
    specific extended attribute type. It extends the IMA policy with a new
    keyword 'appraise_type=imasig'. (Default is hash.)

    Changelog v2:
    - Fixed Documentation/ABI/testing/ima_policy option syntax
    Changelog v1:
    - Differentiate between 'required' vs. 'actual' extended attribute

    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: Mimi Zohar

    Dmitry Kasatkin
     

21 Jan, 2013

2 commits

  • devcgroup_css_free() calls dev_exception_clean() without the devcgroup_mutex being locked.

    Shutting down a kvm virt was giving me the following trace:

    [36280.732764] ------------[ cut here ]------------
    [36280.732778] WARNING: at /home/snits/dev/linux/security/device_cgroup.c:172 dev_exception_clean+0xa9/0xc0()
    [36280.732782] Hardware name: Studio XPS 8100
    [36280.732785] Modules linked in: xt_REDIRECT fuse ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_nat xt_CHECKSUM iptable_mangle bridge stp llc nf_conntrack_ipv4 ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 nf_defrag_ipv4 ip6table_filter it87 hwmon_vid xt_state nf_conntrack ip6_tables snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_seq coretemp snd_seq_device crc32c_intel snd_pcm snd_page_alloc snd_timer snd broadcom tg3 serio_raw i7core_edac edac_core ptp pps_core lpc_ich pcspkr mfd_core soundcore microcode i2c_i801 nfsd auth_rpcgss nfs_acl lockd vhost_net sunrpc tun macvtap macvlan kvm_intel kvm uinput binfmt_misc autofs4 usb_storage firewire_ohci firewire_core crc_itu_t radeon drm_kms_helper ttm
    [36280.732921] Pid: 933, comm: libvirtd Tainted: G W 3.8.0-rc3-00307-g4c217de #1
    [36280.732922] Call Trace:
    [36280.732927] [] warn_slowpath_common+0x93/0xc0
    [36280.732930] [] warn_slowpath_null+0x1a/0x20
    [36280.732932] [] dev_exception_clean+0xa9/0xc0
    [36280.732934] [] devcgroup_css_free+0x1a/0x30
    [36280.732938] [] cgroup_diput+0x76/0x210
    [36280.732941] [] d_delete+0x120/0x180
    [36280.732943] [] vfs_rmdir+0xef/0x130
    [36280.732945] [] do_rmdir+0x107/0x1c0
    [36280.732949] [] ? trace_hardirqs_on_thunk+0x3a/0x3f
    [36280.732951] [] sys_rmdir+0x16/0x20
    [36280.732954] [] system_call_fastpath+0x16/0x1b
    [36280.732956] ---[ end trace ca39dced899a7d9f ]---

    Signed-off-by: Jerry Snitselaar
    Cc: stable@kernel.org
    Signed-off-by: James Morris

    Jerry Snitselaar
     
  • The following lines of code produce a kernel oops.

    fd = socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
    fchmod(fd, 0666);

    [ 139.922364] BUG: unable to handle kernel NULL pointer dereference at (null)
    [ 139.924982] IP: [< (null)>] (null)
    [ 139.924982] *pde = 00000000
    [ 139.924982] Oops: 0000 [#5] SMP
    [ 139.924982] Modules linked in: fuse dm_crypt dm_mod i2c_piix4 serio_raw evdev binfmt_misc button
    [ 139.924982] Pid: 3070, comm: acpid Tainted: G D 3.8.0-rc2-kds+ #465 Bochs Bochs
    [ 139.924982] EIP: 0060:[] EFLAGS: 00010246 CPU: 0
    [ 139.924982] EIP is at 0x0
    [ 139.924982] EAX: cf5ef000 EBX: cf5ef000 ECX: c143d600 EDX: c15225f2
    [ 139.924982] ESI: cf4d2a1c EDI: cf4d2a1c EBP: cc02df10 ESP: cc02dee4
    [ 139.924982] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
    [ 139.924982] CR0: 80050033 CR2: 00000000 CR3: 0c059000 CR4: 000006d0
    [ 139.924982] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
    [ 139.924982] DR6: ffff0ff0 DR7: 00000400
    [ 139.924982] Process acpid (pid: 3070, ti=cc02c000 task=d7705340 task.ti=cc02c000)
    [ 139.924982] Stack:
    [ 139.924982] c1203c88 00000000 cc02def4 cf4d2a1c ae21eefa 471b60d5 1083c1ba c26a5940
    [ 139.924982] e891fb5e 00000041 00000004 cc02df1c c1203964 00000000 cc02df4c c10e20c3
    [ 139.924982] 00000002 00000000 00000000 22222222 c1ff2222 cf5ef000 00000000 d76efb08
    [ 139.924982] Call Trace:
    [ 139.924982] [] ? evm_update_evmxattr+0x5b/0x62
    [ 139.924982] [] evm_inode_post_setattr+0x22/0x26
    [ 139.924982] [] notify_change+0x25f/0x281
    [ 139.924982] [] chmod_common+0x59/0x76
    [ 139.924982] [] ? put_unused_fd+0x33/0x33
    [ 139.924982] [] sys_fchmod+0x39/0x5c
    [ 139.924982] [] syscall_call+0x7/0xb
    [ 139.924982] Code: Bad EIP value.

    This happens because sockets do not define the removexattr operation.
    Before removing the xattr, verify the removexattr function pointer is
    not NULL.

    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: Mimi Zohar
    Cc: stable@vger.kernel.org
    Signed-off-by: James Morris

    Dmitry Kasatkin
     

17 Jan, 2013

9 commits


15 Jan, 2013

2 commits

  • This patch corrects some problems with LSM/SELinux that were introduced
    with the multiqueue patchset. The problem stems from the fact that the
    multiqueue work changed the relationship between the tun device and its
    associated socket; before the socket persisted for the life of the
    device, however after the multiqueue changes the socket only persisted
    for the life of the userspace connection (fd open). For non-persistent
    devices this is not an issue, but for persistent devices this can cause
    the tun device to lose its SELinux label.

    We correct this problem by adding an opaque LSM security blob to the
    tun device struct which allows us to have the LSM security state, e.g.
    SELinux labeling information, persist for the lifetime of the tun
    device. In the process we tweak the LSM hooks to work with this new
    approach to TUN device/socket labeling and introduce a new LSM hook,
    security_tun_dev_attach_queue(), to approve requests to attach to a
    TUN queue via TUNSETQUEUE.

    The SELinux code has been adjusted to match the new LSM hooks, the
    other LSMs do not make use of the LSM TUN controls. This patch makes
    use of the recently added "tun_socket:attach_queue" permission to
    restrict access to the TUNSETQUEUE operation. On older SELinux
    policies which do not define the "tun_socket:attach_queue" permission
    the access control decision for TUNSETQUEUE will be handled according
    to the SELinux policy's unknown permission setting.

    Signed-off-by: Paul Moore
    Acked-by: Eric Paris
    Tested-by: Jason Wang
    Signed-off-by: David S. Miller

    Paul Moore
     
  • Add a new permission to align with the new TUN multiqueue support,
    "tun_socket:attach_queue".

    The corresponding SELinux reference policy patch is show below:

    diff --git a/policy/flask/access_vectors b/policy/flask/access_vectors
    index 28802c5..a0664a1 100644
    --- a/policy/flask/access_vectors
    +++ b/policy/flask/access_vectors
    @@ -827,6 +827,9 @@ class kernel_service

    class tun_socket
    inherits socket
    +{
    + attach_queue
    +}

    class x_pointer
    inherits x_device

    Signed-off-by: Paul Moore
    Acked-by: Eric Paris
    Tested-by: Jason Wang
    Signed-off-by: David S. Miller

    Paul Moore
     

24 Dec, 2012

1 commit

  • The new kernel module syscall appraises kernel modules based
    on policy. If the IMA policy requires kernel module checking,
    fallback to module signature enforcing for the existing syscall.
    Without CONFIG_MODULE_SIG_FORCE enabled, the kernel module's
    integrity is unknown, return -EACCES.

    Changelog v1:
    - Fix ima_module_check() return result (Tetsuo Handa)

    Reported-by: Tetsuo Handa
    Reviewed-by: Tetsuo Handa
    Signed-off-by: Mimi Zohar

    Mimi Zohar
     

21 Dec, 2012

1 commit


20 Dec, 2012

1 commit

  • Pull networking fixes from David Miller:

    1) Really fix tuntap SKB use after free bug, from Eric Dumazet.

    2) Adjust SKB data pointer to point past the transport header before
    calling icmpv6_notify() so that the headers are in the state which
    that function expects. From Duan Jiong.

    3) Fix ambiguities in the new tuntap multi-queue APIs. From Jason
    Wang.

    4) mISDN needs to use del_timer_sync(), from Konstantin Khlebnikov.

    5) Don't destroy mutex after freeing up device private in mac802154,
    fix also from Konstantin Khlebnikov.

    6) Fix INET request socket leak in TCP and DCCP, from Christoph Paasch.

    7) SCTP HMAC kconfig rework, from Neil Horman.

    8) Fix SCTP jprobes function signature, otherwise things explode, from
    Daniel Borkmann.

    9) Fix typo in ipv6-offload Makefile variable reference, from Simon
    Arlott.

    10) Don't fail USBNET open just because remote wakeup isn't supported,
    from Oliver Neukum.

    11) be2net driver bug fixes from Sathya Perla.

    12) SOLOS PCI ATM driver bug fixes from Nathan Williams and David
    Woodhouse.

    13) Fix MTU changing regression in 8139cp driver, from John Greene.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (45 commits)
    solos-pci: ensure all TX packets are aligned to 4 bytes
    solos-pci: add firmware upgrade support for new models
    solos-pci: remove superfluous debug output
    solos-pci: add GPIO support for newer versions on Geos board
    8139cp: Prevent dev_close/cp_interrupt race on MTU change
    net: qmi_wwan: add ZTE MF880
    drivers/net: Use of_match_ptr() macro in smsc911x.c
    drivers/net: Use of_match_ptr() macro in smc91x.c
    ipv6: addrconf.c: remove unnecessary "if"
    bridge: Correctly encode addresses when dumping mdb entries
    bridge: Do not unregister all PF_BRIDGE rtnl operations
    use generic usbnet_manage_power()
    usbnet: generic manage_power()
    usbnet: handle PM failure gracefully
    ksz884x: fix receive polling race condition
    qlcnic: update driver version
    qlcnic: fix unused variable warnings
    net: fec: forbid FEC_PTP on SoCs that do not support
    be2net: fix wrong frag_idx reported by RX CQ
    be2net: fix be_close() to ensure all events are ack'ed
    ...

    Linus Torvalds
     

19 Dec, 2012

2 commits

  • Pull module update from Rusty Russell:
    "Nothing all that exciting; a new module-from-fd syscall for those who
    want to verify the source of the module (ChromeOS) and/or use standard
    IMA on it or other security hooks."

    * tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
    MODSIGN: Fix kbuild output when using default extra_certificates
    MODSIGN: Avoid using .incbin in C source
    modules: don't hand 0 to vmalloc.
    module: Remove a extra null character at the top of module->strtab.
    ASN.1: Use the ASN1_LONG_TAG and ASN1_INDEFINITE_LENGTH constants
    ASN.1: Define indefinite length marker constant
    moduleparam: use __UNIQUE_ID()
    __UNIQUE_ID()
    MODSIGN: Add modules_sign make target
    powerpc: add finit_module syscall.
    ima: support new kernel module syscall
    add finit_module syscall to asm-generic
    ARM: add finit_module syscall to ARM
    security: introduce kernel_module_from_file hook
    module: add flags arg to sys_finit_module()
    module: add syscall to load module from fd

    Linus Torvalds
     
  • Pull (again) user namespace infrastructure changes from Eric Biederman:
    "Those bugs, those darn embarrasing bugs just want don't want to get
    fixed.

    Linus I just updated my mirror of your kernel.org tree and it appears
    you successfully pulled everything except the last 4 commits that fix
    those embarrasing bugs.

    When you get a chance can you please repull my branch"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
    userns: Fix typo in description of the limitation of userns_install
    userns: Add a more complete capability subset test to commit_creds
    userns: Require CAP_SYS_ADMIN for most uses of setns.
    Fix cap_capable to only allow owners in the parent user namespace to have caps.

    Linus Torvalds