21 Oct, 2015

3 commits


20 Oct, 2015

2 commits

  • James Morris
     
  • This feature introduces new kernel interface:

    - /relabel-self - for setting transition labels list

    This list is used to control smack label transition mechanism.
    List is set by, and per process. Process can transit to new label only if
    label is on the list. Only process with CAP_MAC_ADMIN capability can add
    labels to this list. With this list, process can change it's label without
    CAP_MAC_ADMIN but only once. After label changing, list is unset.

    Changes in v2:
    * use list_for_each_entry instead of _rcu during label write
    * added missing description in security/Smack.txt

    Changes in v3:
    * squashed into one commit

    Changes in v4:
    * switch from global list to per-task list
    * since the per-task list is accessed only by the task itself
    there is no need to use synchronization mechanisms on it

    Changes in v5:
    * change smackfs interface of relabel-self to the one used for onlycap
    multiple labels are accepted, separated by space, which
    replace the previous list upon write

    Signed-off-by: Zbigniew Jasinski
    Signed-off-by: Rafal Krypa
    Acked-by: Casey Schaufler

    Zbigniew Jasinski
     

19 Oct, 2015

18 commits

  • The base pointer for the event log is allocated in the local
    kernel (in prom_instantiate_sml()), therefore it is already in
    the host's endian byte order and requires no conversion.

    The content of the 'basep' pointer in read_log() stores the
    base address of the log. This patch ensures that it is correctly
    implemented.

    Signed-off-by: Hon Ching(Vicky) Lo
    Signed-off-by: Joy Latten
    Reviewed-by: Ashley Lai
    Signed-off-by: Peter Huewe

    Hon Ching \(Vicky\) Lo
     
  • This patch makes the code endianness independent. We defined a
    macro do_endian_conversion to apply endianness to raw integers
    in the event entries so that they will be displayed properly.
    tpm_binary_bios_measurements_show() is modified for the display.

    Signed-off-by: Hon Ching(Vicky) Lo
    Signed-off-by: Joy Latten
    Reviewed-by: Ashley Lai
    Reviewed-by: Ashley Lai
    Signed-off-by: Peter Huewe

    Hon Ching \(Vicky\) Lo
     
  • i2c_driver does not need to set an owner because i2c_register_driver()
    will set it.

    Signed-off-by: Krzysztof Kozlowski
    Reviewed-by: Peter Huewe
    Signed-off-by: Peter Huewe

    Krzysztof Kozlowski
     
  • The OS should ask Power Firmware (PFW) for the size of the buffer
    allocated for the event log, instead of the size of the actual
    event log. It then passes the buffer adddress and size to PFW in
    the handover process, into which PFW copies the log.

    Signed-off-by: Hon Ching(Vicky) Lo
    Signed-off-by: Peter Huewe

    Hon Ching \(Vicky\) Lo
     
  • The event log generated by OpenFirmware in PowerPC is 4-byte aligned.
    This patch reformats the log to be byte-aligned for the Linux client.

    Signed-off-by: Hon Ching(Vicky) Lo
    Signed-off-by: Peter Huewe

    Hon Ching \(Vicky\) Lo
     
  • Replace all occurrences of '/ibm,vtpm' with '/vdevice/vtpm',
    as only the latter is guanranteed to be available for the client OS.
    The '/ibm,vtpm' node should only be used by Open Firmware, which
    is susceptible to changes.

    Signed-off-by: Hon Ching(Vicky) Lo
    Signed-off-by: Peter Huewe

    Hon Ching \(Vicky\) Lo
     
  • At the moment, no one has time to pay enough attention to this subsystem
    so that patches get eventually merged into linux-next. Even critical bug
    fixes can lie for weeks.

    I'm happy to continue with the current maintainers if they are able to
    do their job but if this is not the case I cannot find any other
    solution but apply myself for the job.

    If there is someone more experienced and/or competent, I'm also happy
    to let one take the stand. Anything works as long as it works. I just
    want a solution for this bottleneck.

    Signed-off-by: Jarkko Sakkinen
    Acked-by: Peter Huewe
    Signed-off-by: Peter Huewe

    Jarkko Sakkinen
     
  • Call tpm_seal_trusted() and tpm_unseal_trusted() for TPM 2.0 chips.
    We require explicit 'keyhandle=' option because there's no a fixed
    storage root key inside TPM2 chips.

    Signed-off-by: Jarkko Sakkinen
    Reviewed-by: Andreas Fuchs
    Tested-by: Mimi Zohar (on TPM 1.2)
    Tested-by: Chris J Arges
    Tested-by: Colin Ian King
    Tested-by: Kevin Strasser
    Signed-off-by: Peter Huewe

    Jarkko Sakkinen
     
  • Added tpm_trusted_seal() and tpm_trusted_unseal() API for sealing
    trusted keys.

    This patch implements basic sealing and unsealing functionality for
    TPM 2.0:

    * Seal with a parent key using a 20 byte auth value.
    * Unseal with a parent key using a 20 byte auth value.

    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Peter Huewe

    Jarkko Sakkinen
     
  • Moved struct trusted_key_options to trustes-type.h so that the fields
    can be accessed from drivers/char/tpm.

    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Peter Huewe

    Jarkko Sakkinen
     
  • This patch introduces struct tpm_buf that provides a string buffer for
    constructing TPM commands. This allows to construct variable sized TPM
    commands. For the buffer a page is allocated and mapped, which limits
    maximum size to PAGE_SIZE.

    Variable sized TPM commands are needed in order to add algorithmic
    agility.

    Signed-off-by: Jarkko Sakkinen
    Reviewed-by: Peter Huewe
    Signed-off-by: Peter Huewe

    Jarkko Sakkinen
     
  • Updated Documentation/ABI/testing/sysfs-driver-ppi in order to explain
    where PPI attributes are located and how backwards compatibility is
    addressed.

    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Peter Huewe

    Jarkko Sakkinen
     
  • Moved PPI attributes to the character device directory. This aligns with
    the sysfs guidelines and makes them race free because they are created
    atomically with the character device as part of device_register().The
    character device and the sysfs attributes appear at the same time to the
    user space.

    As part of this change we enable PPI attributes also for TPM 2.0
    devices. In order to retain backwards compatibility with TPM 1.x
    devices, a symlink is created to the platform device directory.

    Signed-off-by: Jarkko Sakkinen
    Reviewed-by: Jason Gunthorpe
    Tested-by: Mimi Zohar (on TPM 1.2)
    Tested-by: Chris J Arges
    Tested-by: Colin Ian King
    Signed-off-by: Peter Huewe

    Jarkko Sakkinen
     
  • Added a new function __compat_only_sysfs_link_group_to_kobj() that adds
    a symlink from attribute or group to a kobject. This needed for
    maintaining backwards compatibility with PPI attributes in the TPM
    driver.

    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Peter Huewe

    Jarkko Sakkinen
     
  • Both for FIFO and CRB interface TCG has decided to use the same HID
    MSFT0101. They can be differentiated by looking at the start method from
    TPM2 ACPI table. This patches makes necessary fixes to tpm_tis and
    tpm_crb modules in order to correctly detect, which module should be
    used.

    For MSFT0101 we must use struct acpi_driver because struct pnp_driver
    has a 7 character limitation.

    It turned out that the root cause in b371616b8 was not correct for
    https://bugzilla.kernel.org/show_bug.cgi?id=98181.

    v2:

    * One fixup was missing from v1: is_tpm2_fifo -> is_fifo

    v3:

    * Use pnp_driver for existing HIDs and acpi_driver only for MSFT0101 in
    order ensure backwards compatibility.

    v4:

    * Check for FIFO before doing *anything* in crb_acpi_add().
    * There was return immediately after acpi_bus_unregister_driver() in
    cleanup_tis(). This caused pnp_unregister_driver() not to be called.

    Cc: stable@kernel.org
    Reported-by: Michael Saunders
    Reported-by: Michael Marley
    Reported-by: Jethro Beekman
    Reported-by: Matthew Garrett
    Signed-off-by: Jarkko Sakkinen
    Tested-by: Michael Marley
    Tested-by: Mimi Zohar (on TPM 1.2)
    Reviewed-by: Peter Huewe
    Signed-off-by: Peter Huewe

    Jarkko Sakkinen
     
  • The command buffer address must be read with exactly two 32-bit reads.
    Otherwise, on some HW platforms, it seems that HW will abort the read
    operation, which causes CPU to fill the read bytes with 1's. Therefore,
    we cannot rely on memcpy_fromio() but must call ioread32() two times
    instead.

    Also, this matches the PC Client Platform TPM Profile specification,
    which defines command buffer address with two 32-bit fields.

    Cc: stable@kernel.org
    Signed-off-by: Jarkko Sakkinen
    Reviewed-by: Peter Huewe
    Signed-off-by: Peter Huewe

    Jarkko Sakkinen
     
  • At ibm vtpm initialzation, tpm_ibmvtpm_probe() registers its interrupt
    handler, ibmvtpm_interrupt, which calls ibmvtpm_crq_process to allocate
    memory for rtce buffer. The current code uses 'GFP_KERNEL' as the
    type of kernel memory allocation, which resulted a warning at
    kernel/lockdep.c. This patch uses 'GFP_ATOMIC' instead so that the
    allocation is high-priority and does not sleep.

    Cc: stable@kernel.org
    Signed-off-by: Hon Ching(Vicky) Lo
    Signed-off-by: Peter Huewe

    Hon Ching \(Vicky\) Lo
     
  • The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
    not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
    functionality only, can still be compiled if GPIOLIB is not enabled.

    Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where
    appropriate.

    Signed-off-by: Geert Uytterhoeven
    Acked-by: Linus Walleij
    Reviewed-by: Peter Huewe
    Signed-off-by: Peter Huewe

    Geert Uytterhoeven
     

