1. 09 Jul, 2014 8 commits
  2. 08 Jul, 2014 7 commits
    • David Howells's avatar
      45206986
    • David Howells's avatar
      PKCS#7: Provide a key type for testing PKCS#7 · 22d01afb
      David Howells authored
      Provide a key type for testing the PKCS#7 parser.  It is given a non-detached
      PKCS#7 message as payload:
      
      	keyctl padd pkcs7_test a @s <stuff.pkcs7
      
      The PKCS#7 wrapper is validated against the trusted certificates available and
      then stripped off.  If successful, the key can be read, which will give the
      data content of the PKCS#7 message.
      
      A suitable message can be created by running make on the attached Makefile.
      This will produce a file called stuff.pkcs7 for test loading.  The key3.x509
      file should be put into the kernel source tree before it is built and
      converted to DER form:
      
      	openssl x509 -in .../pkcs7/key3.x509 -outform DER -out key3.x509
      
      ###############################################################################
      #
      # Create a pkcs7 message and sign it twice
      #
      #	openssl x509 -text -inform PEM -noout -in key2.x509
      #
      ###############################################################################
      stuff.pkcs7: stuff.txt key2.priv key2.x509 key4.priv key4.x509 certs
      	$(RM) $@
      	openssl smime -sign \
      		-signer key2.x509 \
      		-inkey key2.priv \
      		-signer key4.x509 \
      		-inkey key4.priv \
      		-in stuff.txt \
      		-certfile certs \
      		-out $@ -binary -outform DER -nodetach
      	openssl pkcs7 -inform DER -in stuff.pkcs7  -print_certs -noout
      	openssl asn1parse -inform DER -in stuff.pkcs7  -i >out
      
      stuff.txt:
      	echo "The quick red fox jumped over the lazy brown dog" >stuff.txt
      
      certs: key1.x509 key2.x509 key3.x509 key4.x509
      	cat key{1,3}.x509 >$@
      
      ###############################################################################
      #
      # Generate a signed key
      #
      #	openssl x509 -text -inform PEM -noout -in key2.x509
      #
      ###############################################################################
      key2.x509: key2.x509_unsigned key1.priv key1.x509
      	openssl x509 \
      		-req -in key2.x509_unsigned \
      		-out key2.x509 \
      		-extfile key2.genkey -extensions myexts \
      		-CA key1.x509 \
      		-CAkey key1.priv \
      		-CAcreateserial
      
      key2.priv key2.x509_unsigned: key2.genkey
      	openssl req -new -nodes -utf8 -sha1 -days 36500 \
      		-batch -outform PEM \
      		-config key2.genkey \
      		-keyout key2.priv \
      		-out key2.x509_unsigned
      
      key2.genkey:
      	@echo Generating X.509 key generation config
      	@echo  >$@ "[ req ]"
      	@echo >>$@ "default_bits = 4096"
      	@echo >>$@ "distinguished_name = req_distinguished_name"
      	@echo >>$@ "prompt = no"
      	@echo >>$@ "string_mask = utf8only"
      	@echo >>$@ "x509_extensions = myexts"
      	@echo >>$@
      	@echo >>$@ "[ req_distinguished_name ]"
      	@echo >>$@ "O = Magrathea"
      	@echo >>$@ "CN = PKCS7 key 2"
      	@echo >>$@ "emailAddress = slartibartfast@magrathea.h2g2"
      	@echo >>$@
      	@echo >>$@ "[ myexts ]"
      	@echo >>$@ "basicConstraints=critical,CA:FALSE"
      	@echo >>$@ "keyUsage=digitalSignature"
      	@echo >>$@ "subjectKeyIdentifier=hash"
      	@echo >>$@ "authorityKeyIdentifier=keyid"
      
      ###############################################################################
      #
      # Generate a couple of signing keys
      #
      #	openssl x509 -text -inform PEM -noout -in key1.x509
      #
      ###############################################################################
      key1.x509: key1.x509_unsigned key4.priv key4.x509
      	openssl x509 \
      		-req -in key1.x509_unsigned \
      		-out key1.x509 \
      		-extfile key1.genkey -extensions myexts \
      		-CA key4.x509 \
      		-CAkey key4.priv \
      		-CAcreateserial
      
      key1.priv key1.x509_unsigned: key1.genkey
      	openssl req -new -nodes -utf8 -sha1 -days 36500 \
      		-batch -outform PEM \
      		-config key1.genkey \
      		-keyout key1.priv \
      		-out key1.x509_unsigned
      
      key1.genkey:
      	@echo Generating X.509 key generation config
      	@echo  >$@ "[ req ]"
      	@echo >>$@ "default_bits = 4096"
      	@echo >>$@ "distinguished_name = req_distinguished_name"
      	@echo >>$@ "prompt = no"
      	@echo >>$@ "string_mask = utf8only"
      	@echo >>$@ "x509_extensions = myexts"
      	@echo >>$@
      	@echo >>$@ "[ req_distinguished_name ]"
      	@echo >>$@ "O = Magrathea"
      	@echo >>$@ "CN = PKCS7 key 1"
      	@echo >>$@ "emailAddress = slartibartfast@magrathea.h2g2"
      	@echo >>$@
      	@echo >>$@ "[ myexts ]"
      	@echo >>$@ "basicConstraints=critical,CA:TRUE"
      	@echo >>$@ "keyUsage=digitalSignature,keyCertSign"
      	@echo >>$@ "subjectKeyIdentifier=hash"
      	@echo >>$@ "authorityKeyIdentifier=keyid"
      
      ###############################################################################
      #
      # Generate a signed key
      #
      #	openssl x509 -text -inform PEM -noout -in key4.x509
      #
      ###############################################################################
      key4.x509: key4.x509_unsigned key3.priv key3.x509
      	openssl x509 \
      		-req -in key4.x509_unsigned \
      		-out key4.x509 \
      		-extfile key4.genkey -extensions myexts \
      		-CA key3.x509 \
      		-CAkey key3.priv \
      		-CAcreateserial
      
      key4.priv key4.x509_unsigned: key4.genkey
      	openssl req -new -nodes -utf8 -sha1 -days 36500 \
      		-batch -outform PEM \
      		-config key4.genkey \
      		-keyout key4.priv \
      		-out key4.x509_unsigned
      
      key4.genkey:
      	@echo Generating X.509 key generation config
      	@echo  >$@ "[ req ]"
      	@echo >>$@ "default_bits = 4096"
      	@echo >>$@ "distinguished_name = req_distinguished_name"
      	@echo >>$@ "prompt = no"
      	@echo >>$@ "string_mask = utf8only"
      	@echo >>$@ "x509_extensions = myexts"
      	@echo >>$@
      	@echo >>$@ "[ req_distinguished_name ]"
      	@echo >>$@ "O = Magrathea"
      	@echo >>$@ "CN = PKCS7 key 4"
      	@echo >>$@ "emailAddress = slartibartfast@magrathea.h2g2"
      	@echo >>$@
      	@echo >>$@ "[ myexts ]"
      	@echo >>$@ "basicConstraints=critical,CA:TRUE"
      	@echo >>$@ "keyUsage=digitalSignature,keyCertSign"
      	@echo >>$@ "subjectKeyIdentifier=hash"
      	@echo >>$@ "authorityKeyIdentifier=keyid"
      
      ###############################################################################
      #
      # Generate a couple of signing keys
      #
      #	openssl x509 -text -inform PEM -noout -in key3.x509
      #
      ###############################################################################
      key3.priv key3.x509: key3.genkey
      	openssl req -new -nodes -utf8 -sha1 -days 36500 \
      		-batch -x509 -outform PEM \
      		-config key3.genkey \
      		-keyout key3.priv \
      		-out key3.x509
      
      key3.genkey:
      	@echo Generating X.509 key generation config
      	@echo  >$@ "[ req ]"
      	@echo >>$@ "default_bits = 4096"
      	@echo >>$@ "distinguished_name = req_distinguished_name"
      	@echo >>$@ "prompt = no"
      	@echo >>$@ "string_mask = utf8only"
      	@echo >>$@ "x509_extensions = myexts"
      	@echo >>$@
      	@echo >>$@ "[ req_distinguished_name ]"
      	@echo >>$@ "O = Magrathea"
      	@echo >>$@ "CN = PKCS7 key 3"
      	@echo >>$@ "emailAddress = slartibartfast@magrathea.h2g2"
      	@echo >>$@
      	@echo >>$@ "[ myexts ]"
      	@echo >>$@ "basicConstraints=critical,CA:TRUE"
      	@echo >>$@ "keyUsage=digitalSignature,keyCertSign"
      	@echo >>$@ "subjectKeyIdentifier=hash"
      	@echo >>$@ "authorityKeyIdentifier=keyid"
      
      clean:
      	$(RM) *~
      	$(RM) key1.* key2.* key3.* key4.* stuff.* out certs
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      22d01afb
    • David Howells's avatar
      PKCS#7: Find intersection between PKCS#7 message and known, trusted keys · 08815b62
      David Howells authored
      Find the intersection between the X.509 certificate chain contained in a PKCS#7
      message and a set of keys that we already know and trust.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarVivek Goyal <vgoyal@redhat.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      08815b62
    • David Howells's avatar
      PKCS#7: Verify internal certificate chain · 8c76d793
      David Howells authored
      Verify certificate chain in the X.509 certificates contained within the PKCS#7
      message as far as possible.  If any signature that we should be able to verify
      fails, we reject the whole lot.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarVivek Goyal <vgoyal@redhat.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      8c76d793
    • David Howells's avatar
      PKCS#7: Find the right key in the PKCS#7 key list and verify the signature · a4730357
      David Howells authored
      Find the appropriate key in the PKCS#7 key list and verify the signature with
      it.  There may be several keys in there forming a chain.  Any link in that
      chain or the root of that chain may be in our keyrings.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarVivek Goyal <vgoyal@redhat.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      a4730357
    • David Howells's avatar
      PKCS#7: Digest the data in a signed-data message · 9f0d3314
      David Howells authored
      Digest the data in a PKCS#7 signed-data message and attach to the
      public_key_signature struct contained in the pkcs7_message struct.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarVivek Goyal <vgoyal@redhat.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      9f0d3314
    • David Howells's avatar
      PKCS#7: Implement a parser [RFC 2315] · 2e3fadbf
      David Howells authored
      Implement a parser for a PKCS#7 signed-data message as described in part of
      RFC 2315.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarVivek Goyal <vgoyal@redhat.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      2e3fadbf
  3. 02 Jul, 2014 1 commit
  4. 01 Jul, 2014 1 commit
  5. 30 Jun, 2014 1 commit
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 16874b2c
      Linus Torvalds authored
      Pull ext4 bugfixes from Ted Ts'o:
       "Fix a regression when trying to compile ext4 on older versions gcc.
      
        Fix a number of miscellaneous bugs for punch hole as well as a
        long-standing potential double buffer head release when failing a
        block allocation for an indirect-mapped file"
      
      * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: Fix hole punching for files with indirect blocks
        ext4: Fix block zeroing when punching holes in indirect block files
        ext4: decrement free clusters/inodes counters when block group declared bad
        fs/mbcache: replace __builtin_log2() with ilog2()
        ext4: Fix buffer double free in ext4_alloc_branch()
      16874b2c
  6. 29 Jun, 2014 10 commits
  7. 28 Jun, 2014 12 commits
    • Linus Torvalds's avatar
      Merge tag 'spi-v3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · 24b414d5
      Linus Torvalds authored
      Pull spi fixes from Mark Brown:
       "A few driver specific fixes, the biggest one being a fix for the newly
        added Qualcomm SPI controller driver to make it not use its internal
        chip select due to hardware bugs, replacing it with GPIOs"
      
      * tag 'spi-v3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
        spi: qup: Remove chip select function
        spi: qup: Fix order of spi_register_master
        spi: sh-sci: fix use-after-free in sh_sci_spi_remove()
        spi/pxa2xx: fix incorrect SW mode chipselect setting for BayTrail LPSS SPI
      24b414d5
    • Linus Torvalds's avatar
      Merge tag 'regulator-v3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator · 4194976b
      Linus Torvalds authored
      Pull regulator fixes from Mark Brown:
       "Several driver specific fixes here, the palmas fixes being especially
        important for a range of boards - the recent updates to support new
        devices have introduced several regressions"
      
      * tag 'regulator-v3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
        regulator: tps65218: Correct the the config register for LDO1
        regulator: tps65218: Add the missing of_node assignment in probe
        regulator: palmas: fix typo in enable_reg calculation
        regulator: bcm590xx: fix vbus name
        regulator: palmas: Fix SMPS enable/disable/is_enabled
      4194976b
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending · eb477e03
      Linus Torvalds authored
      Pull SCSI target fixes from Nicholas Bellinger:
       "Mostly minor fixes this time around.  The highlights include:
      
         - iscsi-target CHAP authentication fixes to enforce explicit key
           values (Tejas Vaykole + rahul.rane)
         - fix a long-standing OOPs in target-core when a alua configfs
           attribute is accessed after port symlink has been removed.
           (Sebastian Herbszt)
         - fix a v3.10.y iscsi-target regression causing the login reject
           status class/detail to be ignored (Christoph Vu-Brugier)
         - fix a v3.10.y iscsi-target regression to avoid rejecting an
           existing ITT during Data-Out when data-direction is wrong (Santosh
           Kulkarni + Arshad Hussain)
         - fix a iscsi-target related shutdown deadlock on UP kernels (Mikulas
           Patocka)
         - fix a v3.16-rc1 build issue with vhost-scsi + !CONFIG_NET (MST)"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
        iscsi-target: fix iscsit_del_np deadlock on unload
        iovec: move memcpy_from/toiovecend to lib/iovec.c
        iscsi-target: Avoid rejecting incorrect ITT for Data-Out
        tcm_loop: Fix memory leak in tcm_loop_submission_work error path
        iscsi-target: Explicily clear login response PDU in exception path
        target: Fix left-over se_lun->lun_sep pointer OOPs
        iscsi-target; Enforce 1024 byte maximum for CHAP_C key value
        iscsi-target: Convert chap_server_compute_md5 to use kstrtoul
      eb477e03
    • Mark Brown's avatar
    • Mark Brown's avatar
      Merge remote-tracking branches 'regulator/fix/bcm590xx',... · 11767484
      Mark Brown authored
      Merge remote-tracking branches 'regulator/fix/bcm590xx', 'regulator/fix/palmas' and 'regulator/fix/tps65218' into regulator-linus
      11767484
    • Mikulas Patocka's avatar
      iscsi-target: fix iscsit_del_np deadlock on unload · 81a9c5e7
      Mikulas Patocka authored
      On uniprocessor preemptible kernel, target core deadlocks on unload. The
      following events happen:
      * iscsit_del_np is called
      * it calls send_sig(SIGINT, np->np_thread, 1);
      * the scheduler switches to the np_thread
      * the np_thread is woken up, it sees that kthread_should_stop() returns
        false, so it doesn't terminate
      * the np_thread clears signals with flush_signals(current); and goes back
        to sleep in iscsit_accept_np
      * the scheduler switches back to iscsit_del_np
      * iscsit_del_np calls kthread_stop(np->np_thread);
      * the np_thread is waiting in iscsit_accept_np and it doesn't respond to
        kthread_stop
      
      The deadlock could be resolved if the administrator sends SIGINT signal to
      the np_thread with killall -INT iscsi_np
      
      The reproducible deadlock was introduced in commit
      db6077fd, but the thread-stopping code was
      racy even before.
      
      This patch fixes the problem. Using kthread_should_stop to stop the
      np_thread is unreliable, so we test np_thread_state instead. If
      np_thread_state equals ISCSI_NP_THREAD_SHUTDOWN, the thread exits.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      81a9c5e7
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 3e7b256c
      Linus Torvalds authored
      Pull IOMMU fixes from Joerg Roedel:
      
       - fix VT-d regression with handling multiple RMRR entries per device
      
       - fix a small race that was left in the mmu_notifier handling in the
         AMD IOMMUv2 driver
      
      * tag 'iommu-fixes-v3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/amd: Fix small race between invalidate_range_end/start
        iommu/vt-d: fix bug in handling multiple RMRRs for the same PCI device
      3e7b256c
    • Linus Torvalds's avatar
      Merge branch 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · d1fc98ba
      Linus Torvalds authored
      Pull x86 fixes from Peter Anvin:
       "A pile of fixes related to the VDSO, EFI and 32-bit badsys handling.
      
        It turns out that removing the section headers from the VDSO breaks
        gdb, so this puts back most of them.  A very simple typo broke
        rt_sigreturn on some versions of glibc, with obviously disastrous
        results.  The rest is pretty much fixes for the corresponding fallout.
      
        The EFI fixes fixes an arithmetic overflow on 32-bit systems and
        quiets some build warnings.
      
        Finally, when invoking an invalid system call number on x86-32, we
        bypass a bunch of handling, which can make the audit code oops"
      
      * 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        efi-pstore: Fix an overflow on 32-bit builds
        x86/vdso: Error out in vdso2c if DT_RELA is present
        x86/vdso: Move DISABLE_BRANCH_PROFILING into the vdso makefile
        x86_32, signal: Fix vdso rt_sigreturn
        x86_32, entry: Do syscall exit work on badsys (CVE-2014-4508)
        x86/vdso: Create .build-id links for unstripped vdso files
        x86/vdso: Remove some redundant in-memory section headers
        x86/vdso: Improve the fake section headers
        x86/vdso2c: Use better macros for ELF bitness
        x86/vdso: Discard the __bug_table section
        efi: Fix compiler warnings (unused, const, type)
      d1fc98ba
    • Linus Torvalds's avatar
      Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus · c9a60666
      Linus Torvalds authored
      Pull MIPS fixes from Ralf Baechle:
       "This is dominated by a large number of changes necessary for the MIPS
        BPF code.  code.  Aside of that there are
      
         - a fix for the MSC system controller support code.
         - a Turbochannel fix.
         - a recordmcount fix that's MIPS-specific.
         - barrier fixes to smp-cps / pm-cps after unrelated changes elsewhere
           in the kernel.
         - revert support for MSA registers in the signal frames.  The
           reverted patch did modify the signal stack frame which of course is
           inacceptable.
         - fix math-emu build breakage with older compilers.
         - some related cleanup.
         - fix Lasat build error if CONFIG_CRC32 isn't set to y by the user"
      
      * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (27 commits)
        MIPS: Lasat: Fix build error if CRC32 is not enabled.
        TC: Handle device_register() errors.
        MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region
        MIPS: bpf: Fix stack space allocation for BPF memwords on MIPS64
        MIPS: BPF: Use 32 or 64-bit load instruction to load an address to register
        MIPS: bpf: Fix PKT_TYPE case for big-endian cores
        MIPS: BPF: Prevent kernel fall over for >=32bit shifts
        MIPS: bpf: Drop update_on_xread and always initialize the X register
        MIPS: bpf: Fix is_range() semantics
        MIPS: bpf: Use pr_debug instead of pr_warn for unhandled opcodes
        MIPS: bpf: Fix return values for VLAN_TAG_PRESENT case
        MIPS: bpf: Use correct mask for VLAN_TAG case
        MIPS: bpf: Fix branch conditional for BPF_J{GT/GE} cases
        MIPS: bpf: Add SEEN_SKB to flags when looking for the PKT_TYPE
        MIPS: bpf: Use 'andi' instead of 'and' for the VLAN cases
        MIPS: bpf: Return error code if the offset is a negative number
        MIPS: bpf: Use the LO register to get division's quotient
        MIPS: mm: uasm: Fix lh micro-assembler instruction
        MIPS: uasm: Add SLT uasm instruction
        MIPS: uasm: Add s3s1s2 instruction builder
        ...
      c9a60666
    • Linus Torvalds's avatar
      Merge tag 'arc-fixes-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc · 1857a5b6
      Linus Torvalds authored
      Pull ARC fixes from Vineet Gupta:
       "Some SMP changes, a ptrace request for NPTL debugging, bunch of build
        breakages/warnings"
      
      * tag 'arc-fixes-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc:
        ARC: [SMP] Enable icache coherency
        ARC: [SMP] Fix IPI IRQ registration
        ARC: Implement ptrace(PTRACE_GET_THREAD_AREA)
        ARC: optimize kernel bss clearing in early boot code
        ARC: Fix build breakage for !CONFIG_ARC_DW2_UNWIND
        ARC: fix build warning in devtree
        ARC: remove checks for CONFIG_ARC_MMU_V4
      1857a5b6
    • Linus Torvalds's avatar
      Merge tag 'compress-3.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core · 8dd68eb3
      Linus Torvalds authored
      Pull compress bugfix from Greg KH:
       "Here is another lz4 bugfix for 3.16-rc3 that resolves a reported issue
        with that compression algorithm"
      
      * tag 'compress-3.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        lz4: fix another possible overrun
      8dd68eb3
    • Linus Torvalds's avatar
      Merge tag 'stable/for-linus-3.16-rc1-tag' of... · 772205d8
      Linus Torvalds authored
      Merge tag 'stable/for-linus-3.16-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb
      
      Pull swiotlb bugfix from Konrad Rzeszutek Wilk:
       "One bug-fix that had been in tree for quite some time.  We had assumed
        that the physical address zero was invalid and would fail it.  But
        that is not true and on some architectures it is not reserved and
        valid.  This fixes it"
      
      * tag 'stable/for-linus-3.16-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb:
        swiotlb: don't assume PA 0 is invalid
      772205d8