From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Sun, 14 Oct 2012 20:39:34 +0000 (-0700)
Subject: Merge branch 'modules-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty... 
X-Git-Tag: v3.7-rc1~2
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d25282d1c9b9bc4cda7f9d3c0205108e99aa7a9d;p=users%2Fjedix%2Flinux-maple.git

Merge branch 'modules-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux

Pull module signing support from Rusty Russell:
 "module signing is the highlight, but it's an all-over David Howells frenzy..."

Hmm "Magrathea: Glacier signing key". Somebody has been reading too much HHGTTG.

* 'modules-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (37 commits)
  X.509: Fix indefinite length element skip error handling
  X.509: Convert some printk calls to pr_devel
  asymmetric keys: fix printk format warning
  MODSIGN: Fix 32-bit overflow in X.509 certificate validity date checking
  MODSIGN: Make mrproper should remove generated files.
  MODSIGN: Use utf8 strings in signer's name in autogenerated X.509 certs
  MODSIGN: Use the same digest for the autogen key sig as for the module sig
  MODSIGN: Sign modules during the build process
  MODSIGN: Provide a script for generating a key ID from an X.509 cert
  MODSIGN: Implement module signature checking
  MODSIGN: Provide module signing public keys to the kernel
  MODSIGN: Automatically generate module signing keys if missing
  MODSIGN: Provide Kconfig options
  MODSIGN: Provide gitignore and make clean rules for extra files
  MODSIGN: Add FIPS policy
  module: signature checking hook
  X.509: Add a crypto key parser for binary (DER) X.509 certificates
  MPILIB: Provide a function to read raw data into an MPI
  X.509: Add an ASN.1 decoder
  X.509: Add simple ASN.1 grammar compiler
  ...
---

