15 Mar, 2012

1 commit

  • "struct file_operations"->poll() expects "unsigned int" return value.
    All files in /sys/kernel/security/tomoyo/ directory other than
    /sys/kernel/security/tomoyo/query and /sys/kernel/security/tomoyo/audit should
    return POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM rather than -ENOSYS.
    Also, /sys/kernel/security/tomoyo/query and /sys/kernel/security/tomoyo/audit
    should return POLLOUT | POLLWRNORM rather than 0 when there is no data to read.

    Signed-off-by: Tetsuo Handa
    Signed-off-by: James Morris

    Tetsuo Handa
     

07 Mar, 2012

1 commit

  • The test for "if (cred->request_key_auth->flags & KEY_FLAG_REVOKED) {"
    should actually testing that the (1 << KEY_FLAG_REVOKED) bit is set.
    The current code actually checks for KEY_FLAG_DEAD.

    Signed-off-by: Dan Carpenter
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Dan Carpenter
     

01 Mar, 2012

1 commit

  • Userspace can pass in arbitrary combinations of MS_* flags to mount().

    If both MS_BIND and one of MS_SHARED/MS_PRIVATE/MS_SLAVE/MS_UNBINDABLE are
    passed, device name which should be checked for MS_BIND was not checked because
    MS_SHARED/MS_PRIVATE/MS_SLAVE/MS_UNBINDABLE had higher priority than MS_BIND.

    If both one of MS_BIND/MS_MOVE and MS_REMOUNT are passed, device name which
    should not be checked for MS_REMOUNT was checked because MS_BIND/MS_MOVE had
    higher priority than MS_REMOUNT.

    Fix these bugs by changing priority to MS_REMOUNT -> MS_BIND ->
    MS_SHARED/MS_PRIVATE/MS_SLAVE/MS_UNBINDABLE -> MS_MOVE as with do_mount() does.

    Also, unconditionally return -EINVAL if more than one of
    MS_SHARED/MS_PRIVATE/MS_SLAVE/MS_UNBINDABLE is passed so that TOMOYO will not
    generate inaccurate audit logs, for commit 7a2e8a8f "VFS: Sanity check mount
    flags passed to change_mnt_propagation()" clarified that these flags must be
    exclusively passed.

    Signed-off-by: Tetsuo Handa
    Signed-off-by: James Morris

    Tetsuo Handa
     

28 Feb, 2012

10 commits


16 Feb, 2012

2 commits

  • The audit res field ususally indicates success with a 1 and 0 for a
    failure. So make IMA do it the same way.

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

    Eric Paris
     
  • For a process to entirely disable Yama ptrace restrictions, it can use
    the special PR_SET_PTRACER_ANY pid to indicate that any otherwise allowed
    process may ptrace it. This is stronger than calling PR_SET_PTRACER with
    pid "1" because it includes processes in external pid namespaces. This is
    currently needed by the Chrome renderer, since its crash handler (Breakpad)
    runs external to the renderer's pid namespace.

    Signed-off-by: Kees Cook
    Signed-off-by: James Morris

    Kees Cook
     

15 Feb, 2012

3 commits

  • Commit 3321c07ae5068568cd61ac9f4ba749006a7185c9 correctly clears the TPM
    buffer if the user specified read length is >= the TPM buffer length. However,
    if the user specified read length is < the TPM buffer length, then part of the
    TPM buffer is left uncleared.

    Reported-by: Seth Forshee
    Cc: Debora Velarde
    Cc: Rajiv Andrade
    Cc: Marcel Selhorst
    Cc: tpmdd-devel@lists.sourceforge.net
    Cc: stable@vger.kernel.org
    Signed-off-by: Tim Gardner
    Signed-off-by: Rajiv Andrade

    Tim Gardner
     
  • Commit 90ab5ee94171b3e28de6bb42ee30b527014e0be7 changed the
    itpm module parameter from int to bool. Some other changes
    need to be done to clean up after this change.

    Signed-off-by: Stefan Berger
    Cc: Mauro Carvalho Chehab
    Cc: Rusty Russell
    Signed-off-by: Rajiv Andrade

    Stefan Berger
     
  • Detect iTPMs through the vendor ID on the hardware interface and only
    probe the device if the manufacturer is found to be Intel. This
    obsoletes a previously added delay necessary for some TPMs but not iTPMs.

    Signed-off-by: Stefan Berger
    Signed-off-by: Rajiv Andrade

    Stefan Berger
     