10 Oct, 2015

5 commits

  • This fix writes the task label when
    smack_d_instantiate is called, before the
    label of the superblock was written on the
    pipe's inode.

    Signed-off-by: Roman Kubiak
    Acked-by: Casey Schaufler

    Roman Kubiak
     
  • This change has two goals:
    - delay the setting of 'smack_enabled' until
    it will be really effective
    - ensure that smackfs is valid only if 'smack_enabled'
    is set (it is already the case in smack_netfilter.c)

    Signed-off-by: José Bollo
    Acked-by: Casey Schaufler

    José Bollo
     
  • Fixes the following sparse warning:

    security/smack/smack_lsm.c:55:1: warning: symbol 'smk_ipv6_port_list'
    was not declared. Should it be static?

    Signed-off-by: Geliang Tang
    Acked-by: Casey Schaufler

    Geliang Tang
     
  • 'commit e774ad683f42 ("smack: pass error code through pointers")'
    made this function return proper error codes instead of NULL. Reflect that.

    This is a fix for a NULL dereference introduced in
    'commit 21abb1ec414c ("Smack: IPv6 host labeling")'

    echo "$SOME_IPV6_ADDR \"test" > /smack/ipv6host
    (this should return EINVAL, it doesn't)
    cat /smack/ipv6host
    (derefences 0x000a)

    Signed-off-by: Lukasz Pawelczyk
    Acked-by: Casey Schaufler

    Lukasz Pawelczyk
     
  • If IMA_LOAD_X509 is enabled, either directly or indirectly via
    IMA_APPRAISE_SIGNED_INIT, certificates are loaded onto the IMA
    trusted keyring by the kernel via key_create_or_update(). When
    the KEY_ALLOC_TRUSTED flag is provided, certificates are loaded
    without first verifying the certificate is properly signed by a
    trusted key on the system keyring. This patch removes the
    KEY_ALLOC_TRUSTED flag.

    Signed-off-by: Dmitry Kasatkin
    Cc: # 3.19+
    Signed-off-by: Mimi Zohar

    Dmitry Kasatkin
     

04 Oct, 2015

6 commits

  • Linus Torvalds
     
  • Pull strscpy string copy function implementation from Chris Metcalf.

    Chris sent this during the merge window, but I waffled back and forth on
    the pull request, which is why it's going in only now.

    The new "strscpy()" function is definitely easier to use and more secure
    than either strncpy() or strlcpy(), both of which are horrible nasty
    interfaces that have serious and irredeemable problems.

    strncpy() has a useless return value, and doesn't NUL-terminate an
    overlong result. To make matters worse, it pads a short result with
    zeroes, which is a performance disaster if you have big buffers.

    strlcpy(), by contrast, is a mis-designed "fix" for strlcpy(), lacking
    the insane NUL padding, but having a differently broken return value
    which returns the original length of the source string. Which means
    that it will read characters past the count from the source buffer, and
    you have to trust the source to be properly terminated. It also makes
    error handling fragile, since the test for overflow is unnecessarily
    subtle.

    strscpy() avoids both these problems, guaranteeing the NUL termination
    (but not excessive padding) if the destination size wasn't zero, and
    making the overflow condition very obvious by returning -E2BIG. It also
    doesn't read past the size of the source, and can thus be used for
    untrusted source data too.

    So why did I waffle about this for so long?

    Every time we introduce a new-and-improved interface, people start doing
    these interminable series of trivial conversion patches.

    And every time that happens, somebody does some silly mistake, and the
    conversion patch to the improved interface actually makes things worse.
    Because the patch is mindnumbing and trivial, nobody has the attention
    span to look at it carefully, and it's usually done over large swatches
    of source code which means that not every conversion gets tested.

    So I'm pulling the strscpy() support because it *is* a better interface.
    But I will refuse to pull mindless conversion patches. Use this in
    places where it makes sense, but don't do trivial patches to fix things
    that aren't actually known to be broken.

    * 'strscpy' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile:
    tile: use global strscpy() rather than private copy
    string: provide strscpy()
    Make asm/word-at-a-time.h available on all architectures

    Linus Torvalds
     
  • Pull md fixes from Neil Brown:
    "Assorted fixes for md in 4.3-rc.

    Two tagged for -stable, and one is really a cleanup to match and
    improve kmemcache interface.

    * tag 'md/4.3-fixes' of git://neil.brown.name/md:
    md/bitmap: don't pass -1 to bitmap_storage_alloc.
    md/raid1: Avoid raid1 resync getting stuck
    md: drop null test before destroy functions
    md: clear CHANGE_PENDING in readonly array
    md/raid0: apply base queue limits *before* disk_stack_limits
    md/raid5: don't index beyond end of array in need_this_block().
    raid5: update analysis state for failed stripe
    md: wait for pending superblock updates before switching to read-only

    Linus Torvalds
     
  • Pull MIPS updates from Ralf Baechle:
    "This week's round of MIPS fixes:
    - Fix JZ4740 build
    - Fix fallback to GFP_DMA
    - FP seccomp in case of ENOSYS
    - Fix bootmem panic
    - A number of FP and CPS fixes
    - Wire up new syscalls
    - Make sure BPF assembler objects can properly be disassembled
    - Fix BPF assembler code for MIPS I"

    * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
    MIPS: scall: Always run the seccomp syscall filters
    MIPS: Octeon: Fix kernel panic on startup from memory corruption
    MIPS: Fix R2300 FP context switch handling
    MIPS: Fix octeon FP context switch handling
    MIPS: BPF: Fix load delay slots.
    MIPS: BPF: Do all exports of symbols with FEXPORT().
    MIPS: Fix the build on jz4740 after removing the custom gpio.h
    MIPS: CPS: #ifdef on CONFIG_MIPS_MT_SMP rather than CONFIG_MIPS_MT
    MIPS: CPS: Don't include MT code in non-MT kernels.
    MIPS: CPS: Stop dangling delay slot from has_mt.
    MIPS: dma-default: Fix 32-bit fall back to GFP_DMA
    MIPS: Wire up userfaultfd and membarrier syscalls.

    Linus Torvalds
     
  • Pull irq fixes from Thomas Gleixner:
    "This update contains:

    - Fix for a long standing race affecting /proc/irq/NNN

    - One line fix for ARM GICV3-ITS counting the wrong data

    - Warning silencing in ARM GICV3-ITS. Another GCC trying to be
    overly clever issue"

    * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    irqchip/gic-v3-its: Count additional LPIs for the aliased devices
    irqchip/gic-v3-its: Silence warning when its_lpi_alloc_chunks gets inlined
    genirq: Fix race in register_irq_proc()

    Linus Torvalds
     
  • The MIPS syscall handler code used to return -ENOSYS on invalid
    syscalls. Whilst this is expected, it caused problems for seccomp
    filters because the said filters never had the change to run since
    the code returned -ENOSYS before triggering them. This caused
    problems on the chromium testsuite for filters looking for invalid
    syscalls. This has now changed and the seccomp filters are always
    run even if the syscall is invalid. We return -ENOSYS once we
    return from the seccomp filters. Moreover, similar codepaths have
    been merged in the process which simplifies somewhat the overall
    syscall code.

    Signed-off-by: Markos Chandras
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/11236/
    Signed-off-by: Ralf Baechle

    Markos Chandras
     

03 Oct, 2015

6 commits

  • Pull x86 fixes from Ingo Molnar:
    "Fixes all around the map: W+X kernel mapping fix, WCHAN fixes, two
    build failure fixes for corner case configs, x32 header fix and a
    speling fix"

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/headers/uapi: Fix __BITS_PER_LONG value for x32 builds
    x86/mm: Set NX on gap between __ex_table and rodata
    x86/kexec: Fix kexec crash in syscall kexec_file_load()
    x86/process: Unify 32bit and 64bit implementations of get_wchan()
    x86/process: Add proper bound checks in 64bit get_wchan()
    x86, efi, kasan: Fix build failure on !KASAN && KMEMCHECK=y kernels
    x86/hyperv: Fix the build in the !CONFIG_KEXEC_CORE case
    x86/cpufeatures: Correct spelling of the HWP_NOTIFY flag

    Linus Torvalds
     
  • Pull timer fixes from Ingo Molnar:
    "An abs64() fix in the watchdog driver, and two clocksource driver
    NO_IRQ assumption fixes"

    * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    clocksource: Fix abs() usage w/ 64bit values
    clocksource/drivers/keystone: Fix bad NO_IRQ usage
    clocksource/drivers/rockchip: Fix bad NO_IRQ usage

    Linus Torvalds
     
  • Pull EFI fixes from Ingo Molnar:
    "Two EFI fixes: one for x86, one for ARM, fixing a boot crash bug that
    can trigger under newer EFI firmware"

    * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    arm64/efi: Fix boot crash by not padding between EFI_MEMORY_RUNTIME regions
    x86/efi: Fix boot crash by mapping EFI memmap entries bottom-up at runtime, instead of top-down

    Linus Torvalds
     
  • Pull drm fixes from Dave Airlie:
    "Bunch of fixes all over the place, all pretty small: amdgpu, i915,
    exynos, one qxl and one vmwgfx.

    There is also a bunch of mst fixes, I left some cleanups in the series
    as I didn't think it was worth splitting up the tested series"

    * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (37 commits)
    drm/dp/mst: add some defines for logical/physical ports
    drm/dp/mst: drop cancel work sync in the mstb destroy path (v2)
    drm/dp/mst: split connector registration into two parts (v2)
    drm/dp/mst: update the link_address_sent before sending the link address (v3)
    drm/dp/mst: fixup handling hotplug on port removal.
    drm/dp/mst: don't pass port into the path builder function
    drm/radeon: drop radeon_fb_helper_set_par
    drm: handle cursor_set2 in restore_fbdev_mode
    drm/exynos: Staticize local function in exynos_drm_gem.c
    drm/exynos: fimd: actually disable dp clock
    drm/exynos: dp: remove suspend/resume functions
    drm/qxl: recreate the primary surface when the bo is not primary
    drm/amdgpu: only print meaningful VM faults
    drm/amdgpu/cgs: remove import_gpu_mem
    drm/i915: Call non-locking version of drm_kms_helper_poll_enable(), v2
    drm: Add a non-locking version of drm_kms_helper_poll_enable(), v2
    drm/vmwgfx: Fix a command submission hang regression
    drm/exynos: remove unused mode_fixup() code
    drm/exynos: remove decon_mode_fixup()
    drm/exynos: remove fimd_mode_fixup()
    ...

    Linus Torvalds
     
  • Pull input layer fixes from Dmitry Torokhov:
    "Fixes for two recent regressions (in Synaptics PS/2 and uinput
    drivers) and some more driver fixups"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
    Revert "Input: synaptics - fix handling of disabling gesture mode"
    Input: psmouse - fix data race in __ps2_command
    Input: elan_i2c - add all valid ic type for i2c/smbus
    Input: zhenhua - ensure we have BITREVERSE
    Input: omap4-keypad - fix memory leak
    Input: serio - fix blocking of parport
    Input: uinput - fix crash when using ABS events
    Input: elan_i2c - expand maximum product_id form 0xFF to 0xFFFF
    Input: elan_i2c - add ic type 0x03
    Input: elan_i2c - don't require known iap version
    Input: imx6ul_tsc - fix controller name
    Input: imx6ul_tsc - use the preferred method for kzalloc()
    Input: imx6ul_tsc - check for negative return value
    Input: imx6ul_tsc - propagate the errors
    Input: walkera0701 - fix abs() calculations on 64 bit values
    Input: mms114 - remove unneded semicolons
    Input: pm8941-pwrkey - remove unneded semicolon
    Input: fix typo in MT documentation
    Input: cyapa - fix address of Gen3 devices in device tree documentation

    Linus Torvalds
     
  • This patch fixes one cases where abs() was being used with 64-bit
    nanosecond values, where the result may be capped at 32-bits.

    This potentially could cause watchdog false negatives on 32-bit
    systems, so this patch addresses the issue by using abs64().

    Signed-off-by: John Stultz
    Cc: Prarit Bhargava
    Cc: Richard Cochran
    Cc: Ingo Molnar
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/1442279124-7309-2-git-send-email-john.stultz@linaro.org
    Signed-off-by: Thomas Gleixner

    John Stultz