d25282d1c9b9bc4cda7f9d3c0205108e99aa7a9d
diff --cc Makefile
index 5d8e7f258388,e70ebfee9c80..2d3daf7c1211
--- a/Makefile
+++ b/Makefile
@@@ -996,8 -993,12 +996,11 @@@ CLEAN_DIRS  += $(MODVERDIR
  # Directories & files removed with 'make mrproper'
  MRPROPER_DIRS  += include/config usr/include include/generated          \
                    arch/*/include/generated
 -MRPROPER_FILES += .config .config.old .version .old_version             \
 -                  include/linux/version.h                               \
 +MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \
- 		  Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
+ 		  Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
+ 		  signing_key.priv signing_key.x509 x509.genkey		\
+ 		  extra_certificates signing_key.x509.keyid		\
+ 		  signing_key.x509.signer
  
  # clean - Delete most, but leave enough to build external modules
  #
diff --cc arch/Kconfig
index a79a1ad8bb96,3450115c6437..366ec06a5185
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@@ -300,26 -281,23 +300,45 @@@ config SECCOMP_FILTE
  
  	  See Documentation/prctl/seccomp_filter.txt for details.
  
 +config HAVE_RCU_USER_QS
 +	bool
 +	help
 +	  Provide kernel entry/exit hooks necessary for userspace
 +	  RCU extended quiescent state. Syscalls need to be wrapped inside
 +	  rcu_user_exit()-rcu_user_enter() through the slow path using
 +	  TIF_NOHZ flag. Exceptions handlers must be wrapped as well. Irqs
 +	  are already protected inside rcu_irq_enter/rcu_irq_exit() but
 +	  preemption or signal handling on irq exit still need to be protected.
 +
 +config HAVE_VIRT_CPU_ACCOUNTING
 +	bool
 +
 +config HAVE_IRQ_TIME_ACCOUNTING
 +	bool
 +	help
 +	  Archs need to ensure they use a high enough resolution clock to
 +	  support irq time accounting and then call enable_sched_clock_irqtime().
 +
 +config HAVE_ARCH_TRANSPARENT_HUGEPAGE
 +	bool
 +
+ config HAVE_MOD_ARCH_SPECIFIC
+ 	bool
+ 	help
+ 	  The arch uses struct mod_arch_specific to store data.  Many arches
+ 	  just need a simple module loader without arch specific data - those
+ 	  should not enable this.
+ 
+ config MODULES_USE_ELF_RELA
+ 	bool
+ 	help
+ 	  Modules only use ELF RELA relocations.  Modules with ELF REL
+ 	  relocations will give an error.
+ 
+ config MODULES_USE_ELF_REL
+ 	bool
+ 	help
+ 	  Modules only use ELF REL relocations.  Modules with ELF RELA
+ 	  relocations will give an error.
+ 
  source "kernel/gcov/Kconfig"
diff --cc arch/alpha/Kconfig
index 7a08cfb80ee8,7e3710c0cce5..5dd7f5db24d4
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@@ -20,8 -20,8 +20,10 @@@ config ALPH
  	select GENERIC_CMOS_UPDATE
  	select GENERIC_STRNCPY_FROM_USER
  	select GENERIC_STRNLEN_USER
 +	select GENERIC_KERNEL_THREAD
 +	select GENERIC_KERNEL_EXECVE
+ 	select HAVE_MOD_ARCH_SPECIFIC
+ 	select MODULES_USE_ELF_RELA
  	help
  	  The Alpha is a 64-bit general-purpose processor designed and
  	  marketed by the Digital Equipment Corporation of blessed memory,
diff --cc arch/arm/Kconfig
index 261fdd085bb9,7a08b3a71c01..73067efd4845
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@@ -22,37 -16,41 +22,39 @@@ config AR
  	select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
  	select HAVE_ARCH_KGDB
  	select HAVE_ARCH_TRACEHOOK
 -	select HAVE_KPROBES if !XIP_KERNEL
 -	select HAVE_KRETPROBES if (HAVE_KPROBES)
 -	select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
 -	select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL)
 +	select HAVE_BPF_JIT
 +	select HAVE_C_RECORDMCOUNT
 +	select HAVE_DEBUG_KMEMLEAK
 +	select HAVE_DMA_API_DEBUG
 +	select HAVE_DMA_ATTRS
 +	select HAVE_DMA_CONTIGUOUS if MMU
  	select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL)
 +	select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL)
  	select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL)
 -	select ARCH_BINFMT_ELF_RANDOMIZE_PIE
 +	select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
  	select HAVE_GENERIC_DMA_COHERENT
 +	select HAVE_GENERIC_HARDIRQS
 +	select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7))
 +	select HAVE_IDE if PCI || ISA || PCMCIA
 +	select HAVE_IRQ_WORK
  	select HAVE_KERNEL_GZIP
 -	select HAVE_KERNEL_LZO
  	select HAVE_KERNEL_LZMA
 +	select HAVE_KERNEL_LZO
  	select HAVE_KERNEL_XZ
 -	select HAVE_IRQ_WORK
 +	select HAVE_KPROBES if !XIP_KERNEL
 +	select HAVE_KRETPROBES if (HAVE_KPROBES)
 +	select HAVE_MEMBLOCK
 +	select HAVE_OPROFILE if (HAVE_PERF_EVENTS)
  	select HAVE_PERF_EVENTS
 -	select PERF_USE_VMALLOC
  	select HAVE_REGS_AND_STACK_ACCESS_API
 -	select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7))
 -	select HAVE_C_RECORDMCOUNT
 -	select HAVE_GENERIC_HARDIRQS
 -	select HARDIRQS_SW_RESEND
 -	select GENERIC_IRQ_PROBE
 -	select GENERIC_IRQ_SHOW
 -	select ARCH_WANT_IPC_PARSE_VERSION
 -	select HARDIRQS_SW_RESEND
 -	select CPU_PM if (SUSPEND || CPU_IDLE)
 -	select GENERIC_PCI_IOMAP
 -	select HAVE_BPF_JIT
 -	select GENERIC_SMP_IDLE_THREAD
 +	select HAVE_SYSCALL_TRACEPOINTS
 +	select HAVE_UID16
  	select KTIME_SCALAR
 -	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
 -	select GENERIC_STRNCPY_FROM_USER
 -	select GENERIC_STRNLEN_USER
 -	select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN
 +	select PERF_USE_VMALLOC
 +	select RTC_LIB
 +	select SYS_SUPPORTS_APM_EMULATION
+ 	select HAVE_MOD_ARCH_SPECIFIC if ARM_UNWIND
+ 	select MODULES_USE_ELF_REL
  	help
  	  The ARM series is a line of low-power-consumption RISC chip designs
  	  licensed by ARM Ltd and targeted at embedded applications and
diff --cc arch/c6x/Kconfig
index 45268b50c0c8,f6a3648f5ec3..aee1b569ee6e
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@@ -17,7 -17,7 +17,8 @@@ config C6
  	select OF
  	select OF_EARLY_FLATTREE
  	select GENERIC_CLOCKEVENTS
 +	select GENERIC_KERNEL_THREAD
+ 	select MODULES_USE_ELF_RELA
  
  config MMU
  	def_bool n
diff --cc arch/cris/include/asm/Kbuild
index ff1bf7fcae8e,28b690de7971..6d43a951b5ec
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@@ -8,5 -8,4 +8,6 @@@ header-y += etraxgpio.
  header-y += rs485.h
  header-y += sync_serial.h
  
 +generic-y += clkdev.h
 +generic-y += exec.h
+ generic-y += module.h
diff --cc arch/h8300/include/asm/Kbuild
index fccd81eddff1,871382d239fe..50bbf387b2f8
--- a/arch/h8300/include/asm/Kbuild
+++ b/arch/h8300/include/asm/Kbuild
@@@ -1,4 -1,3 +1,5 @@@
  include include/asm-generic/Kbuild.asm
  
 -generic-y	+= module.h
 +generic-y += clkdev.h
 +generic-y += exec.h
++generic-y += module.h
diff --cc arch/ia64/Kconfig
index 4c10e607c908,688146466d0d..3279646120e3
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@@ -39,7 -38,9 +39,9 @@@ config IA6
  	select ARCH_TASK_STRUCT_ALLOCATOR
  	select ARCH_THREAD_INFO_ALLOCATOR
  	select ARCH_CLOCKSOURCE_DATA
 -	select GENERIC_TIME_VSYSCALL
 +	select GENERIC_TIME_VSYSCALL_OLD
+ 	select HAVE_MOD_ARCH_SPECIFIC
+ 	select MODULES_USE_ELF_RELA
  	default y
  	help
  	  The Itanium Processor Family is Intel's 64-bit successor to
diff --cc arch/m32r/include/asm/Kbuild
index fccd81eddff1,871382d239fe..50bbf387b2f8
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@@ -1,4 -1,3 +1,5 @@@
  include include/asm-generic/Kbuild.asm
  
 -generic-y	+= module.h
 +generic-y += clkdev.h
 +generic-y += exec.h
++generic-y += module.h
diff --cc arch/m68k/Kconfig
index 76fd6e2f71da,0df07cee3faf..e7c161433eae
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@@ -15,7 -13,9 +15,10 @@@ config M68
  	select FPU if MMU
  	select ARCH_WANT_IPC_PARSE_VERSION
  	select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE
 +	select GENERIC_KERNEL_THREAD
+ 	select HAVE_MOD_ARCH_SPECIFIC
+ 	select MODULES_USE_ELF_REL
+ 	select MODULES_USE_ELF_RELA
  
  config RWSEM_GENERIC_SPINLOCK
  	bool
diff --cc arch/mn10300/Kconfig
index ddbdc33471a8,aa03f2e13385..04669fac117b
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@@ -8,7 -8,7 +8,8 @@@ config MN1030
  	select HAVE_ARCH_KGDB
  	select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER
  	select GENERIC_CLOCKEVENTS
 +	select GENERIC_KERNEL_THREAD
+ 	select MODULES_USE_ELF_RELA
  
  config AM33_2
  	def_bool n
diff --cc arch/powerpc/Kconfig
index 969f3d9ded91,74f84781b484..a902a5c1c76a
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@@ -141,7 -139,8 +141,9 @@@ config PP
  	select GENERIC_CLOCKEVENTS
  	select GENERIC_STRNCPY_FROM_USER
  	select GENERIC_STRNLEN_USER
 +	select GENERIC_KERNEL_THREAD
+ 	select HAVE_MOD_ARCH_SPECIFIC
+ 	select MODULES_USE_ELF_RELA
  
  config EARLY_PRINTK
  	bool
diff --cc arch/s390/Kconfig
index e5dac1236185,c76a052f60e2..3f3d9ca7a5b6
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@@ -135,7 -125,8 +135,9 @@@ config S39
  	select GENERIC_CLOCKEVENTS
  	select KTIME_SCALAR if 32BIT
  	select HAVE_ARCH_SECCOMP_FILTER
 +	select GENERIC_KERNEL_THREAD
+ 	select HAVE_MOD_ARCH_SPECIFIC
+ 	select MODULES_USE_ELF_RELA
  
  config SCHED_OMIT_FRAME_POINTER
  	def_bool y
diff --cc arch/x86/Kconfig
index 70071b19eb98,01726cbcc73b..46c3bff3ced2
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@@ -106,14 -97,11 +106,16 @@@ config X8
  	select KTIME_SCALAR if X86_32
  	select GENERIC_STRNCPY_FROM_USER
  	select GENERIC_STRNLEN_USER
 +	select HAVE_RCU_USER_QS if X86_64
 +	select HAVE_IRQ_TIME_ACCOUNTING
 +	select GENERIC_KERNEL_THREAD
 +	select GENERIC_KERNEL_EXECVE
+ 	select MODULES_USE_ELF_REL if X86_32
+ 	select MODULES_USE_ELF_RELA if X86_64
  
  config INSTRUCTION_DECODER
 -	def_bool (KPROBES || PERF_EVENTS || UPROBES)
 +	def_bool y
 +	depends on KPROBES || PERF_EVENTS || UPROBES
  
  config OUTPUT_FORMAT
  	string
diff --cc arch/x86/um/Kconfig
index 9fa950df80e5,a4b0c10c9d5d..07611759ce35
--- a/arch/x86/um/Kconfig
+++ b/arch/x86/um/Kconfig
@@@ -23,7 -21,7 +23,8 @@@ config 64BI
  config X86_32
  	def_bool !64BIT
  	select HAVE_AOUT
 +	select ARCH_WANT_IPC_PARSE_VERSION
+ 	select MODULES_USE_ELF_REL
  
  config X86_64
  	def_bool 64BIT
diff --cc init/Kconfig
index 89e4cf672dfe,abc6e63f2fb8..6fdd6e339326
--- a/init/Kconfig
+++ b/init/Kconfig
@@@ -1601,10 -1672,12 +1661,18 @@@ config PADAT
  	depends on SMP
  	bool
  
 +# Can be selected by architectures with broken toolchains
 +# that get confused by correct const<->read_only section
 +# mappings
 +config BROKEN_RODATA
 +	bool
 +
+ config ASN1
+ 	tristate
+ 	help
+ 	  Build a simple ASN.1 grammar compiler that produces a bytecode output
+ 	  that can be interpreted by the ASN.1 stream decoder and used to
+ 	  inform it as to what tags are to be expected in a stream and what
+ 	  functions to call on what tags.
+ 
  source "kernel/Kconfig.locks"
diff --cc lib/Makefile
index 3128e357e286,ca856b69a21d..821a16229111
--- a/lib/Makefile
+++ b/lib/Makefile
@@@ -140,11 -140,8 +140,13 @@@ $(foreach file, $(libfdt_files), 
  	$(eval CFLAGS_$(file) = -I$(src)/../scripts/dtc/libfdt))
  lib-$(CONFIG_LIBFDT) += $(libfdt_files)
  
 +obj-$(CONFIG_RBTREE_TEST) += rbtree_test.o
 +obj-$(CONFIG_INTERVAL_TREE_TEST) += interval_tree_test.o
 +
 +interval_tree_test-objs := interval_tree_test_main.o interval_tree.o
 +
+ obj-$(CONFIG_ASN1) += asn1_decoder.o
+ 
  hostprogs-y	:= gen_crc32table
  clean-files	:= crc32table.h
  
diff --cc security/keys/trusted.c
index 3f163d0489ad,42036c7a0856..e13fcf7636f7
--- a/security/keys/trusted.c
+++ b/security/keys/trusted.c
@@@ -903,9 -936,8 +904,9 @@@ static int trusted_instantiate(struct k
  	char *datablob;
  	int ret = 0;
  	int key_cmd;
 +	size_t key_len;
  
- 	if (datalen <= 0 || datalen > 32767 || !data)
+ 	if (datalen <= 0 || datalen > 32767 || !prep->data)
  		return -EINVAL;
  
  	datablob = kmalloc(datalen + 1, GFP_KERNEL);