14 Feb, 2012

2 commits


10 Feb, 2012

3 commits

  • time_t was used in the signature and key packet headers,
    which is typedef of long and is different on 32 and 64 bit architectures.
    Signature and key format should be independent of architecture.
    Similar to GPG, I have changed the type to uint32_t.

    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: James Morris

    Dmitry Kasatkin
     
  • This adds the Yama Linux Security Module to collect DAC security
    improvements (specifically just ptrace restrictions for now) that have
    existed in various forms over the years and have been carried outside the
    mainline kernel by other Linux distributions like Openwall and grsecurity.

    Signed-off-by: Kees Cook
    Acked-by: John Johansen
    Signed-off-by: James Morris

    Kees Cook
     
  • The current LSM interface to cred_free is not sufficient for allowing
    an LSM to track the life and death of a task. This patch adds the
    task_free hook so that an LSM can clean up resources on task death.

    Signed-off-by: Kees Cook
    Signed-off-by: James Morris

    Kees Cook
     

09 Feb, 2012

17 commits

  • James Morris
     
  • James Morris
     
  • Linus Torvalds
     
  • One patch fixes an bug in the ARM/MSM IOMMU code which returned sucess
    in the unmap function even when an error occured and the other patch
    adds a workaround into the AMD IOMMU driver to better handle broken IVRS
    ACPI tables (this patch fixes the case when a device is not listed in
    the table but actually translated by the iommu).

    * 'iommu/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
    iommu/msm: Fix error handling in msm_iommu_unmap()
    iommu/amd: Work around broken IVRS tables

    Linus Torvalds
     
  • This series contains pending target bug-fixes and cleanups for v3.3-rc3
    that have been addressed the past weeks in lio-core.git.

    Some of the highlights include:

    - Fix handling for control CDBs with data greater than PAGE_SIZE (andy)
    - Use IP_FREEBIND for iscsi-target to address network portal creation
    issues with systemd (dax)
    - Allow PERSISTENT RESERVE IN for non-reservation holder (marco)
    - Fix iblock se_dev_attrib.unmap_granularity (marco)
    - Fix unsupported WRITE_SAME sense payload handling (martin)
    - Add workaround for zero-length control CDB handling (nab)
    - Fix discovery with INADDR_ANY and IN6ADDR_ANY_INIT (nab)
    - Fix target_submit_cmd() exception handling (nab)
    - Return correct ASC for unimplemented VPD pages (roland)
    - Don't zero pages used for data buffers (roland)
    - Fix return code of core_tpg_.*_lun (sebastian)

    * '3.3-rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (26 commits)
    target: Fix unsupported WRITE_SAME sense payload
    iscsi: use IP_FREEBIND socket option
    iblock: fix handling of large requests
    target: handle empty string writes in sysfs
    iscsi_target: in_aton needs linux/inet.h
    target: Fix iblock se_dev_attrib.unmap_granularity
    target: Fix target_submit_cmd() exception handling
    target: Change target_submit_cmd() to return void
    target: accept REQUEST_SENSE with 18bytes
    target: Fail INQUIRY commands with EVPD==0 but PAGE CODE!=0
    target: Return correct ASC for unimplemented VPD pages
    iscsi-target: Fix discovery with INADDR_ANY and IN6ADDR_ANY_INIT
    target: Allow control CDBs with data > 1 page
    iscsi-target: Fix up a few assignments
    iscsi-target: make one-bit bitfields unsigned
    iscsi-target: Fix double list_add with iscsit_alloc_buffs reject
    iscsi-target: Fix reject release handling in iscsit_free_cmd()
    target: fix return code of core_tpg_.*_lun
    target: use save/restore lock primitive in core_dec_lacl_count()
    target: avoid multiple outputs in scsi_dump_inquiry()
    ...

    Linus Torvalds
     
  • Some simple md-related fixes.

    1/ two small fixes to ensure we handle an interrupted resync properly.
    2/ avoid loading the bitmap multiple times in dm-raid

    * tag 'md-3.3-fixes' of git://neil.brown.name/md:
    md: two small fixes to handling interrupt resync.
    Prevent DM RAID from loading bitmap twice.

    Linus Torvalds
     
  • SPI bug fixes for v3.3-rc2

    Minor SPI device driver changes. A rename of the pch_spi_pcidev symbol
    that merely eliminates a modpost warning, and a Kconfig change to allow
    the Samsung spi driver to build on EXYNOS.

    * tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6:
    spi-topcliff-pch: rename pch_spi_pcidev to pch_spi_pcidev_driver
    spi: Add spi-s3c64xx driver dependency on ARCH_EXYNOS4

    Linus Torvalds
     
  • Five fixes

    * branch 'akpm':
    pcmcia: fix socket refcount decrementing on each resume
    mm: fix UP THP spin_is_locked BUGs
    drivers/leds/leds-lm3530.c: fix setting pltfm->als_vmax
    mm: compaction: check for overlapping nodes during isolation for migration
    nilfs2: avoid overflowing segment numbers in nilfs_ioctl_clean_segments()

    Linus Torvalds
     
  • This fixes a memory-corrupting bug: not only does it cause the warning,
    but as a result of dropping the refcount to zero, it causes the
    pcmcia_socket0 device structure to be freed while it still has
    references, causing slab caches corruption. A fatal oops quickly
    follows this warning - often even just a 'dmesg' following the warning
    causes the kernel to oops.

    While testing suspend/resume on an ARM device with PCMCIA support, and a
    CF card inserted, I found that after five suspend and resumes, the
    kernel would complain, and shortly die after with slab corruption.

    WARNING: at include/linux/kref.h:41 kobject_get+0x28/0x50()

    As the message doesn't give a clue about which kobject, and the built-in
    debugging in drivers/base/power/main.c happens too late, this was added
    right before each get_device():

    printk("%s: %p [%s] %u\n", __func__, dev, kobject_name(&dev->kobj), atomic_read(&dev->kobj.kref.refcount));

    and on the 3rd s2ram cycle, the following behaviour observed:

    On the 3rd suspend/resume cycle:

    dpm_prepare: c1a0d998 [pcmcia_socket0] 3
    dpm_suspend: c1a0d998 [pcmcia_socket0] 3
    dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 3
    dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 3
    dpm_resume: c1a0d998 [pcmcia_socket0] 3
    dpm_complete: c1a0d998 [pcmcia_socket0] 2

    4th:

    dpm_prepare: c1a0d998 [pcmcia_socket0] 2
    dpm_suspend: c1a0d998 [pcmcia_socket0] 2
    dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 2
    dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 2
    dpm_resume: c1a0d998 [pcmcia_socket0] 2
    dpm_complete: c1a0d998 [pcmcia_socket0] 1

    5th:

    dpm_prepare: c1a0d998 [pcmcia_socket0] 1
    dpm_suspend: c1a0d998 [pcmcia_socket0] 1
    dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 1
    dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 1
    dpm_resume: c1a0d998 [pcmcia_socket0] 1
    dpm_complete: c1a0d998 [pcmcia_socket0] 0
    ------------[ cut here ]------------
    WARNING: at include/linux/kref.h:41 kobject_get+0x28/0x50()
    Modules linked in: ucb1x00_core
    Backtrace:
    [] (dump_backtrace+0x0/0x110) from [] (dump_stack+0x18/0x1c)
    [] (dump_stack+0x0/0x1c) from [] (warn_slowpath_common+0x50/0x68)
    [] (warn_slowpath_common+0x0/0x68) from [] (warn_slowpath_null+0x24/0x28)
    [] (warn_slowpath_null+0x0/0x28) from [] (kobject_get+0x28/0x50)
    [] (kobject_get+0x0/0x50) from [] (get_device+0x1c/0x24)
    [] (dpm_complete+0x0/0x1a0) from [] (dpm_resume_end+0x1c/0x20)
    ...

    Looking at commit 7b24e7988263 ("pcmcia: split up central event handler"),
    the following change was made to cs.c:

    return 0;
    }
    #endif
    -
    - send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
    + if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
    + skt->callback->early_resume(skt);
    return 0;
    }

    And the corresponding change in ds.c is from:

    -static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
    -{
    - struct pcmcia_socket *s = pcmcia_get_socket(skt);
    ...
    - switch (event) {
    ...
    - case CS_EVENT_PM_RESUME:
    - if (verify_cis_cache(skt) != 0) {
    - dev_dbg(&skt->dev, "cis mismatch - different card\n");
    - /* first, remove the card */
    - ds_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
    - mutex_lock(&s->ops_mutex);
    - destroy_cis_cache(skt);
    - kfree(skt->fake_cis);
    - skt->fake_cis = NULL;
    - s->functions = 0;
    - mutex_unlock(&s->ops_mutex);
    - /* now, add the new card */
    - ds_event(skt, CS_EVENT_CARD_INSERTION,
    - CS_EVENT_PRI_LOW);
    - }
    - break;
    ...
    - }

    - pcmcia_put_socket(s);

    - return 0;
    -} /* ds_event */

    to:

    +static int pcmcia_bus_early_resume(struct pcmcia_socket *skt)
    +{
    + if (!verify_cis_cache(skt)) {
    + pcmcia_put_socket(skt);
    + return 0;
    + }

    + dev_dbg(&skt->dev, "cis mismatch - different card\n");

    + /* first, remove the card */
    + pcmcia_bus_remove(skt);
    + mutex_lock(&skt->ops_mutex);
    + destroy_cis_cache(skt);
    + kfree(skt->fake_cis);
    + skt->fake_cis = NULL;
    + skt->functions = 0;
    + mutex_unlock(&skt->ops_mutex);

    + /* now, add the new card */
    + pcmcia_bus_add(skt);
    + return 0;
    +}

    As can be seen, the original function called pcmcia_get_socket() and
    pcmcia_put_socket() around the guts, whereas the replacement code
    calls pcmcia_put_socket() only in one path. This creates an imbalance
    in the refcounting.

    Testing with pcmcia_put_socket() put removed shows that the bug is gone:

    dpm_suspend: c1a10998 [pcmcia_socket0] 5
    dpm_suspend_noirq: c1a10998 [pcmcia_socket0] 5
    dpm_resume_noirq: c1a10998 [pcmcia_socket0] 5
    dpm_resume: c1a10998 [pcmcia_socket0] 5
    dpm_complete: c1a10998 [pcmcia_socket0] 5

    Tested-by: Russell King
    Signed-off-by: Russell King
    Cc: Dominik Brodowski
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Russell King
     
  • Fix CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_SMP=n CONFIG_DEBUG_VM=y
    CONFIG_DEBUG_SPINLOCK=n kernel: spin_is_locked() is then always false,
    and so triggers some BUGs in Transparent HugePage codepaths.

    asm-generic/bug.h mentions this problem, and provides a WARN_ON_SMP(x);
    but being too lazy to add VM_BUG_ON_SMP, BUG_ON_SMP, WARN_ON_SMP_ONCE,
    VM_WARN_ON_SMP_ONCE, just test NR_CPUS != 1 in the existing VM_BUG_ONs.

    Signed-off-by: Hugh Dickins
    Cc: Andrea Arcangeli
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hugh Dickins
     
  • In current code, pltfm->als_vmin is set to LM3530_ALS_WINDOW_mV and
    pltfm->als_vmax is 0. This does not make sense. I think what we want
    here is setting pltfm->als_vmax to LM3530_ALS_WINDOW_mV.

    Both als_vmin and als_vmax local variables will be set to
    pltfm->als_vmin and pltfm->als_vmax by a few lines latter. Thus also
    remove a redundant assignment for als_vmin and als_vmax in this patch.

    Signed-off-by: Axel Lin
    Cc: Shreshtha Kumar Sahu
    Acked-by: Milo(Woogyom) Kim
    Tested-by: Milo(Woogyom) Kim
    Cc: Richard Purdie
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Axel Lin
     
  • When isolating pages for migration, migration starts at the start of a
    zone while the free scanner starts at the end of the zone. Migration
    avoids entering a new zone by never going beyond the free scanned.

    Unfortunately, in very rare cases nodes can overlap. When this happens,
    migration isolates pages without the LRU lock held, corrupting lists
    which will trigger errors in reclaim or during page free such as in the
    following oops

    BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
    IP: [] free_pcppages_bulk+0xcc/0x450
    PGD 1dda554067 PUD 1e1cb58067 PMD 0
    Oops: 0000 [#1] SMP
    CPU 37
    Pid: 17088, comm: memcg_process_s Tainted: G X
    RIP: free_pcppages_bulk+0xcc/0x450
    Process memcg_process_s (pid: 17088, threadinfo ffff881c2926e000, task ffff881c2926c0c0)
    Call Trace:
    free_hot_cold_page+0x17e/0x1f0
    __pagevec_free+0x90/0xb0
    release_pages+0x22a/0x260
    pagevec_lru_move_fn+0xf3/0x110
    putback_lru_page+0x66/0xe0
    unmap_and_move+0x156/0x180
    migrate_pages+0x9e/0x1b0
    compact_zone+0x1f3/0x2f0
    compact_zone_order+0xa2/0xe0
    try_to_compact_pages+0xdf/0x110
    __alloc_pages_direct_compact+0xee/0x1c0
    __alloc_pages_slowpath+0x370/0x830
    __alloc_pages_nodemask+0x1b1/0x1c0
    alloc_pages_vma+0x9b/0x160
    do_huge_pmd_anonymous_page+0x160/0x270
    do_page_fault+0x207/0x4c0
    page_fault+0x25/0x30

    The "X" in the taint flag means that external modules were loaded but but
    is unrelated to the bug triggering. The real problem was because the PFN
    layout looks like this

    Zone PFN ranges:
    DMA 0x00000010 -> 0x00001000
    DMA32 0x00001000 -> 0x00100000
    Normal 0x00100000 -> 0x01e80000
    Movable zone start PFN for each node
    early_node_map[14] active PFN ranges
    0: 0x00000010 -> 0x0000009b
    0: 0x00000100 -> 0x0007a1ec
    0: 0x0007a354 -> 0x0007a379
    0: 0x0007f7ff -> 0x0007f800
    0: 0x00100000 -> 0x00680000
    1: 0x00680000 -> 0x00e80000
    0: 0x00e80000 -> 0x01080000
    1: 0x01080000 -> 0x01280000
    0: 0x01280000 -> 0x01480000
    1: 0x01480000 -> 0x01680000
    0: 0x01680000 -> 0x01880000
    1: 0x01880000 -> 0x01a80000
    0: 0x01a80000 -> 0x01c80000
    1: 0x01c80000 -> 0x01e80000

    The fix is straight-forward. isolate_migratepages() has to make a
    similar check to isolate_freepage to ensure that it never isolates pages
    from a zone it does not hold the LRU lock for.

    This was discovered in a 3.0-based kernel but it affects 3.1.x, 3.2.x
    and current mainline.

    Signed-off-by: Mel Gorman
    Acked-by: Michal Nazarewicz
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     
  • nsegs is read from userspace. Limit its value and avoid overflowing nsegs
    * sizeof(__u64) in the subsequent call to memdup_user().

    This patch complements 481fe17e973fb9 ("nilfs2: potential integer overflow
    in nilfs_ioctl_clean_segments()").

    Signed-off-by: Xi Wang
    Cc: Haogang Chen
    Acked-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Xi Wang
     
  • sound fixes #2 for 3.3-rc3

    A collection of small fixes, mostly for regressions.
    In addition, a few ASoC wm8994 updates are included, too.

    * tag 'sound-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
    ASoC: wm8994: Disable line output discharge prior to ramping VMID
    ASoC: wm8994: Fix typo in VMID ramp setting
    ALSA: oxygen, virtuoso: fix exchanged L/R volumes of aux and CD inputs
    ALSA: usb-audio: add Edirol UM-3G support
    ALSA: hda - add support for Uniwill ECS M31EI notebook
    ALSA: hda - Fix error handling in patch_ca0132.c
    ASoC: wm8994: Enabling VMID should take a runtime PM reference
    ALSA: hda/realtek - Fix a wrong condition
    ALSA: emu8000: Remove duplicate linux/moduleparam.h include from emu8000_patch.c
    ALSA: hda/realtek - Add missing Bass and CLFE as vmaster slaves
    ASoC: wm_hubs: Correct line input to line output 2 paths
    ASoC: cs42l73: Fix Output [X|A|V]SP_SCLK Sourcing Mode setting for master mode
    ASoC: wm8962: Fix word length configuration
    ASoC: core: Better support for idle_bias_off suspend ignores
    ASoC: wm8994: Remove ASoC level register cache sync
    ASoC: wm_hubs: Fix routing of input PGAs to line output mixer

    Linus Torvalds
     
  • A few small WM8994 updates to go on top of the previous lot of things
    that were sent. They collide with some -next work so I'd really like to
    get them into 3.3-rc3 if possible to merge back up into the -next code.
    All driver specific and unexciting in the grand scheme of things.

    Takashi Iwai
     
  • Signed-off-by: Mark Brown

    Mark Brown
     
  • The VMID ramp rate is supposed to be 0x3, not 11b. Fix that.

    Signed-off-by: Mark Brown
    Cc: stable@vger.kernel.org

    Mark Brown