1. 21 11月, 2012 1 次提交
  2. 09 11月, 2012 1 次提交
  3. 06 11月, 2012 1 次提交
  4. 20 10月, 2012 3 次提交
    • D
      MODSIGN: Move the magic string to the end of a module and eliminate the search · caabe240
      David Howells 提交于
      Emit the magic string that indicates a module has a signature after the
      signature data instead of before it.  This allows module_sig_check() to
      be made simpler and faster by the elimination of the search for the
      magic string.  Instead we just need to do a single memcmp().
      
      This works because at the end of the signature data there is the
      fixed-length signature information block.  This block then falls
      immediately prior to the magic number.
      
      From the contents of the information block, it is trivial to calculate
      the size of the signature data and thus the size of the actual module
      data.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      caabe240
    • D
      MODSIGN: perlify sign-file and merge in x509keyid · b37d1bfb
      David Howells 提交于
      Turn sign-file into perl and merge in x509keyid.  The latter doesn't
      need to be a separate script as it doesn't actually need to work out the
      SHA1 sum of the X.509 certificate itself, since it can get that from the
      X.509 certificate.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b37d1bfb
    • L
      kbuild: Fix module signature generation · b05e585d
      Linus Torvalds 提交于
      Rusty had clearly not actually tested his module signing changes that I
      (trustingly) applied as commit e2a666d5 ("kbuild: sign the modules
      at install time"). That commit had multiple bugs:
      
       - using "${#VARIABLE}" to get the number of characters in a shell
         variable may look clever, but it's locale-dependent: it returns the
         number of *characters*, not bytes. And we do need bytes.
      
         So don't use "${#..}" expansion, do the stupid "wc -c" thing instead
         (where "c" stands for "bytes", not "characters", despite the letter.
      
       - Rusty had confused "siglen" and "signerlen", and his conversion
         didn't set "signerlen" at all, and incorrectly set "siglen" to the
         size of the signer, not the size of the signature.
      
      End result: the modified sign-file script did create something that
      superficially *looked* like a signature, but didn't actually work at
      all, and would fail the signature check. Oops.
      
      Tssk, tssk, Rusty.
      
      But Rusty was definitely right that this whole thing should be rewritten
      in perl by somebody who has the perl-fu to do so.  That is not me,
      though - I'm just doing an emergency fix for the shell script.
      
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b05e585d
  5. 19 10月, 2012 1 次提交
  6. 18 10月, 2012 1 次提交
  7. 17 10月, 2012 1 次提交
  8. 16 10月, 2012 1 次提交
  9. 12 10月, 2012 1 次提交
  10. 11 10月, 2012 2 次提交
  11. 10 10月, 2012 2 次提交
    • D
      MODSIGN: Sign modules during the build process · 80d65e58
      David Howells 提交于
      If CONFIG_MODULE_SIG is set, then this patch will cause all modules files to
      to have signatures added.  The following steps will occur:
      
       (1) The module will be linked to foo.ko.unsigned instead of foo.ko
      
       (2) The module will be stripped using both "strip -x -g" and "eu-strip" to
           ensure minimal size for inclusion in an initramfs.
      
       (3) The signature will be generated on the stripped module.
      
       (4) The signature will be appended to the module, along with some information
           about the signature and a magic string that indicates the presence of the
           signature.
      
      Step (3) requires private and public keys to be available.  By default these
      are expected to be found in files:
      
      	signing_key.priv
      	signing_key.x509
      
      in the base directory of the build.  The first is the private key in PEM form
      and the second is the X.509 certificate in DER form as can be generated from
      openssl:
      
      	openssl req \
      		-new -x509 -outform PEM -out signing_key.x509 \
      		-keyout signing_key.priv -nodes \
      		-subj "/CN=H2G2/O=Magrathea/CN=Slartibartfast"
      
      If the secret key is not found then signing will be skipped and the unsigned
      module from (1) will just be copied to foo.ko.
      
      If signing occurs, lines like the following will be seen:
      
      	LD [M]  fs/foo/foo.ko.unsigned
      	STRIP [M] fs/foo/foo.ko.stripped
      	SIGN [M] fs/foo/foo.ko
      
      will appear in the build log.  If the signature step will be skipped and the
      following will be seen:
      
      	LD [M]  fs/foo/foo.ko.unsigned
      	STRIP [M] fs/foo/foo.ko.stripped
      	NO SIGN [M] fs/foo/foo.ko
      
      NOTE!  After the signature step, the signed module _must_not_ be passed through
      strip.  The unstripped, unsigned module is still available at the name on the
      LD [M] line.  This restriction may affect packaging tools (such as rpmbuild)
      and initramfs composition tools.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      80d65e58
    • D
      MODSIGN: Provide a script for generating a key ID from an X.509 cert · 85ecac79
      David Howells 提交于
      Provide a script to parse an X.509 certificate and certain pieces of
      information from it in order to generate a key identifier to be included within
      a module signature.
      
      The script takes the Subject Name and extracts (if present) the
      organizationName (O), the commonName (CN) and the emailAddress and fabricates
      the signer's name from them:
      
       (1) If both O and CN exist, then the name will be "O: CN", unless:
      
           (a) CN is prefixed by O, in which case only CN is used.
      
           (b) CN and O share at least the first 7 characters, in which case only CN
           	 is used.
      
       (2) Otherwise, CN is used if present.
      
       (3) Otherwise, O is used if present.
      
       (4) Otherwise the emailAddress is used, if present.
      
       (5) Otherwise a blank name is used.
      
      The script emits a binary encoded identifier in the following form:
      
       - 2 BE bytes indicating the length of the signer's name.
      
       - 2 BE bytes indicating the length of the subject key identifier.
      
       - The characters of the signer's name.
      
       - The bytes of the subject key identifier.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      85ecac79
  12. 08 10月, 2012 1 次提交
    • D
      X.509: Add simple ASN.1 grammar compiler · 4520c6a4
      David Howells 提交于
      Add a simple ASN.1 grammar compiler.  This produces a bytecode output that can
      be fed to a decoder to inform the decoder how to interpret the ASN.1 stream it
      is trying to parse.
      
      Action functions can be specified in the grammar by interpolating:
      
      	({ foo })
      
      after a type, for example:
      
      	SubjectPublicKeyInfo ::= SEQUENCE {
      		algorithm		AlgorithmIdentifier,
      		subjectPublicKey	BIT STRING ({ do_key_data })
      		}
      
      The decoder is expected to call these after matching this type and parsing the
      contents if it is a constructed type.
      
      The grammar compiler does not currently support the SET type (though it does
      support SET OF) as I can't see a good way of tracking which members have been
      encountered yet without using up extra stack space.
      
      Currently, the grammar compiler will fail if more than 256 bytes of bytecode
      would be produced or more than 256 actions have been specified as it uses
      8-bit jump values and action indices to keep space usage down.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      4520c6a4
  13. 06 10月, 2012 8 次提交
  14. 04 10月, 2012 1 次提交
  15. 03 10月, 2012 3 次提交
    • J
      kbuild: Fix gcc -x syntax · b1e0d8b7
      Jean Delvare 提交于
      The correct syntax for gcc -x is "gcc -x assembler", not
      "gcc -xassembler". Even though the latter happens to work, the former
      is what is documented in the manual page and thus what gcc wrappers
      such as icecream do expect.
      
      This isn't a cosmetic change. The missing space prevents icecream from
      recognizing compilation tasks it can't handle, leading to silent kernel
      miscompilations.
      
      Besides me, credits go to Michael Matz and Dirk Mueller for
      investigating the miscompilation issue and tracking it down to this
      incorrect -x parameter syntax.
      Signed-off-by: NJean Delvare <jdelvare@suse.de>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Cc: stable@vger.kernel.org
      Cc: Bernhard Walle <bernhard@bwalle.de>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      b1e0d8b7
    • D
      UAPI: Plumb the UAPI Kbuilds into the user header installation and checking · 10b63956
      David Howells 提交于
      Plumb the UAPI Kbuilds into the user header installation and checking system.
      As the headers are split the entries will be transferred across from the old
      Kbuild files to the UAPI Kbuild files.
      
      The changes made in this commit are:
      
       (1) Exported generated files (of which there are currently four) are moved to
           uapi/ directories under the appropriate generated/ directory, thus we
           get:
      
      	include/generated/uapi/linux/version.h
      	arch/x86/include/generated/uapi/asm/unistd_32.h
      	arch/x86/include/generated/uapi/asm/unistd_64.h
      	arch/x86/include/generated/uapi/asm/unistd_x32.h
      
           These paths were added to the build as -I flags in a previous patch.
      
       (2) scripts/Makefile.headersinst is now given the UAPI path to install from
           rather than the old path.
      
           It then determines the old path from that and includes that Kbuild also
           if it exists, thus permitting the headers to exist in either directory
           during the changeover.
      
           I also renamed the "install" variable to "installdir" as it refers to a
           directory not the install program.
      
       (3) scripts/headers_install.pl is altered to take a list of source file paths
           instead of just their names so that the makefile can tell it exactly
           where to find each file.
      
           For the moment, files can be obtained from one of four places for each
           output directory:
      
      	.../include/uapi/foo/
      	.../include/generated/uapi/foo/
      	.../include/foo/
      	.../include/generated/foo/
      
           The non-UAPI paths will be dropped later.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Acked-by: NDave Jones <davej@redhat.com>
      10b63956
    • D
      UAPI: Remove the objhdr-y export list · 40f1d4c2
      David Howells 提交于
      Remove the objhdr-y export list as it is no longer used.  genhdr-y should be
      used instead.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Acked-by: NDave Jones <davej@redhat.com>
      40f1d4c2
  16. 02 10月, 2012 2 次提交
  17. 28 9月, 2012 7 次提交
  18. 27 9月, 2012 2 次提交
  19. 26 9月, 2012 1 次提交