1. 07 8月, 2015 10 次提交
  2. 05 8月, 2015 4 次提交
    • D
      ASN.1: Handle 'ANY OPTIONAL' in grammar · 233ce79d
      David Howells 提交于
      An ANY object in an ASN.1 grammar that is marked OPTIONAL should be skipped
      if there is no more data to be had.
      
      This can be tested by editing X.509 certificates or PKCS#7 messages to
      remove the NULL from subobjects that look like the following:
      
      	SEQUENCE {
      	  OBJECT(2a864886f70d01010b);
      	  NULL();
      	}
      
      This is an algorithm identifier plus an optional parameter.
      
      The modified DER can be passed to one of:
      
      	keyctl padd asymmetric "" @s </tmp/modified.x509
      	keyctl padd pkcs7_test foo @s </tmp/modified.pkcs7
      
      It should work okay with the patch and produce EBADMSG without.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Tested-by: NMarcel Holtmann <marcel@holtmann.org>
      Reviewed-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      233ce79d
    • D
      ASN.1: Fix non-match detection failure on data overrun · 0d62e9dd
      David Howells 提交于
      If the ASN.1 decoder is asked to parse a sequence of objects, non-optional
      matches get skipped if there's no more data to be had rather than a
      data-overrun error being reported.
      
      This is due to the code segment that decides whether to skip optional
      matches (ie. matches that could get ignored because an element is marked
      OPTIONAL in the grammar) due to a lack of data also skips non-optional
      elements if the data pointer has reached the end of the buffer.
      
      This can be tested with the data decoder for the new RSA akcipher algorithm
      that takes three non-optional integers.  Currently, it skips the last
      integer if there is insufficient data.
      
      Without the fix, #defining DEBUG in asn1_decoder.c will show something
      like:
      
      	next_op: pc=0/13 dp=0/270 C=0 J=0
      	- match? 30 30 00
      	- TAG: 30 266 CONS
      	next_op: pc=2/13 dp=4/270 C=1 J=0
      	- match? 02 02 00
      	- TAG: 02 257
      	- LEAF: 257
      	next_op: pc=5/13 dp=265/270 C=1 J=0
      	- match? 02 02 00
      	- TAG: 02 3
      	- LEAF: 3
      	next_op: pc=8/13 dp=270/270 C=1 J=0
      	next_op: pc=11/13 dp=270/270 C=1 J=0
      	- end cons t=4 dp=270 l=270/270
      
      The next_op line for pc=8/13 should be followed by a match line.
      
      This is not exploitable for X.509 certificates by means of shortening the
      message and fixing up the ASN.1 CONS tags because:
      
       (1) The relevant records being built up are cleared before use.
      
       (2) If the message is shortened sufficiently to remove the public key, the
           ASN.1 parse of the RSA key will fail quickly due to a lack of data.
      
       (3) Extracted signature data is either turned into MPIs (which cope with a
           0 length) or is simpler integers specifying algoritms and suchlike
           (which can validly be 0); and
      
       (4) The AKID and SKID extensions are optional and their removal is handled
           without risking passing a NULL to asymmetric_key_generate_id().
      
       (5) If the certificate is truncated sufficiently to remove the subject,
           issuer or serialNumber then the ASN.1 decoder will fail with a 'Cons
           stack underflow' return.
      
      This is not exploitable for PKCS#7 messages by means of removal of elements
      from such a message from the tail end of a sequence:
      
       (1) Any shortened X.509 certs embedded in the PKCS#7 message are survivable
           as detailed above.
      
       (2) The message digest content isn't used if it shows a NULL pointer,
           similarly, the authattrs aren't used if that shows a NULL pointer.
      
       (3) A missing signature results in a NULL MPI - which the MPI routines deal
           with.
      
       (4) If data is NULL, it is expected that the message has detached content and
           that is handled appropriately.
      
       (5) If the serialNumber is excised, the unconditional action associated
           with it will pick up the containing SEQUENCE instead, so no NULL
           pointer will be seen here.
      
           If both the issuer and the serialNumber are excised, the ASN.1 decode
           will fail with an 'Unexpected tag' return.
      
           In either case, there's no way to get to asymmetric_key_generate_id()
           with a NULL pointer.
      
       (6) Other fields are decoded to simple integers.  Shortening the message
           to omit an algorithm ID field will cause checks on this to fail early
           in the verification process.
      
      
      This can also be tested by snipping objects off of the end of the ASN.1 stream
      such that mandatory tags are removed - or even from the end of internal
      SEQUENCEs.  If any mandatory tag is missing, the error EBADMSG *should* be
      produced.  Without this patch ERANGE or ENOPKG might be produced or the parse
      may apparently succeed, perhaps with ENOKEY or EKEYREJECTED being produced
      later, depending on what gets snipped.
      
      Just snipping off the final BIT_STRING or OCTET_STRING from either sample
      should be a start since both are mandatory and neither will cause an EBADMSG
      without the patches
      Reported-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Tested-by: NMarcel Holtmann <marcel@holtmann.org>
      Reviewed-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      0d62e9dd
    • D
      ASN.1: Fix actions on CHOICE elements with IMPLICIT tags · 3f3af97d
      David Howells 提交于
      In an ASN.1 description where there is a CHOICE construct that contains
      elements with IMPLICIT tags that refer to constructed types, actions to be
      taken on those elements should be conditional on the corresponding element
      actually being matched.  Currently, however, such actions are performed
      unconditionally in the middle of processing the CHOICE.
      
      For example, look at elements 'b' and 'e' here:
      
      	A ::= SEQUENCE {
      			CHOICE {
      			b [0] IMPLICIT B ({ do_XXXXXXXXXXXX_b }),
      			c [1] EXPLICIT C ({ do_XXXXXXXXXXXX_c }),
      			d [2] EXPLICIT B ({ do_XXXXXXXXXXXX_d }),
      			e [3] IMPLICIT C ({ do_XXXXXXXXXXXX_e }),
      			f [4] IMPLICIT INTEGER ({ do_XXXXXXXXXXXX_f })
      			}
      		} ({ do_XXXXXXXXXXXX_A })
      
      	B ::= SET OF OBJECT IDENTIFIER ({ do_XXXXXXXXXXXX_oid })
      
      	C ::= SET OF INTEGER ({ do_XXXXXXXXXXXX_int })
      
      They each have an action (do_XXXXXXXXXXXX_b and do_XXXXXXXXXXXX_e) that
      should only be processed if that element is matched.
      
      The problem is that there's no easy place to hang the action off in the
      subclause (type B for element 'b' and type C for element 'e') because
      subclause opcode sequences can be shared.
      
      To fix this, introduce a conditional action opcode(ASN1_OP_MAYBE_ACT) that
      the decoder only processes if the preceding match was successful.  This can
      be seen in an excerpt from the output of the fixed ASN.1 compiler for the
      above ASN.1 description:
      
      	[  13] =  ASN1_OP_COND_MATCH_JUMP_OR_SKIP,		// e
      	[  14] =  _tagn(CONT, CONS,  3),
      	[  15] =  _jump_target(45),		// --> C
      	[  16] =  ASN1_OP_MAYBE_ACT,
      	[  17] =  _action(ACT_do_XXXXXXXXXXXX_e),
      
      In this, if the op at [13] is matched (ie. element 'e' above) then the
      action at [16] will be performed.  However, if the op at [13] doesn't match
      or is skipped because it is conditional and some previous op matched, then
      the action at [16] will be ignored.
      
      Note that to make this work in the decoder, the ASN1_OP_RETURN op must set
      the flag to indicate that a match happened.  This is necessary because the
      _jump_target() seen above introduces a subclause (in this case an object of
      type 'C') which is likely to alter the flag.  Setting the flag here is okay
      because to process a subclause, a match must have happened and caused a
      jump.
      
      This cannot be tested with the code as it stands, but rather affects future
      code.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Reviewed-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      3f3af97d
    • D
      ASN.1: Fix handling of CHOICE in ASN.1 compiler · 8d9b21dc
      David Howells 提交于
      Fix the handling of CHOICE types in the ASN.1 compiler to make SEQUENCE and
      SET elements in a CHOICE be correctly rendered as skippable and conditional
      as appropriate.
      
      For example, in the following ASN.1:
      
      	Foo ::= SEQUENCE { w1 INTEGER, w2 Bar, w3 OBJECT IDENTIFIER }
      	Bar ::= CHOICE {
      		x1 Seq1,
      		x2 [0] IMPLICIT OCTET STRING,
      		x3 Seq2,
      		x4 SET OF INTEGER
      	}
      	Seq1 ::= SEQUENCE { y1 INTEGER, y2 INTEGER, y3 INTEGER }
      	Seq2 ::= SEQUENCE { z1 BOOLEAN, z2 BOOLEAN, z3 BOOLEAN }
      
      the output in foo.c generated by:
      
      	./scripts/asn1_compiler foo.asn1 foo.c foo.h
      
      included:
      
      	// Bar
      	// Seq1
      	[   4] =  ASN1_OP_MATCH,
      	[   5] =  _tag(UNIV, CONS, SEQ),
      	...
      	[  13] =  ASN1_OP_COND_MATCH_OR_SKIP,		// x2
      	[  14] =  _tagn(CONT, PRIM,  0),
      	// Seq2
      	[  15] =  ASN1_OP_MATCH,
      	[  16] =  _tag(UNIV, CONS, SEQ),
      	...
      	[  24] =  ASN1_OP_COND_MATCH_JUMP_OR_SKIP,		// x4
      	[  25] =  _tag(UNIV, CONS, SET),
      	...
      	[  27] =  ASN1_OP_COND_FAIL,
      
      as a result of the CHOICE - but this is wrong on lines 4 and 15 because
      both of these should be skippable (one and only one of the four can be
      picked) and the one on line 15 should also be conditional so that it is
      ignored if anything before it matches.
      
      After the patch, it looks like:
      
      	// Bar
      	// Seq1
      	[   4] =  ASN1_OP_MATCH_JUMP_OR_SKIP,		// x1
      	[   5] =  _tag(UNIV, CONS, SEQ),
      	...
      	[   7] =  ASN1_OP_COND_MATCH_OR_SKIP,		// x2
      	[   8] =  _tagn(CONT, PRIM,  0),
      	// Seq2
      	[   9] =  ASN1_OP_COND_MATCH_JUMP_OR_SKIP,		// x3
      	[  10] =  _tag(UNIV, CONS, SEQ),
      	...
      	[  12] =  ASN1_OP_COND_MATCH_JUMP_OR_SKIP,		// x4
      	[  13] =  _tag(UNIV, CONS, SET),
      	...
      	[  15] =  ASN1_OP_COND_FAIL,
      
      where all four options are skippable and the second, third and fourth are
      all conditional, as is the backstop at the end.
      
      This hasn't been a problem so far because in the ASN.1 specs we have are
      either using primitives or are using SET OF and SEQUENCE OF which are
      handled correctly.
      
      Whilst we're at it, also make sure that element labels get included in
      comments in the output for elements that have complex types.
      
      This cannot be tested with the code as it stands, but rather affects future
      code.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Reviewed-By: NDavid Woodhouse <David.Woodhouse@intel.com>
      8d9b21dc
  3. 28 7月, 2015 1 次提交
  4. 20 7月, 2015 6 次提交
  5. 19 7月, 2015 10 次提交
    • M
      MIPS: fpu.h: Allow 64-bit FPU on a 64-bit MIPS R6 CPU · fcc53b5f
      Markos Chandras 提交于
      Commit 6134d949 ("MIPS: asm: fpu: Allow 64-bit FPU on MIPS32 R6")
      added support for 64-bit FPU on a 32-bit MIPS R6 processor but it missed
      the 64-bit CPU case leading to FPU failures when requesting FR=1 mode
      (which is always the case for MIPS R6 userland) when running a 32-bit
      kernel on a 64-bit CPU. We also fix the MIPS R2 case.
      Signed-off-by: NMarkos Chandras <markos.chandras@imgtec.com>
      Fixes: 6134d949 ("MIPS: asm: fpu: Allow 64-bit FPU on MIPS32 R6")
      Reviewed-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: <stable@vger.kernel.org> # 4.0+
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/10734/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      fcc53b5f
    • C
      parisc: mm: Fix a memory leak related to pmd not attached to the pgd · 4c4ac9a4
      Christophe Jaillet 提交于
      Commit 0e0da48d ("parisc: mm: don't count preallocated pmds")
      introduced a memory leak.
      
      After this commit, the 'return' statement in pmd_free is executed in all
      cases. Even for pmd that are not attached to the pgd.  So 'free_pages'
      can never be called anymore, leading to a memory leak.
      Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Acked-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: NMikulas Patocka <mpatocka@redhat.com>
      Acked-by: NHelge Deller <deller@gmx.de>
      Cc: stable@vger.kernel.org  # v4.0+
      Signed-off-by: NHelge Deller <deller@gmx.de>
      4c4ac9a4
    • O
      Merge tag 'pxa-fixes-v4.2-rc2' of https://github.com/rjarzmik/linux into fixesD · 3eae03da
      Olof Johansson 提交于
      Merge "pxa fixes for v4.2" from Robert Jarzmik:
      
      ARM: pxa: fixes for v4.2-rc2
      
      This single fix reenables ethernet cards for several pxa boards,
      broken by regulator addition to dm9000 driver.
      
      * tag 'pxa-fixes-v4.2-rc2' of https://github.com/rjarzmik/linux:
        ARM: pxa: fix dm9000 platform data regression
      3eae03da
    • L
      Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm · 9d37e667
      Linus Torvalds 提交于
      Pull ARM fixes from Russell King:
       "A small set of ARM fixes for -rc3, most of them not far off
        one-liners, with the exception of fixing the V7 cache invalidation for
        incoming SMP processors which was causing problems for SoCFPGA
        devices"
      
      * 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm:
        ARM: fix __virt_to_idmap build error on !MMU
        ARM: invalidate L1 before enabling coherency
        ARM: 8404/1: dma-mapping: fix off-by-one error in bitmap size check
        ARM: 8402/1: perf: Don't use of_node after putting it
        ARM: 8400/1: use virt_to_idmap to get phys_reset address
      9d37e667
    • L
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 0e1dbccd
      Linus Torvalds 提交于
      Pull x86 fixes from Ingo Molnar:
       "Two families of fixes:
      
         - Fix an FPU context related boot crash on newer x86 hardware with
           larger context sizes than what most people test.  To fix this
           without ugly kludges or extensive reverts we had to touch core task
           allocator, to allow x86 to determine the task size dynamically, at
           boot time.
      
           I've tested it on a number of x86 platforms, and I cross-built it
           to a handful of architectures:
      
                                              (warns)               (warns)
             testing     x86-64:  -git:  pass (    0),  -tip:  pass (    0)
             testing     x86-32:  -git:  pass (    0),  -tip:  pass (    0)
             testing        arm:  -git:  pass ( 1359),  -tip:  pass ( 1359)
             testing       cris:  -git:  pass ( 1031),  -tip:  pass ( 1031)
             testing       m32r:  -git:  pass ( 1135),  -tip:  pass ( 1135)
             testing       m68k:  -git:  pass ( 1471),  -tip:  pass ( 1471)
             testing       mips:  -git:  pass ( 1162),  -tip:  pass ( 1162)
             testing    mn10300:  -git:  pass ( 1058),  -tip:  pass ( 1058)
             testing     parisc:  -git:  pass ( 1846),  -tip:  pass ( 1846)
             testing      sparc:  -git:  pass ( 1185),  -tip:  pass ( 1185)
      
           ... so I hope the cross-arch impact 'none', as intended.
      
           (by Dave Hansen)
      
         - Fix various NMI handling related bugs unearthed by the big asm code
           rewrite and generally make the NMI code more robust and more
           maintainable while at it.  These changes are a bit late in the
           cycle, I hope they are still acceptable.
      
           (by Andy Lutomirski)"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/fpu, sched: Introduce CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT and use it on x86
        x86/fpu, sched: Dynamically allocate 'struct fpu'
        x86/entry/64, x86/nmi/64: Add CONFIG_DEBUG_ENTRY NMI testing code
        x86/nmi/64: Make the "NMI executing" variable more consistent
        x86/nmi/64: Minor asm simplification
        x86/nmi/64: Use DF to avoid userspace RSP confusing nested NMI detection
        x86/nmi/64: Reorder nested NMI checks
        x86/nmi/64: Improve nested NMI comments
        x86/nmi/64: Switch stacks on userspace NMI entry
        x86/nmi/64: Remove asm code that saves CR2
        x86/nmi: Enable nested do_nmi() handling for 64-bit kernels
      0e1dbccd
    • L
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · dae57fb6
      Linus Torvalds 提交于
      Pull timer fix from Ingo Molnar:
       "Fix for a misplaced export that can cause build failures in certain
        (rare) Kconfig situations"
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        tick: Move the export of tick_broadcast_oneshot_control to the proper place
      dae57fb6
    • L
      Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · d65b78f5
      Linus Torvalds 提交于
      Pull scheduler fix from Ingo Molnar:
       "A oneliner rq throttling fix"
      
      * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/fair: Test list head instead of list entry in throttle_cfs_rq()
      d65b78f5
    • L
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f79a17bf
      Linus Torvalds 提交于
      Pull perf fixes from Ingo Molnar:
       "Mostly tooling fixes, plus a static key fix fixing /sys/devices/cpu/rdpmc"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf tools: Really allow to specify custom CC, AR or LD
        perf auxtrace: Fix misplaced check for HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT
        perf hists browser: Take the --comm, --dsos, etc filters into account
        perf symbols: Store if there is a filter in place
        x86, perf: Fix static_key bug in load_mm_cr4()
        tools: Copy lib/hweight.c from the kernel sources
        perf tools: Fix the detached tarball wrt rbtree copy
        perf thread_map: Fix the sizeof() calculation for map entries
        tools lib: Improve clean target
        perf stat: Fix shadow declaration of close
        perf tools: Fix lockup using 32-bit compat vdso
      f79a17bf
    • L
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 59ee7621
      Linus Torvalds 提交于
      Pull irq fixes from Ingo Molnar:
       "Misc irq fixes:
      
         - two driver fixes
         - a Xen regression fix
         - a nested irq thread crash fix"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/gicv3-its: Fix mapping of LPIs to collections
        genirq: Prevent resend to interrupts marked IRQ_NESTED_THREAD
        genirq: Revert sparse irq locking around __cpu_up() and move it to x86 for now
        gpio/davinci: Fix race in installing chained irq handler
      59ee7621
    • L
      Merge branch 'akpm' (patches from Andrew) · 3a26a5b1
      Linus Torvalds 提交于
      Merge fixes from Andrew Morton:
       "25 fixes"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (25 commits)
        lib/decompress: set the compressor name to NULL on error
        mm/cma_debug: correct size input to bitmap function
        mm/cma_debug: fix debugging alloc/free interface
        mm/page_owner: set correct gfp_mask on page_owner
        mm/page_owner: fix possible access violation
        fsnotify: fix oops in fsnotify_clear_marks_by_group_flags()
        /proc/$PID/cmdline: fixup empty ARGV case
        dma-debug: skip debug_dma_assert_idle() when disabled
        hexdump: fix for non-aligned buffers
        checkpatch: fix long line messages about patch context
        mm: clean up per architecture MM hook header files
        MAINTAINERS: uclinux-h8-devel is moderated for non-subscribers
        mailmap: update Sudeep Holla's email id
        Update Viresh Kumar's email address
        mm, meminit: suppress unused memory variable warning
        configfs: fix kernel infoleak through user-controlled format string
        include, lib: add __printf attributes to several function prototypes
        s390/hugetlb: add hugepages_supported define
        mm: hugetlb: allow hugepages_supported to be architecture specific
        revert "s390/mm: make hugepages_supported a boot time decision"
        ...
      3a26a5b1
  6. 18 7月, 2015 9 次提交