diff options
42 files changed, 258 insertions, 202 deletions
@@ -196,6 +196,9 @@ CROSS_COMPILE ?= | |||
196 | UTS_MACHINE := $(ARCH) | 196 | UTS_MACHINE := $(ARCH) |
197 | SRCARCH := $(ARCH) | 197 | SRCARCH := $(ARCH) |
198 | 198 | ||
199 | # for i386 and x86_64 we use SRCARCH equal to x86 | ||
200 | SRCARCH := $(if $(filter x86_64 i386,$(SRCARCH)),x86,$(SRCARCH)) | ||
201 | |||
199 | KCONFIG_CONFIG ?= .config | 202 | KCONFIG_CONFIG ?= .config |
200 | 203 | ||
201 | # SHELL used by kbuild | 204 | # SHELL used by kbuild |
@@ -418,7 +421,7 @@ ifeq ($(config-targets),1) | |||
418 | # Read arch specific Makefile to set KBUILD_DEFCONFIG as needed. | 421 | # Read arch specific Makefile to set KBUILD_DEFCONFIG as needed. |
419 | # KBUILD_DEFCONFIG may point out an alternative default configuration | 422 | # KBUILD_DEFCONFIG may point out an alternative default configuration |
420 | # used for 'make defconfig' | 423 | # used for 'make defconfig' |
421 | include $(srctree)/arch/$(ARCH)/Makefile | 424 | include $(srctree)/arch/$(SRCARCH)/Makefile |
422 | export KBUILD_DEFCONFIG | 425 | export KBUILD_DEFCONFIG |
423 | 426 | ||
424 | config %config: scripts_basic outputmakefile FORCE | 427 | config %config: scripts_basic outputmakefile FORCE |
@@ -497,7 +500,7 @@ else | |||
497 | KBUILD_CFLAGS += -O2 | 500 | KBUILD_CFLAGS += -O2 |
498 | endif | 501 | endif |
499 | 502 | ||
500 | include $(srctree)/arch/$(ARCH)/Makefile | 503 | include $(srctree)/arch/$(SRCARCH)/Makefile |
501 | 504 | ||
502 | ifdef CONFIG_FRAME_POINTER | 505 | ifdef CONFIG_FRAME_POINTER |
503 | KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls | 506 | KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls |
diff --git a/arch/i386/.gitignore b/arch/i386/.gitignore deleted file mode 100644 index 36ef4c374d25..000000000000 --- a/arch/i386/.gitignore +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | boot | ||
diff --git a/arch/i386/Kconfig.cpu b/arch/x86/Kconfig.cpu index 0e2adadf5905..0e2adadf5905 100644 --- a/arch/i386/Kconfig.cpu +++ b/arch/x86/Kconfig.cpu | |||
diff --git a/arch/i386/Kconfig.debug b/arch/x86/Kconfig.debug index f03531eacdfb..970b2defe7df 100644 --- a/arch/i386/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -1,14 +1,14 @@ | |||
1 | menu "Kernel hacking" | 1 | menu "Kernel hacking" |
2 | 2 | ||
3 | config TRACE_IRQFLAGS_SUPPORT | 3 | config TRACE_IRQFLAGS_SUPPORT |
4 | bool | 4 | def_bool y |
5 | default y | ||
6 | 5 | ||
7 | source "lib/Kconfig.debug" | 6 | source "lib/Kconfig.debug" |
8 | 7 | ||
9 | config EARLY_PRINTK | 8 | config EARLY_PRINTK |
10 | bool "Early printk" if EMBEDDED && DEBUG_KERNEL | 9 | bool "Early printk" if EMBEDDED && DEBUG_KERNEL |
11 | default y | 10 | default y |
11 | depends on X86_32 | ||
12 | help | 12 | help |
13 | Write kernel log output directly into the VGA buffer or to a serial | 13 | Write kernel log output directly into the VGA buffer or to a serial |
14 | port. | 14 | port. |
@@ -37,10 +37,12 @@ config DEBUG_STACK_USAGE | |||
37 | 37 | ||
38 | comment "Page alloc debug is incompatible with Software Suspend on i386" | 38 | comment "Page alloc debug is incompatible with Software Suspend on i386" |
39 | depends on DEBUG_KERNEL && HIBERNATION | 39 | depends on DEBUG_KERNEL && HIBERNATION |
40 | depends on X86_32 | ||
40 | 41 | ||
41 | config DEBUG_PAGEALLOC | 42 | config DEBUG_PAGEALLOC |
42 | bool "Debug page memory allocations" | 43 | bool "Debug page memory allocations" |
43 | depends on DEBUG_KERNEL && !HIBERNATION && !HUGETLBFS | 44 | depends on DEBUG_KERNEL && !HIBERNATION && !HUGETLBFS |
45 | depends on X86_32 | ||
44 | help | 46 | help |
45 | Unmap pages from the kernel linear mapping after free_pages(). | 47 | Unmap pages from the kernel linear mapping after free_pages(). |
46 | This results in a large slowdown, but helps to find certain types | 48 | This results in a large slowdown, but helps to find certain types |
@@ -59,6 +61,7 @@ config DEBUG_RODATA | |||
59 | config 4KSTACKS | 61 | config 4KSTACKS |
60 | bool "Use 4Kb for kernel stacks instead of 8Kb" | 62 | bool "Use 4Kb for kernel stacks instead of 8Kb" |
61 | depends on DEBUG_KERNEL | 63 | depends on DEBUG_KERNEL |
64 | depends on X86_32 | ||
62 | help | 65 | help |
63 | If you say Y here the kernel will use a 4Kb stacksize for the | 66 | If you say Y here the kernel will use a 4Kb stacksize for the |
64 | kernel stack attached to each process/thread. This facilitates | 67 | kernel stack attached to each process/thread. This facilitates |
@@ -67,22 +70,50 @@ config 4KSTACKS | |||
67 | will also use IRQ stacks to compensate for the reduced stackspace. | 70 | will also use IRQ stacks to compensate for the reduced stackspace. |
68 | 71 | ||
69 | config X86_FIND_SMP_CONFIG | 72 | config X86_FIND_SMP_CONFIG |
70 | bool | 73 | def_bool y |
71 | depends on X86_LOCAL_APIC || X86_VOYAGER | 74 | depends on X86_LOCAL_APIC || X86_VOYAGER |
72 | default y | 75 | depends on X86_32 |
73 | 76 | ||
74 | config X86_MPPARSE | 77 | config X86_MPPARSE |
75 | bool | 78 | def_bool y |
76 | depends on X86_LOCAL_APIC && !X86_VISWS | 79 | depends on X86_LOCAL_APIC && !X86_VISWS |
77 | default y | 80 | depends on X86_32 |
78 | 81 | ||
79 | config DOUBLEFAULT | 82 | config DOUBLEFAULT |
80 | default y | 83 | default y |
81 | bool "Enable doublefault exception handler" if EMBEDDED | 84 | bool "Enable doublefault exception handler" if EMBEDDED |
85 | depends on X86_32 | ||
86 | help | ||
87 | This option allows trapping of rare doublefault exceptions that | ||
88 | would otherwise cause a system to silently reboot. Disabling this | ||
89 | option saves about 4k and might cause you much additional grey | ||
90 | hair. | ||
91 | |||
92 | config IOMMU_DEBUG | ||
93 | bool "Enable IOMMU debugging" | ||
94 | depends on IOMMU && DEBUG_KERNEL | ||
95 | depends on X86_64 | ||
82 | help | 96 | help |
83 | This option allows trapping of rare doublefault exceptions that | 97 | Force the IOMMU to on even when you have less than 4GB of |
84 | would otherwise cause a system to silently reboot. Disabling this | 98 | memory and add debugging code. On overflow always panic. And |
85 | option saves about 4k and might cause you much additional grey | 99 | allow to enable IOMMU leak tracing. Can be disabled at boot |
86 | hair. | 100 | time with iommu=noforce. This will also enable scatter gather |
101 | list merging. Currently not recommended for production | ||
102 | code. When you use it make sure you have a big enough | ||
103 | IOMMU/AGP aperture. Most of the options enabled by this can | ||
104 | be set more finegrained using the iommu= command line | ||
105 | options. See Documentation/x86_64/boot-options.txt for more | ||
106 | details. | ||
107 | |||
108 | config IOMMU_LEAK | ||
109 | bool "IOMMU leak tracing" | ||
110 | depends on DEBUG_KERNEL | ||
111 | depends on IOMMU_DEBUG | ||
112 | help | ||
113 | Add a simple leak tracer to the IOMMU code. This is useful when you | ||
114 | are debugging a buggy device driver that leaks IOMMU mappings. | ||
115 | |||
116 | #config X86_REMOTE_DEBUG | ||
117 | # bool "kgdb debugging stub" | ||
87 | 118 | ||
88 | endmenu | 119 | endmenu |
diff --git a/arch/i386/Kconfig b/arch/x86/Kconfig.i386 index b4437ce0f973..7331efe891a7 100644 --- a/arch/i386/Kconfig +++ b/arch/x86/Kconfig.i386 | |||
@@ -287,7 +287,7 @@ config ES7000_CLUSTERED_APIC | |||
287 | default y | 287 | default y |
288 | depends on SMP && X86_ES7000 && MPENTIUMIII | 288 | depends on SMP && X86_ES7000 && MPENTIUMIII |
289 | 289 | ||
290 | source "arch/i386/Kconfig.cpu" | 290 | source "arch/x86/Kconfig.cpu" |
291 | 291 | ||
292 | config HPET_TIMER | 292 | config HPET_TIMER |
293 | bool "HPET Timer Support" | 293 | bool "HPET Timer Support" |
@@ -1272,7 +1272,7 @@ source "fs/Kconfig" | |||
1272 | 1272 | ||
1273 | source "kernel/Kconfig.instrumentation" | 1273 | source "kernel/Kconfig.instrumentation" |
1274 | 1274 | ||
1275 | source "arch/i386/Kconfig.debug" | 1275 | source "arch/x86/Kconfig.debug" |
1276 | 1276 | ||
1277 | source "security/Kconfig" | 1277 | source "security/Kconfig" |
1278 | 1278 | ||
diff --git a/arch/x86_64/Kconfig b/arch/x86/Kconfig.x86_64 index 308970aa5382..e2542e5b536c 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86/Kconfig.x86_64 | |||
@@ -835,7 +835,7 @@ source fs/Kconfig | |||
835 | 835 | ||
836 | source "kernel/Kconfig.instrumentation" | 836 | source "kernel/Kconfig.instrumentation" |
837 | 837 | ||
838 | source "arch/x86_64/Kconfig.debug" | 838 | source "arch/x86/Kconfig.debug" |
839 | 839 | ||
840 | source "security/Kconfig" | 840 | source "security/Kconfig" |
841 | 841 | ||
diff --git a/arch/x86/Makefile b/arch/x86/Makefile new file mode 100644 index 000000000000..309597386a77 --- /dev/null +++ b/arch/x86/Makefile | |||
@@ -0,0 +1,16 @@ | |||
1 | # Unified Makefile for i386 and x86_64 | ||
2 | |||
3 | # select defconfig based on actual architecture | ||
4 | KBUILD_DEFCONFIG := $(ARCH)_defconfig | ||
5 | |||
6 | # # No need to remake these files | ||
7 | $(srctree)/arch/x86/Makefile%: ; | ||
8 | |||
9 | ifeq ($(ARCH),i386) | ||
10 | include $(srctree)/arch/x86/Makefile_32 | ||
11 | else | ||
12 | include $(srctree)/arch/x86/Makefile_64 | ||
13 | endif | ||
14 | |||
15 | |||
16 | |||
diff --git a/arch/i386/Makefile b/arch/x86/Makefile_32 index f5b9a37def8b..346ac0766875 100644 --- a/arch/i386/Makefile +++ b/arch/x86/Makefile_32 | |||
@@ -1,5 +1,5 @@ | |||
1 | # | 1 | # |
2 | # i386/Makefile | 2 | # i386 Makefile |
3 | # | 3 | # |
4 | # This file is included by the global makefile so that you can add your own | 4 | # This file is included by the global makefile so that you can add your own |
5 | # architecture-specific flags and dependencies. Remember to do have actions | 5 | # architecture-specific flags and dependencies. Remember to do have actions |
@@ -17,9 +17,6 @@ | |||
17 | # 20050320 Kianusch Sayah Karadji <kianusch@sk-tech.net> | 17 | # 20050320 Kianusch Sayah Karadji <kianusch@sk-tech.net> |
18 | # Added support for GEODE CPU | 18 | # Added support for GEODE CPU |
19 | 19 | ||
20 | # Fill in SRCARCH | ||
21 | SRCARCH := x86 | ||
22 | |||
23 | # BITS is used as extension for files which are available in a 32 bit | 20 | # BITS is used as extension for files which are available in a 32 bit |
24 | # and a 64 bit version to simplify shared Makefiles. | 21 | # and a 64 bit version to simplify shared Makefiles. |
25 | # e.g.: obj-y += foo_$(BITS).o | 22 | # e.g.: obj-y += foo_$(BITS).o |
@@ -46,7 +43,7 @@ KBUILD_CFLAGS += -pipe -msoft-float -mregparm=3 -freg-struct-return | |||
46 | KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2) | 43 | KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2) |
47 | 44 | ||
48 | # CPU-specific tuning. Anything which can be shared with UML should go here. | 45 | # CPU-specific tuning. Anything which can be shared with UML should go here. |
49 | include $(srctree)/arch/i386/Makefile.cpu | 46 | include $(srctree)/arch/x86/Makefile_32.cpu |
50 | 47 | ||
51 | # temporary until string.h is fixed | 48 | # temporary until string.h is fixed |
52 | cflags-y += -ffreestanding | 49 | cflags-y += -ffreestanding |
diff --git a/arch/i386/Makefile.cpu b/arch/x86/Makefile_32.cpu index e372b584e919..e372b584e919 100644 --- a/arch/i386/Makefile.cpu +++ b/arch/x86/Makefile_32.cpu | |||
diff --git a/arch/x86_64/Makefile b/arch/x86/Makefile_64 index 20eb69bd5a6d..57e714a47af7 100644 --- a/arch/x86_64/Makefile +++ b/arch/x86/Makefile_64 | |||
@@ -1,5 +1,5 @@ | |||
1 | # | 1 | # |
2 | # x86_64/Makefile | 2 | # x86_64 Makefile |
3 | # | 3 | # |
4 | # This file is included by the global makefile so that you can add your own | 4 | # This file is included by the global makefile so that you can add your own |
5 | # architecture-specific flags and dependencies. Remember to do have actions | 5 | # architecture-specific flags and dependencies. Remember to do have actions |
@@ -21,9 +21,6 @@ | |||
21 | # | 21 | # |
22 | # $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $ | 22 | # $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $ |
23 | 23 | ||
24 | # Fill in SRCARCH | ||
25 | SRCARCH := x86 | ||
26 | |||
27 | # BITS is used as extension for files which are available in a 32 bit | 24 | # BITS is used as extension for files which are available in a 32 bit |
28 | # and a 64 bit version to simplify shared Makefiles. | 25 | # and a 64 bit version to simplify shared Makefiles. |
29 | # e.g.: obj-y += foo_$(BITS).o | 26 | # e.g.: obj-y += foo_$(BITS).o |
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h index 5f9a2e72a731..d2b5adf46512 100644 --- a/arch/x86/boot/boot.h +++ b/arch/x86/boot/boot.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #ifndef BOOT_BOOT_H | 17 | #ifndef BOOT_BOOT_H |
18 | #define BOOT_BOOT_H | 18 | #define BOOT_BOOT_H |
19 | 19 | ||
20 | #define STACK_SIZE 512 /* Minimum number of bytes for stack */ | ||
21 | |||
20 | #ifndef __ASSEMBLY__ | 22 | #ifndef __ASSEMBLY__ |
21 | 23 | ||
22 | #include <stdarg.h> | 24 | #include <stdarg.h> |
@@ -198,8 +200,6 @@ static inline int isdigit(int ch) | |||
198 | } | 200 | } |
199 | 201 | ||
200 | /* Heap -- available for dynamic lists. */ | 202 | /* Heap -- available for dynamic lists. */ |
201 | #define STACK_SIZE 512 /* Minimum number of bytes for stack */ | ||
202 | |||
203 | extern char _end[]; | 203 | extern char _end[]; |
204 | extern char *HEAP; | 204 | extern char *HEAP; |
205 | extern char *heap_end; | 205 | extern char *heap_end; |
@@ -216,9 +216,9 @@ static inline char *__get_heap(size_t s, size_t a, size_t n) | |||
216 | #define GET_HEAP(type, n) \ | 216 | #define GET_HEAP(type, n) \ |
217 | ((type *)__get_heap(sizeof(type),__alignof__(type),(n))) | 217 | ((type *)__get_heap(sizeof(type),__alignof__(type),(n))) |
218 | 218 | ||
219 | static inline int heap_free(void) | 219 | static inline bool heap_free(size_t n) |
220 | { | 220 | { |
221 | return heap_end-HEAP; | 221 | return (int)(heap_end-HEAP) >= (int)n; |
222 | } | 222 | } |
223 | 223 | ||
224 | /* copy.S */ | 224 | /* copy.S */ |
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index 8353c81c41c0..6ef5a060fa11 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S | |||
@@ -173,7 +173,8 @@ ramdisk_size: .long 0 # its size in bytes | |||
173 | bootsect_kludge: | 173 | bootsect_kludge: |
174 | .long 0 # obsolete | 174 | .long 0 # obsolete |
175 | 175 | ||
176 | heap_end_ptr: .word _end+1024 # (Header version 0x0201 or later) | 176 | heap_end_ptr: .word _end+STACK_SIZE-512 |
177 | # (Header version 0x0201 or later) | ||
177 | # space from here (exclusive) down to | 178 | # space from here (exclusive) down to |
178 | # end of setup code can be used by setup | 179 | # end of setup code can be used by setup |
179 | # for local heap purposes. | 180 | # for local heap purposes. |
@@ -230,28 +231,53 @@ start_of_setup: | |||
230 | int $0x13 | 231 | int $0x13 |
231 | #endif | 232 | #endif |
232 | 233 | ||
233 | # We will have entered with %cs = %ds+0x20, normalize %cs so | ||
234 | # it is on par with the other segments. | ||
235 | pushw %ds | ||
236 | pushw $setup2 | ||
237 | lretw | ||
238 | |||
239 | setup2: | ||
240 | # Force %es = %ds | 234 | # Force %es = %ds |
241 | movw %ds, %ax | 235 | movw %ds, %ax |
242 | movw %ax, %es | 236 | movw %ax, %es |
243 | cld | 237 | cld |
244 | 238 | ||
245 | # Stack paranoia: align the stack and make sure it is good | 239 | # Apparently some ancient versions of LILO invoked the kernel |
246 | # for both 16- and 32-bit references. In particular, if we | 240 | # with %ss != %ds, which happened to work by accident for the |
247 | # were meant to have been using the full 16-bit segment, the | 241 | # old code. If the CAN_USE_HEAP flag is set in loadflags, or |
248 | # caller might have set %sp to zero, which breaks %esp-based | 242 | # %ss != %ds, then adjust the stack pointer. |
249 | # references. | 243 | |
250 | andw $~3, %sp # dword align (might as well...) | 244 | # Smallest possible stack we can tolerate |
251 | jnz 1f | 245 | movw $(_end+STACK_SIZE), %cx |
252 | movw $0xfffc, %sp # Make sure we're not zero | 246 | |
253 | 1: movzwl %sp, %esp # Clear upper half of %esp | 247 | movw heap_end_ptr, %dx |
254 | sti | 248 | addw $512, %dx |
249 | jnc 1f | ||
250 | xorw %dx, %dx # Wraparound - whole segment available | ||
251 | 1: testb $CAN_USE_HEAP, loadflags | ||
252 | jnz 2f | ||
253 | |||
254 | # No CAN_USE_HEAP | ||
255 | movw %ss, %dx | ||
256 | cmpw %ax, %dx # %ds == %ss? | ||
257 | movw %sp, %dx | ||
258 | # If so, assume %sp is reasonably set, otherwise use | ||
259 | # the smallest possible stack. | ||
260 | jne 4f # -> Smallest possible stack... | ||
261 | |||
262 | # Make sure the stack is at least minimum size. Take a value | ||
263 | # of zero to mean "full segment." | ||
264 | 2: | ||
265 | andw $~3, %dx # dword align (might as well...) | ||
266 | jnz 3f | ||
267 | movw $0xfffc, %dx # Make sure we're not zero | ||
268 | 3: cmpw %cx, %dx | ||
269 | jnb 5f | ||
270 | 4: movw %cx, %dx # Minimum value we can possibly use | ||
271 | 5: movw %ax, %ss | ||
272 | movzwl %dx, %esp # Clear upper half of %esp | ||
273 | sti # Now we should have a working stack | ||
274 | |||
275 | # We will have entered with %cs = %ds+0x20, normalize %cs so | ||
276 | # it is on par with the other segments. | ||
277 | pushw %ds | ||
278 | pushw $6f | ||
279 | lretw | ||
280 | 6: | ||
255 | 281 | ||
256 | # Check signature at end of setup | 282 | # Check signature at end of setup |
257 | cmpl $0x5a5aaa55, setup_sig | 283 | cmpl $0x5a5aaa55, setup_sig |
diff --git a/arch/x86/boot/video-bios.c b/arch/x86/boot/video-bios.c index 68e65d95cdfd..ed0672a81870 100644 --- a/arch/x86/boot/video-bios.c +++ b/arch/x86/boot/video-bios.c | |||
@@ -79,7 +79,7 @@ static int bios_probe(void) | |||
79 | video_bios.modes = GET_HEAP(struct mode_info, 0); | 79 | video_bios.modes = GET_HEAP(struct mode_info, 0); |
80 | 80 | ||
81 | for (mode = 0x14; mode <= 0x7f; mode++) { | 81 | for (mode = 0x14; mode <= 0x7f; mode++) { |
82 | if (heap_free() < sizeof(struct mode_info)) | 82 | if (!heap_free(sizeof(struct mode_info))) |
83 | break; | 83 | break; |
84 | 84 | ||
85 | if (mode_defined(VIDEO_FIRST_BIOS+mode)) | 85 | if (mode_defined(VIDEO_FIRST_BIOS+mode)) |
diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c index 192190710710..4716b9a96357 100644 --- a/arch/x86/boot/video-vesa.c +++ b/arch/x86/boot/video-vesa.c | |||
@@ -57,7 +57,7 @@ static int vesa_probe(void) | |||
57 | while ((mode = rdfs16(mode_ptr)) != 0xffff) { | 57 | while ((mode = rdfs16(mode_ptr)) != 0xffff) { |
58 | mode_ptr += 2; | 58 | mode_ptr += 2; |
59 | 59 | ||
60 | if (heap_free() < sizeof(struct mode_info)) | 60 | if (!heap_free(sizeof(struct mode_info))) |
61 | break; /* Heap full, can't save mode info */ | 61 | break; /* Heap full, can't save mode info */ |
62 | 62 | ||
63 | if (mode & ~0x1ff) | 63 | if (mode & ~0x1ff) |
diff --git a/arch/x86/boot/video.c b/arch/x86/boot/video.c index e4ba897bf9a3..ad9712f01739 100644 --- a/arch/x86/boot/video.c +++ b/arch/x86/boot/video.c | |||
@@ -371,7 +371,7 @@ static void save_screen(void) | |||
371 | saved.curx = boot_params.screen_info.orig_x; | 371 | saved.curx = boot_params.screen_info.orig_x; |
372 | saved.cury = boot_params.screen_info.orig_y; | 372 | saved.cury = boot_params.screen_info.orig_y; |
373 | 373 | ||
374 | if (heap_free() < saved.x*saved.y*sizeof(u16)+512) | 374 | if (!heap_free(saved.x*saved.y*sizeof(u16)+512)) |
375 | return; /* Not enough heap to save the screen */ | 375 | return; /* Not enough heap to save the screen */ |
376 | 376 | ||
377 | saved.data = GET_HEAP(u16, saved.x*saved.y); | 377 | saved.data = GET_HEAP(u16, saved.x*saved.y); |
diff --git a/arch/i386/defconfig b/arch/x86/configs/i386_defconfig index 54ee1764fdae..54ee1764fdae 100644 --- a/arch/i386/defconfig +++ b/arch/x86/configs/i386_defconfig | |||
diff --git a/arch/x86_64/defconfig b/arch/x86/configs/x86_64_defconfig index b091c5e35558..b091c5e35558 100644 --- a/arch/x86_64/defconfig +++ b/arch/x86/configs/x86_64_defconfig | |||
diff --git a/arch/x86_64/.gitignore b/arch/x86_64/.gitignore deleted file mode 100644 index 36ef4c374d25..000000000000 --- a/arch/x86_64/.gitignore +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | boot | ||
diff --git a/arch/x86_64/Kconfig.debug b/arch/x86_64/Kconfig.debug deleted file mode 100644 index 775d211a5cf9..000000000000 --- a/arch/x86_64/Kconfig.debug +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | menu "Kernel hacking" | ||
2 | |||
3 | config TRACE_IRQFLAGS_SUPPORT | ||
4 | bool | ||
5 | default y | ||
6 | |||
7 | source "lib/Kconfig.debug" | ||
8 | |||
9 | config DEBUG_RODATA | ||
10 | bool "Write protect kernel read-only data structures" | ||
11 | depends on DEBUG_KERNEL | ||
12 | help | ||
13 | Mark the kernel read-only data as write-protected in the pagetables, | ||
14 | in order to catch accidental (and incorrect) writes to such const data. | ||
15 | This option may have a slight performance impact because a portion | ||
16 | of the kernel code won't be covered by a 2MB TLB anymore. | ||
17 | If in doubt, say "N". | ||
18 | |||
19 | config IOMMU_DEBUG | ||
20 | depends on IOMMU && DEBUG_KERNEL | ||
21 | bool "Enable IOMMU debugging" | ||
22 | help | ||
23 | Force the IOMMU to on even when you have less than 4GB of | ||
24 | memory and add debugging code. On overflow always panic. And | ||
25 | allow to enable IOMMU leak tracing. Can be disabled at boot | ||
26 | time with iommu=noforce. This will also enable scatter gather | ||
27 | list merging. Currently not recommended for production | ||
28 | code. When you use it make sure you have a big enough | ||
29 | IOMMU/AGP aperture. Most of the options enabled by this can | ||
30 | be set more finegrained using the iommu= command line | ||
31 | options. See Documentation/x86_64/boot-options.txt for more | ||
32 | details. | ||
33 | |||
34 | config IOMMU_LEAK | ||
35 | bool "IOMMU leak tracing" | ||
36 | depends on DEBUG_KERNEL | ||
37 | depends on IOMMU_DEBUG | ||
38 | help | ||
39 | Add a simple leak tracer to the IOMMU code. This is useful when you | ||
40 | are debugging a buggy device driver that leaks IOMMU mappings. | ||
41 | |||
42 | config DEBUG_STACKOVERFLOW | ||
43 | bool "Check for stack overflows" | ||
44 | depends on DEBUG_KERNEL | ||
45 | help | ||
46 | This option will cause messages to be printed if free stack space | ||
47 | drops below a certain limit. | ||
48 | |||
49 | config DEBUG_STACK_USAGE | ||
50 | bool "Stack utilization instrumentation" | ||
51 | depends on DEBUG_KERNEL | ||
52 | help | ||
53 | Enables the display of the minimum amount of free stack which each | ||
54 | task has ever had available in the sysrq-T and sysrq-P debug output. | ||
55 | |||
56 | This option will slow down process creation somewhat. | ||
57 | |||
58 | #config X86_REMOTE_DEBUG | ||
59 | # bool "kgdb debugging stub" | ||
60 | |||
61 | endmenu | ||
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index c457bdb2a42b..24141fb6f5cb 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -572,9 +572,11 @@ static int test_hash_jiffies_digest(struct hash_desc *desc, char *p, int blen, | |||
572 | int bcount; | 572 | int bcount; |
573 | int ret; | 573 | int ret; |
574 | 574 | ||
575 | sg_init_table(sg, 1); | ||
576 | |||
575 | for (start = jiffies, end = start + sec * HZ, bcount = 0; | 577 | for (start = jiffies, end = start + sec * HZ, bcount = 0; |
576 | time_before(jiffies, end); bcount++) { | 578 | time_before(jiffies, end); bcount++) { |
577 | sg_init_one(sg, p, blen); | 579 | sg_set_buf(sg, p, blen); |
578 | ret = crypto_hash_digest(desc, sg, blen, out); | 580 | ret = crypto_hash_digest(desc, sg, blen, out); |
579 | if (ret) | 581 | if (ret) |
580 | return ret; | 582 | return ret; |
@@ -597,13 +599,15 @@ static int test_hash_jiffies(struct hash_desc *desc, char *p, int blen, | |||
597 | if (plen == blen) | 599 | if (plen == blen) |
598 | return test_hash_jiffies_digest(desc, p, blen, out, sec); | 600 | return test_hash_jiffies_digest(desc, p, blen, out, sec); |
599 | 601 | ||
602 | sg_init_table(sg, 1); | ||
603 | |||
600 | for (start = jiffies, end = start + sec * HZ, bcount = 0; | 604 | for (start = jiffies, end = start + sec * HZ, bcount = 0; |
601 | time_before(jiffies, end); bcount++) { | 605 | time_before(jiffies, end); bcount++) { |
602 | ret = crypto_hash_init(desc); | 606 | ret = crypto_hash_init(desc); |
603 | if (ret) | 607 | if (ret) |
604 | return ret; | 608 | return ret; |
605 | for (pcount = 0; pcount < blen; pcount += plen) { | 609 | for (pcount = 0; pcount < blen; pcount += plen) { |
606 | sg_init_one(sg, p + pcount, plen); | 610 | sg_set_buf(sg, p + pcount, plen); |
607 | ret = crypto_hash_update(desc, sg, plen); | 611 | ret = crypto_hash_update(desc, sg, plen); |
608 | if (ret) | 612 | if (ret) |
609 | return ret; | 613 | return ret; |
@@ -628,12 +632,14 @@ static int test_hash_cycles_digest(struct hash_desc *desc, char *p, int blen, | |||
628 | int i; | 632 | int i; |
629 | int ret; | 633 | int ret; |
630 | 634 | ||
635 | sg_init_table(sg, 1); | ||
636 | |||
631 | local_bh_disable(); | 637 | local_bh_disable(); |
632 | local_irq_disable(); | 638 | local_irq_disable(); |
633 | 639 | ||
634 | /* Warm-up run. */ | 640 | /* Warm-up run. */ |
635 | for (i = 0; i < 4; i++) { | 641 | for (i = 0; i < 4; i++) { |
636 | sg_init_one(sg, p, blen); | 642 | sg_set_buf(sg, p, blen); |
637 | ret = crypto_hash_digest(desc, sg, blen, out); | 643 | ret = crypto_hash_digest(desc, sg, blen, out); |
638 | if (ret) | 644 | if (ret) |
639 | goto out; | 645 | goto out; |
@@ -645,7 +651,7 @@ static int test_hash_cycles_digest(struct hash_desc *desc, char *p, int blen, | |||
645 | 651 | ||
646 | start = get_cycles(); | 652 | start = get_cycles(); |
647 | 653 | ||
648 | sg_init_one(sg, p, blen); | 654 | sg_set_buf(sg, p, blen); |
649 | ret = crypto_hash_digest(desc, sg, blen, out); | 655 | ret = crypto_hash_digest(desc, sg, blen, out); |
650 | if (ret) | 656 | if (ret) |
651 | goto out; | 657 | goto out; |
@@ -679,6 +685,8 @@ static int test_hash_cycles(struct hash_desc *desc, char *p, int blen, | |||
679 | if (plen == blen) | 685 | if (plen == blen) |
680 | return test_hash_cycles_digest(desc, p, blen, out); | 686 | return test_hash_cycles_digest(desc, p, blen, out); |
681 | 687 | ||
688 | sg_init_table(sg, 1); | ||
689 | |||
682 | local_bh_disable(); | 690 | local_bh_disable(); |
683 | local_irq_disable(); | 691 | local_irq_disable(); |
684 | 692 | ||
@@ -688,7 +696,7 @@ static int test_hash_cycles(struct hash_desc *desc, char *p, int blen, | |||
688 | if (ret) | 696 | if (ret) |
689 | goto out; | 697 | goto out; |
690 | for (pcount = 0; pcount < blen; pcount += plen) { | 698 | for (pcount = 0; pcount < blen; pcount += plen) { |
691 | sg_init_one(sg, p + pcount, plen); | 699 | sg_set_buf(sg, p + pcount, plen); |
692 | ret = crypto_hash_update(desc, sg, plen); | 700 | ret = crypto_hash_update(desc, sg, plen); |
693 | if (ret) | 701 | if (ret) |
694 | goto out; | 702 | goto out; |
@@ -708,7 +716,7 @@ static int test_hash_cycles(struct hash_desc *desc, char *p, int blen, | |||
708 | if (ret) | 716 | if (ret) |
709 | goto out; | 717 | goto out; |
710 | for (pcount = 0; pcount < blen; pcount += plen) { | 718 | for (pcount = 0; pcount < blen; pcount += plen) { |
711 | sg_init_one(sg, p + pcount, plen); | 719 | sg_set_buf(sg, p + pcount, plen); |
712 | ret = crypto_hash_update(desc, sg, plen); | 720 | ret = crypto_hash_update(desc, sg, plen); |
713 | if (ret) | 721 | if (ret) |
714 | goto out; | 722 | goto out; |
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c index 4e8de162fc12..c666b4e0933e 100644 --- a/drivers/crypto/padlock-sha.c +++ b/drivers/crypto/padlock-sha.c | |||
@@ -55,7 +55,7 @@ static void padlock_sha_bypass(struct crypto_tfm *tfm) | |||
55 | if (ctx(tfm)->data && ctx(tfm)->used) { | 55 | if (ctx(tfm)->data && ctx(tfm)->used) { |
56 | struct scatterlist sg; | 56 | struct scatterlist sg; |
57 | 57 | ||
58 | sg_set_buf(&sg, ctx(tfm)->data, ctx(tfm)->used); | 58 | sg_init_one(&sg, ctx(tfm)->data, ctx(tfm)->used); |
59 | crypto_hash_update(&ctx(tfm)->fallback, &sg, sg.length); | 59 | crypto_hash_update(&ctx(tfm)->fallback, &sg, sg.length); |
60 | } | 60 | } |
61 | 61 | ||
@@ -79,7 +79,7 @@ static void padlock_sha_update(struct crypto_tfm *tfm, | |||
79 | 79 | ||
80 | if (unlikely(ctx(tfm)->bypass)) { | 80 | if (unlikely(ctx(tfm)->bypass)) { |
81 | struct scatterlist sg; | 81 | struct scatterlist sg; |
82 | sg_set_buf(&sg, (uint8_t *)data, length); | 82 | sg_init_one(&sg, (uint8_t *)data, length); |
83 | crypto_hash_update(&ctx(tfm)->fallback, &sg, length); | 83 | crypto_hash_update(&ctx(tfm)->fallback, &sg, length); |
84 | return; | 84 | return; |
85 | } | 85 | } |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 1c159ac68c98..28c6ae095c56 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -168,7 +168,7 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti, | |||
168 | return -ENOMEM; | 168 | return -ENOMEM; |
169 | } | 169 | } |
170 | 170 | ||
171 | sg_set_buf(&sg, cc->key, cc->key_size); | 171 | sg_init_one(&sg, cc->key, cc->key_size); |
172 | desc.tfm = hash_tfm; | 172 | desc.tfm = hash_tfm; |
173 | desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; | 173 | desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; |
174 | err = crypto_hash_digest(&desc, &sg, cc->key_size, salt); | 174 | err = crypto_hash_digest(&desc, &sg, cc->key_size, salt); |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 662b8d16803c..45f30a2974b8 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -284,7 +284,7 @@ static __net_exit void loopback_net_exit(struct net *net) | |||
284 | unregister_netdev(dev); | 284 | unregister_netdev(dev); |
285 | } | 285 | } |
286 | 286 | ||
287 | static struct pernet_operations __net_initdata loopback_net_ops = { | 287 | static struct pernet_operations loopback_net_ops = { |
288 | .init = loopback_net_init, | 288 | .init = loopback_net_init, |
289 | .exit = loopback_net_exit, | 289 | .exit = loopback_net_exit, |
290 | }; | 290 | }; |
diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c index bcb0885011c8..b35d79449500 100644 --- a/drivers/net/ppp_mppe.c +++ b/drivers/net/ppp_mppe.c | |||
@@ -68,7 +68,7 @@ MODULE_VERSION("1.0.2"); | |||
68 | static unsigned int | 68 | static unsigned int |
69 | setup_sg(struct scatterlist *sg, const void *address, unsigned int length) | 69 | setup_sg(struct scatterlist *sg, const void *address, unsigned int length) |
70 | { | 70 | { |
71 | sg_init_one(sg, address, length); | 71 | sg_set_buf(sg, address, length); |
72 | return length; | 72 | return length; |
73 | } | 73 | } |
74 | 74 | ||
@@ -140,6 +140,8 @@ static void get_new_key_from_sha(struct ppp_mppe_state * state) | |||
140 | struct scatterlist sg[4]; | 140 | struct scatterlist sg[4]; |
141 | unsigned int nbytes; | 141 | unsigned int nbytes; |
142 | 142 | ||
143 | sg_init_table(sg, 4); | ||
144 | |||
143 | nbytes = setup_sg(&sg[0], state->master_key, state->keylen); | 145 | nbytes = setup_sg(&sg[0], state->master_key, state->keylen); |
144 | nbytes += setup_sg(&sg[1], sha_pad->sha_pad1, | 146 | nbytes += setup_sg(&sg[1], sha_pad->sha_pad1, |
145 | sizeof(sha_pad->sha_pad1)); | 147 | sizeof(sha_pad->sha_pad1)); |
@@ -166,6 +168,8 @@ static void mppe_rekey(struct ppp_mppe_state * state, int initial_key) | |||
166 | if (!initial_key) { | 168 | if (!initial_key) { |
167 | crypto_blkcipher_setkey(state->arc4, state->sha1_digest, | 169 | crypto_blkcipher_setkey(state->arc4, state->sha1_digest, |
168 | state->keylen); | 170 | state->keylen); |
171 | sg_init_table(sg_in, 1); | ||
172 | sg_init_table(sg_out, 1); | ||
169 | setup_sg(sg_in, state->sha1_digest, state->keylen); | 173 | setup_sg(sg_in, state->sha1_digest, state->keylen); |
170 | setup_sg(sg_out, state->session_key, state->keylen); | 174 | setup_sg(sg_out, state->session_key, state->keylen); |
171 | if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in, | 175 | if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in, |
@@ -421,6 +425,8 @@ mppe_compress(void *arg, unsigned char *ibuf, unsigned char *obuf, | |||
421 | isize -= 2; | 425 | isize -= 2; |
422 | 426 | ||
423 | /* Encrypt packet */ | 427 | /* Encrypt packet */ |
428 | sg_init_table(sg_in, 1); | ||
429 | sg_init_table(sg_out, 1); | ||
424 | setup_sg(sg_in, ibuf, isize); | 430 | setup_sg(sg_in, ibuf, isize); |
425 | setup_sg(sg_out, obuf, osize); | 431 | setup_sg(sg_out, obuf, osize); |
426 | if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in, isize) != 0) { | 432 | if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in, isize) != 0) { |
@@ -608,6 +614,8 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf, | |||
608 | * Decrypt the first byte in order to check if it is | 614 | * Decrypt the first byte in order to check if it is |
609 | * a compressed or uncompressed protocol field. | 615 | * a compressed or uncompressed protocol field. |
610 | */ | 616 | */ |
617 | sg_init_table(sg_in, 1); | ||
618 | sg_init_table(sg_out, 1); | ||
611 | setup_sg(sg_in, ibuf, 1); | 619 | setup_sg(sg_in, ibuf, 1); |
612 | setup_sg(sg_out, obuf, 1); | 620 | setup_sg(sg_out, obuf, 1); |
613 | if (crypto_blkcipher_decrypt(&desc, sg_out, sg_in, 1) != 0) { | 621 | if (crypto_blkcipher_decrypt(&desc, sg_out, sg_in, 1) != 0) { |
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 097a136398cb..4bcf916c21a7 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -674,9 +674,8 @@ partial_sg_digest_update(struct hash_desc *desc, struct scatterlist *sg, | |||
674 | { | 674 | { |
675 | struct scatterlist temp; | 675 | struct scatterlist temp; |
676 | 676 | ||
677 | memcpy(&temp, sg, sizeof(struct scatterlist)); | 677 | sg_init_table(&temp, 1); |
678 | temp.offset = offset; | 678 | sg_set_page(&temp, sg_page(sg), length, offset); |
679 | temp.length = length; | ||
680 | crypto_hash_update(desc, &temp, length); | 679 | crypto_hash_update(desc, &temp, length); |
681 | } | 680 | } |
682 | 681 | ||
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 7a472b129997..9d70289f7df3 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -279,6 +279,8 @@ int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg, | |||
279 | int offset; | 279 | int offset; |
280 | int remainder_of_page; | 280 | int remainder_of_page; |
281 | 281 | ||
282 | sg_init_table(sg, sg_size); | ||
283 | |||
282 | while (size > 0 && i < sg_size) { | 284 | while (size > 0 && i < sg_size) { |
283 | pg = virt_to_page(addr); | 285 | pg = virt_to_page(addr); |
284 | offset = offset_in_page(addr); | 286 | offset = offset_in_page(addr); |
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index 4edaad0d995f..749def054a34 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c | |||
@@ -185,7 +185,7 @@ static __net_exit void proc_net_ns_exit(struct net *net) | |||
185 | kfree(net->proc_net_root); | 185 | kfree(net->proc_net_root); |
186 | } | 186 | } |
187 | 187 | ||
188 | static struct pernet_operations __net_initdata proc_net_ns_ops = { | 188 | static struct pernet_operations proc_net_ns_ops = { |
189 | .init = proc_net_ns_init, | 189 | .init = proc_net_ns_init, |
190 | .exit = proc_net_ns_exit, | 190 | .exit = proc_net_ns_exit, |
191 | }; | 191 | }; |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 93aa87d32804..5279466606d2 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -102,11 +102,9 @@ static inline void release_net(struct net *net) | |||
102 | #ifdef CONFIG_NET_NS | 102 | #ifdef CONFIG_NET_NS |
103 | #define __net_init | 103 | #define __net_init |
104 | #define __net_exit | 104 | #define __net_exit |
105 | #define __net_initdata | ||
106 | #else | 105 | #else |
107 | #define __net_init __init | 106 | #define __net_init __init |
108 | #define __net_exit __exit_refok | 107 | #define __net_exit __exit_refok |
109 | #define __net_initdata __initdata | ||
110 | #endif | 108 | #endif |
111 | 109 | ||
112 | struct pernet_operations { | 110 | struct pernet_operations { |
diff --git a/net/core/dev.c b/net/core/dev.c index ddfef3b45bab..853c8b575f1d 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2668,7 +2668,7 @@ static void __net_exit dev_proc_net_exit(struct net *net) | |||
2668 | proc_net_remove(net, "dev"); | 2668 | proc_net_remove(net, "dev"); |
2669 | } | 2669 | } |
2670 | 2670 | ||
2671 | static struct pernet_operations __net_initdata dev_proc_ops = { | 2671 | static struct pernet_operations dev_proc_ops = { |
2672 | .init = dev_proc_net_init, | 2672 | .init = dev_proc_net_init, |
2673 | .exit = dev_proc_net_exit, | 2673 | .exit = dev_proc_net_exit, |
2674 | }; | 2674 | }; |
@@ -4328,7 +4328,7 @@ static void __net_exit netdev_exit(struct net *net) | |||
4328 | kfree(net->dev_index_head); | 4328 | kfree(net->dev_index_head); |
4329 | } | 4329 | } |
4330 | 4330 | ||
4331 | static struct pernet_operations __net_initdata netdev_net_ops = { | 4331 | static struct pernet_operations netdev_net_ops = { |
4332 | .init = netdev_init, | 4332 | .init = netdev_init, |
4333 | .exit = netdev_exit, | 4333 | .exit = netdev_exit, |
4334 | }; | 4334 | }; |
@@ -4359,7 +4359,7 @@ static void __net_exit default_device_exit(struct net *net) | |||
4359 | rtnl_unlock(); | 4359 | rtnl_unlock(); |
4360 | } | 4360 | } |
4361 | 4361 | ||
4362 | static struct pernet_operations __net_initdata default_device_ops = { | 4362 | static struct pernet_operations default_device_ops = { |
4363 | .exit = default_device_exit, | 4363 | .exit = default_device_exit, |
4364 | }; | 4364 | }; |
4365 | 4365 | ||
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c index 15241cf48af8..ae354057d84c 100644 --- a/net/core/dev_mcast.c +++ b/net/core/dev_mcast.c | |||
@@ -285,7 +285,7 @@ static void __net_exit dev_mc_net_exit(struct net *net) | |||
285 | proc_net_remove(net, "dev_mcast"); | 285 | proc_net_remove(net, "dev_mcast"); |
286 | } | 286 | } |
287 | 287 | ||
288 | static struct pernet_operations __net_initdata dev_mc_net_ops = { | 288 | static struct pernet_operations dev_mc_net_ops = { |
289 | .init = dev_mc_net_init, | 289 | .init = dev_mc_net_init, |
290 | .exit = dev_mc_net_exit, | 290 | .exit = dev_mc_net_exit, |
291 | }; | 291 | }; |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 4a2640d38261..e1ba26fb4bf2 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -742,7 +742,7 @@ static struct net *get_net_ns_by_pid(pid_t pid) | |||
742 | /* Lookup the network namespace */ | 742 | /* Lookup the network namespace */ |
743 | net = ERR_PTR(-ESRCH); | 743 | net = ERR_PTR(-ESRCH); |
744 | rcu_read_lock(); | 744 | rcu_read_lock(); |
745 | tsk = find_task_by_pid(pid); | 745 | tsk = find_task_by_vpid(pid); |
746 | if (tsk) { | 746 | if (tsk) { |
747 | struct nsproxy *nsproxy; | 747 | struct nsproxy *nsproxy; |
748 | nsproxy = task_nsproxy(tsk); | 748 | nsproxy = task_nsproxy(tsk); |
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index ba9840195cf2..cad4278025ad 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -3,7 +3,7 @@ | |||
3 | #include <net/ip.h> | 3 | #include <net/ip.h> |
4 | #include <net/xfrm.h> | 4 | #include <net/xfrm.h> |
5 | #include <net/esp.h> | 5 | #include <net/esp.h> |
6 | #include <asm/scatterlist.h> | 6 | #include <linux/scatterlist.h> |
7 | #include <linux/crypto.h> | 7 | #include <linux/crypto.h> |
8 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
9 | #include <linux/pfkeyv2.h> | 9 | #include <linux/pfkeyv2.h> |
@@ -111,7 +111,9 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) | |||
111 | goto unlock; | 111 | goto unlock; |
112 | } | 112 | } |
113 | sg_init_table(sg, nfrags); | 113 | sg_init_table(sg, nfrags); |
114 | skb_to_sgvec(skb, sg, esph->enc_data+esp->conf.ivlen-skb->data, clen); | 114 | sg_mark_end(sg, skb_to_sgvec(skb, sg, esph->enc_data + |
115 | esp->conf.ivlen - | ||
116 | skb->data, clen)); | ||
115 | err = crypto_blkcipher_encrypt(&desc, sg, sg, clen); | 117 | err = crypto_blkcipher_encrypt(&desc, sg, sg, clen); |
116 | if (unlikely(sg != &esp->sgbuf[0])) | 118 | if (unlikely(sg != &esp->sgbuf[0])) |
117 | kfree(sg); | 119 | kfree(sg); |
@@ -203,7 +205,8 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) | |||
203 | goto out; | 205 | goto out; |
204 | } | 206 | } |
205 | sg_init_table(sg, nfrags); | 207 | sg_init_table(sg, nfrags); |
206 | skb_to_sgvec(skb, sg, sizeof(*esph) + esp->conf.ivlen, elen); | 208 | sg_mark_end(sg, skb_to_sgvec(skb, sg, sizeof(*esph) + esp->conf.ivlen, |
209 | elen)); | ||
207 | err = crypto_blkcipher_decrypt(&desc, sg, sg, elen); | 210 | err = crypto_blkcipher_decrypt(&desc, sg, sg, elen); |
208 | if (unlikely(sg != &esp->sgbuf[0])) | 211 | if (unlikely(sg != &esp->sgbuf[0])) |
209 | kfree(sg); | 212 | kfree(sg); |
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index f67d51a4e56d..ab17b5e62355 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <net/ip.h> | 29 | #include <net/ip.h> |
30 | #include <net/xfrm.h> | 30 | #include <net/xfrm.h> |
31 | #include <net/esp.h> | 31 | #include <net/esp.h> |
32 | #include <asm/scatterlist.h> | 32 | #include <linux/scatterlist.h> |
33 | #include <linux/crypto.h> | 33 | #include <linux/crypto.h> |
34 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
35 | #include <linux/pfkeyv2.h> | 35 | #include <linux/pfkeyv2.h> |
@@ -110,7 +110,9 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
110 | goto unlock; | 110 | goto unlock; |
111 | } | 111 | } |
112 | sg_init_table(sg, nfrags); | 112 | sg_init_table(sg, nfrags); |
113 | skb_to_sgvec(skb, sg, esph->enc_data+esp->conf.ivlen-skb->data, clen); | 113 | sg_mark_end(sg, skb_to_sgvec(skb, sg, esph->enc_data + |
114 | esp->conf.ivlen - | ||
115 | skb->data, clen)); | ||
114 | err = crypto_blkcipher_encrypt(&desc, sg, sg, clen); | 116 | err = crypto_blkcipher_encrypt(&desc, sg, sg, clen); |
115 | if (unlikely(sg != &esp->sgbuf[0])) | 117 | if (unlikely(sg != &esp->sgbuf[0])) |
116 | kfree(sg); | 118 | kfree(sg); |
@@ -207,7 +209,9 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
207 | } | 209 | } |
208 | } | 210 | } |
209 | sg_init_table(sg, nfrags); | 211 | sg_init_table(sg, nfrags); |
210 | skb_to_sgvec(skb, sg, sizeof(*esph) + esp->conf.ivlen, elen); | 212 | sg_mark_end(sg, skb_to_sgvec(skb, sg, |
213 | sizeof(*esph) + esp->conf.ivlen, | ||
214 | elen)); | ||
211 | ret = crypto_blkcipher_decrypt(&desc, sg, sg, elen); | 215 | ret = crypto_blkcipher_decrypt(&desc, sg, sg, elen); |
212 | if (unlikely(sg != &esp->sgbuf[0])) | 216 | if (unlikely(sg != &esp->sgbuf[0])) |
213 | kfree(sg); | 217 | kfree(sg); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 06fa4baddf05..85208026278b 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <net/snmp.h> | 59 | #include <net/snmp.h> |
60 | #include <net/dsfield.h> | 60 | #include <net/dsfield.h> |
61 | #include <net/timewait_sock.h> | 61 | #include <net/timewait_sock.h> |
62 | #include <net/netdma.h> | ||
62 | 63 | ||
63 | #include <asm/uaccess.h> | 64 | #include <asm/uaccess.h> |
64 | 65 | ||
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 325272925d0f..4f994c0fb3f8 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1888,7 +1888,7 @@ static void __net_exit netlink_net_exit(struct net *net) | |||
1888 | #endif | 1888 | #endif |
1889 | } | 1889 | } |
1890 | 1890 | ||
1891 | static struct pernet_operations __net_initdata netlink_net_ops = { | 1891 | static struct pernet_operations netlink_net_ops = { |
1892 | .init = netlink_net_init, | 1892 | .init = netlink_net_init, |
1893 | .exit = netlink_net_exit, | 1893 | .exit = netlink_net_exit, |
1894 | }; | 1894 | }; |
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c index ac3cabdca78c..eebefb6ef139 100644 --- a/net/rxrpc/rxkad.c +++ b/net/rxrpc/rxkad.c | |||
@@ -135,9 +135,8 @@ static void rxkad_prime_packet_security(struct rxrpc_connection *conn) | |||
135 | tmpbuf.x[2] = 0; | 135 | tmpbuf.x[2] = 0; |
136 | tmpbuf.x[3] = htonl(conn->security_ix); | 136 | tmpbuf.x[3] = htonl(conn->security_ix); |
137 | 137 | ||
138 | memset(sg, 0, sizeof(sg)); | 138 | sg_init_one(&sg[0], &tmpbuf, sizeof(tmpbuf)); |
139 | sg_set_buf(&sg[0], &tmpbuf, sizeof(tmpbuf)); | 139 | sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf)); |
140 | sg_set_buf(&sg[1], &tmpbuf, sizeof(tmpbuf)); | ||
141 | crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); | 140 | crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); |
142 | 141 | ||
143 | memcpy(&conn->csum_iv, &tmpbuf.x[2], sizeof(conn->csum_iv)); | 142 | memcpy(&conn->csum_iv, &tmpbuf.x[2], sizeof(conn->csum_iv)); |
@@ -180,9 +179,8 @@ static int rxkad_secure_packet_auth(const struct rxrpc_call *call, | |||
180 | desc.info = iv.x; | 179 | desc.info = iv.x; |
181 | desc.flags = 0; | 180 | desc.flags = 0; |
182 | 181 | ||
183 | memset(sg, 0, sizeof(sg)); | 182 | sg_init_one(&sg[0], &tmpbuf, sizeof(tmpbuf)); |
184 | sg_set_buf(&sg[0], &tmpbuf, sizeof(tmpbuf)); | 183 | sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf)); |
185 | sg_set_buf(&sg[1], &tmpbuf, sizeof(tmpbuf)); | ||
186 | crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); | 184 | crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); |
187 | 185 | ||
188 | memcpy(sechdr, &tmpbuf, sizeof(tmpbuf)); | 186 | memcpy(sechdr, &tmpbuf, sizeof(tmpbuf)); |
@@ -227,9 +225,8 @@ static int rxkad_secure_packet_encrypt(const struct rxrpc_call *call, | |||
227 | desc.info = iv.x; | 225 | desc.info = iv.x; |
228 | desc.flags = 0; | 226 | desc.flags = 0; |
229 | 227 | ||
230 | memset(sg, 0, sizeof(sg[0]) * 2); | 228 | sg_init_one(&sg[0], sechdr, sizeof(rxkhdr)); |
231 | sg_set_buf(&sg[0], sechdr, sizeof(rxkhdr)); | 229 | sg_init_one(&sg[1], &rxkhdr, sizeof(rxkhdr)); |
232 | sg_set_buf(&sg[1], &rxkhdr, sizeof(rxkhdr)); | ||
233 | crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(rxkhdr)); | 230 | crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(rxkhdr)); |
234 | 231 | ||
235 | /* we want to encrypt the skbuff in-place */ | 232 | /* we want to encrypt the skbuff in-place */ |
@@ -240,7 +237,7 @@ static int rxkad_secure_packet_encrypt(const struct rxrpc_call *call, | |||
240 | len = data_size + call->conn->size_align - 1; | 237 | len = data_size + call->conn->size_align - 1; |
241 | len &= ~(call->conn->size_align - 1); | 238 | len &= ~(call->conn->size_align - 1); |
242 | 239 | ||
243 | skb_to_sgvec(skb, sg, 0, len); | 240 | sg_init_table(sg, skb_to_sgvec(skb, sg, 0, len)); |
244 | crypto_blkcipher_encrypt_iv(&desc, sg, sg, len); | 241 | crypto_blkcipher_encrypt_iv(&desc, sg, sg, len); |
245 | 242 | ||
246 | _leave(" = 0"); | 243 | _leave(" = 0"); |
@@ -290,9 +287,8 @@ static int rxkad_secure_packet(const struct rxrpc_call *call, | |||
290 | tmpbuf.x[0] = sp->hdr.callNumber; | 287 | tmpbuf.x[0] = sp->hdr.callNumber; |
291 | tmpbuf.x[1] = x; | 288 | tmpbuf.x[1] = x; |
292 | 289 | ||
293 | memset(&sg, 0, sizeof(sg)); | 290 | sg_init_one(&sg[0], &tmpbuf, sizeof(tmpbuf)); |
294 | sg_set_buf(&sg[0], &tmpbuf, sizeof(tmpbuf)); | 291 | sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf)); |
295 | sg_set_buf(&sg[1], &tmpbuf, sizeof(tmpbuf)); | ||
296 | crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); | 292 | crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); |
297 | 293 | ||
298 | x = ntohl(tmpbuf.x[1]); | 294 | x = ntohl(tmpbuf.x[1]); |
@@ -332,20 +328,23 @@ static int rxkad_verify_packet_auth(const struct rxrpc_call *call, | |||
332 | struct rxrpc_skb_priv *sp; | 328 | struct rxrpc_skb_priv *sp; |
333 | struct blkcipher_desc desc; | 329 | struct blkcipher_desc desc; |
334 | struct rxrpc_crypt iv; | 330 | struct rxrpc_crypt iv; |
335 | struct scatterlist sg[2]; | 331 | struct scatterlist sg[16]; |
336 | struct sk_buff *trailer; | 332 | struct sk_buff *trailer; |
337 | u32 data_size, buf; | 333 | u32 data_size, buf; |
338 | u16 check; | 334 | u16 check; |
335 | int nsg; | ||
339 | 336 | ||
340 | _enter(""); | 337 | _enter(""); |
341 | 338 | ||
342 | sp = rxrpc_skb(skb); | 339 | sp = rxrpc_skb(skb); |
343 | 340 | ||
344 | /* we want to decrypt the skbuff in-place */ | 341 | /* we want to decrypt the skbuff in-place */ |
345 | if (skb_cow_data(skb, 0, &trailer) < 0) | 342 | nsg = skb_cow_data(skb, 0, &trailer); |
343 | if (nsg < 0 || nsg > 16) | ||
346 | goto nomem; | 344 | goto nomem; |
347 | 345 | ||
348 | skb_to_sgvec(skb, sg, 0, 8); | 346 | sg_init_table(sg, nsg); |
347 | sg_mark_end(sg, skb_to_sgvec(skb, sg, 0, 8)); | ||
349 | 348 | ||
350 | /* start the decryption afresh */ | 349 | /* start the decryption afresh */ |
351 | memset(&iv, 0, sizeof(iv)); | 350 | memset(&iv, 0, sizeof(iv)); |
@@ -426,7 +425,8 @@ static int rxkad_verify_packet_encrypt(const struct rxrpc_call *call, | |||
426 | goto nomem; | 425 | goto nomem; |
427 | } | 426 | } |
428 | 427 | ||
429 | skb_to_sgvec(skb, sg, 0, skb->len); | 428 | sg_init_table(sg, nsg); |
429 | sg_mark_end(sg, skb_to_sgvec(skb, sg, 0, skb->len)); | ||
430 | 430 | ||
431 | /* decrypt from the session key */ | 431 | /* decrypt from the session key */ |
432 | payload = call->conn->key->payload.data; | 432 | payload = call->conn->key->payload.data; |
@@ -521,9 +521,8 @@ static int rxkad_verify_packet(const struct rxrpc_call *call, | |||
521 | tmpbuf.x[0] = call->call_id; | 521 | tmpbuf.x[0] = call->call_id; |
522 | tmpbuf.x[1] = x; | 522 | tmpbuf.x[1] = x; |
523 | 523 | ||
524 | memset(&sg, 0, sizeof(sg)); | 524 | sg_init_one(&sg[0], &tmpbuf, sizeof(tmpbuf)); |
525 | sg_set_buf(&sg[0], &tmpbuf, sizeof(tmpbuf)); | 525 | sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf)); |
526 | sg_set_buf(&sg[1], &tmpbuf, sizeof(tmpbuf)); | ||
527 | crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); | 526 | crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); |
528 | 527 | ||
529 | x = ntohl(tmpbuf.x[1]); | 528 | x = ntohl(tmpbuf.x[1]); |
@@ -690,16 +689,20 @@ static void rxkad_calc_response_checksum(struct rxkad_response *response) | |||
690 | static void rxkad_sg_set_buf2(struct scatterlist sg[2], | 689 | static void rxkad_sg_set_buf2(struct scatterlist sg[2], |
691 | void *buf, size_t buflen) | 690 | void *buf, size_t buflen) |
692 | { | 691 | { |
692 | int nsg = 1; | ||
693 | 693 | ||
694 | memset(sg, 0, sizeof(sg)); | 694 | sg_init_table(sg, 2); |
695 | 695 | ||
696 | sg_set_buf(&sg[0], buf, buflen); | 696 | sg_set_buf(&sg[0], buf, buflen); |
697 | if (sg[0].offset + buflen > PAGE_SIZE) { | 697 | if (sg[0].offset + buflen > PAGE_SIZE) { |
698 | /* the buffer was split over two pages */ | 698 | /* the buffer was split over two pages */ |
699 | sg[0].length = PAGE_SIZE - sg[0].offset; | 699 | sg[0].length = PAGE_SIZE - sg[0].offset; |
700 | sg_set_buf(&sg[1], buf + sg[0].length, buflen - sg[0].length); | 700 | sg_set_buf(&sg[1], buf + sg[0].length, buflen - sg[0].length); |
701 | nsg++; | ||
701 | } | 702 | } |
702 | 703 | ||
704 | sg_mark_end(sg, nsg); | ||
705 | |||
703 | ASSERTCMP(sg[0].length + sg[1].length, ==, buflen); | 706 | ASSERTCMP(sg[0].length + sg[1].length, ==, buflen); |
704 | } | 707 | } |
705 | 708 | ||
@@ -712,7 +715,7 @@ static void rxkad_encrypt_response(struct rxrpc_connection *conn, | |||
712 | { | 715 | { |
713 | struct blkcipher_desc desc; | 716 | struct blkcipher_desc desc; |
714 | struct rxrpc_crypt iv; | 717 | struct rxrpc_crypt iv; |
715 | struct scatterlist ssg[2], dsg[2]; | 718 | struct scatterlist sg[2]; |
716 | 719 | ||
717 | /* continue encrypting from where we left off */ | 720 | /* continue encrypting from where we left off */ |
718 | memcpy(&iv, s2->session_key, sizeof(iv)); | 721 | memcpy(&iv, s2->session_key, sizeof(iv)); |
@@ -720,9 +723,8 @@ static void rxkad_encrypt_response(struct rxrpc_connection *conn, | |||
720 | desc.info = iv.x; | 723 | desc.info = iv.x; |
721 | desc.flags = 0; | 724 | desc.flags = 0; |
722 | 725 | ||
723 | rxkad_sg_set_buf2(ssg, &resp->encrypted, sizeof(resp->encrypted)); | 726 | rxkad_sg_set_buf2(sg, &resp->encrypted, sizeof(resp->encrypted)); |
724 | memcpy(dsg, ssg, sizeof(dsg)); | 727 | crypto_blkcipher_encrypt_iv(&desc, sg, sg, sizeof(resp->encrypted)); |
725 | crypto_blkcipher_encrypt_iv(&desc, dsg, ssg, sizeof(resp->encrypted)); | ||
726 | } | 728 | } |
727 | 729 | ||
728 | /* | 730 | /* |
@@ -817,7 +819,7 @@ static int rxkad_decrypt_ticket(struct rxrpc_connection *conn, | |||
817 | { | 819 | { |
818 | struct blkcipher_desc desc; | 820 | struct blkcipher_desc desc; |
819 | struct rxrpc_crypt iv, key; | 821 | struct rxrpc_crypt iv, key; |
820 | struct scatterlist ssg[1], dsg[1]; | 822 | struct scatterlist sg[1]; |
821 | struct in_addr addr; | 823 | struct in_addr addr; |
822 | unsigned life; | 824 | unsigned life; |
823 | time_t issue, now; | 825 | time_t issue, now; |
@@ -850,9 +852,8 @@ static int rxkad_decrypt_ticket(struct rxrpc_connection *conn, | |||
850 | desc.info = iv.x; | 852 | desc.info = iv.x; |
851 | desc.flags = 0; | 853 | desc.flags = 0; |
852 | 854 | ||
853 | sg_init_one(&ssg[0], ticket, ticket_len); | 855 | sg_init_one(&sg[0], ticket, ticket_len); |
854 | memcpy(dsg, ssg, sizeof(dsg)); | 856 | crypto_blkcipher_decrypt_iv(&desc, sg, sg, ticket_len); |
855 | crypto_blkcipher_decrypt_iv(&desc, dsg, ssg, ticket_len); | ||
856 | 857 | ||
857 | p = ticket; | 858 | p = ticket; |
858 | end = p + ticket_len; | 859 | end = p + ticket_len; |
@@ -961,7 +962,7 @@ static void rxkad_decrypt_response(struct rxrpc_connection *conn, | |||
961 | const struct rxrpc_crypt *session_key) | 962 | const struct rxrpc_crypt *session_key) |
962 | { | 963 | { |
963 | struct blkcipher_desc desc; | 964 | struct blkcipher_desc desc; |
964 | struct scatterlist ssg[2], dsg[2]; | 965 | struct scatterlist sg[2]; |
965 | struct rxrpc_crypt iv; | 966 | struct rxrpc_crypt iv; |
966 | 967 | ||
967 | _enter(",,%08x%08x", | 968 | _enter(",,%08x%08x", |
@@ -979,9 +980,8 @@ static void rxkad_decrypt_response(struct rxrpc_connection *conn, | |||
979 | desc.info = iv.x; | 980 | desc.info = iv.x; |
980 | desc.flags = 0; | 981 | desc.flags = 0; |
981 | 982 | ||
982 | rxkad_sg_set_buf2(ssg, &resp->encrypted, sizeof(resp->encrypted)); | 983 | rxkad_sg_set_buf2(sg, &resp->encrypted, sizeof(resp->encrypted)); |
983 | memcpy(dsg, ssg, sizeof(dsg)); | 984 | crypto_blkcipher_decrypt_iv(&desc, sg, sg, sizeof(resp->encrypted)); |
984 | crypto_blkcipher_decrypt_iv(&desc, dsg, ssg, sizeof(resp->encrypted)); | ||
985 | mutex_unlock(&rxkad_ci_mutex); | 985 | mutex_unlock(&rxkad_ci_mutex); |
986 | 986 | ||
987 | _leave(""); | 987 | _leave(""); |
diff --git a/net/sctp/auth.c b/net/sctp/auth.c index c9dbc3afa99f..8af1004abefe 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c | |||
@@ -726,8 +726,7 @@ void sctp_auth_calculate_hmac(const struct sctp_association *asoc, | |||
726 | 726 | ||
727 | /* set up scatter list */ | 727 | /* set up scatter list */ |
728 | end = skb_tail_pointer(skb); | 728 | end = skb_tail_pointer(skb); |
729 | sg_init_table(&sg, 1); | 729 | sg_init_one(&sg, auth, end - (unsigned char *)auth); |
730 | sg_set_buf(&sg, auth, end - (unsigned char *)auth); | ||
731 | 730 | ||
732 | desc.tfm = asoc->ep->auth_hmacs[hmac_id]; | 731 | desc.tfm = asoc->ep->auth_hmacs[hmac_id]; |
733 | desc.flags = 0; | 732 | desc.flags = 0; |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index c055212875f6..c377e4e8f653 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1513,8 +1513,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep, | |||
1513 | struct hash_desc desc; | 1513 | struct hash_desc desc; |
1514 | 1514 | ||
1515 | /* Sign the message. */ | 1515 | /* Sign the message. */ |
1516 | sg_init_table(&sg, 1); | 1516 | sg_init_one(&sg, &cookie->c, bodysize); |
1517 | sg_set_buf(&sg, &cookie->c, bodysize); | ||
1518 | keylen = SCTP_SECRET_SIZE; | 1517 | keylen = SCTP_SECRET_SIZE; |
1519 | key = (char *)ep->secret_key[ep->current_key]; | 1518 | key = (char *)ep->secret_key[ep->current_key]; |
1520 | desc.tfm = sctp_sk(ep->base.sk)->hmac; | 1519 | desc.tfm = sctp_sk(ep->base.sk)->hmac; |
@@ -1584,8 +1583,7 @@ struct sctp_association *sctp_unpack_cookie( | |||
1584 | 1583 | ||
1585 | /* Check the signature. */ | 1584 | /* Check the signature. */ |
1586 | keylen = SCTP_SECRET_SIZE; | 1585 | keylen = SCTP_SECRET_SIZE; |
1587 | sg_init_table(&sg, 1); | 1586 | sg_init_one(&sg, bear_cookie, bodysize); |
1588 | sg_set_buf(&sg, bear_cookie, bodysize); | ||
1589 | key = (char *)ep->secret_key[ep->current_key]; | 1587 | key = (char *)ep->secret_key[ep->current_key]; |
1590 | desc.tfm = sctp_sk(ep->base.sk)->hmac; | 1588 | desc.tfm = sctp_sk(ep->base.sk)->hmac; |
1591 | desc.flags = 0; | 1589 | desc.flags = 0; |
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c index 24711be4b2dc..91cd8f0d1e10 100644 --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c | |||
@@ -75,7 +75,7 @@ krb5_encrypt( | |||
75 | memcpy(local_iv, iv, crypto_blkcipher_ivsize(tfm)); | 75 | memcpy(local_iv, iv, crypto_blkcipher_ivsize(tfm)); |
76 | 76 | ||
77 | memcpy(out, in, length); | 77 | memcpy(out, in, length); |
78 | sg_set_buf(sg, out, length); | 78 | sg_init_one(sg, out, length); |
79 | 79 | ||
80 | ret = crypto_blkcipher_encrypt_iv(&desc, sg, sg, length); | 80 | ret = crypto_blkcipher_encrypt_iv(&desc, sg, sg, length); |
81 | out: | 81 | out: |
@@ -110,7 +110,7 @@ krb5_decrypt( | |||
110 | memcpy(local_iv,iv, crypto_blkcipher_ivsize(tfm)); | 110 | memcpy(local_iv,iv, crypto_blkcipher_ivsize(tfm)); |
111 | 111 | ||
112 | memcpy(out, in, length); | 112 | memcpy(out, in, length); |
113 | sg_set_buf(sg, out, length); | 113 | sg_init_one(sg, out, length); |
114 | 114 | ||
115 | ret = crypto_blkcipher_decrypt_iv(&desc, sg, sg, length); | 115 | ret = crypto_blkcipher_decrypt_iv(&desc, sg, sg, length); |
116 | out: | 116 | out: |
@@ -146,7 +146,7 @@ make_checksum(char *cksumname, char *header, int hdrlen, struct xdr_buf *body, | |||
146 | err = crypto_hash_init(&desc); | 146 | err = crypto_hash_init(&desc); |
147 | if (err) | 147 | if (err) |
148 | goto out; | 148 | goto out; |
149 | sg_set_buf(sg, header, hdrlen); | 149 | sg_init_one(sg, header, hdrlen); |
150 | err = crypto_hash_update(&desc, sg, hdrlen); | 150 | err = crypto_hash_update(&desc, sg, hdrlen); |
151 | if (err) | 151 | if (err) |
152 | goto out; | 152 | goto out; |
@@ -188,8 +188,6 @@ encryptor(struct scatterlist *sg, void *data) | |||
188 | /* Worst case is 4 fragments: head, end of page 1, start | 188 | /* Worst case is 4 fragments: head, end of page 1, start |
189 | * of page 2, tail. Anything more is a bug. */ | 189 | * of page 2, tail. Anything more is a bug. */ |
190 | BUG_ON(desc->fragno > 3); | 190 | BUG_ON(desc->fragno > 3); |
191 | desc->infrags[desc->fragno] = *sg; | ||
192 | desc->outfrags[desc->fragno] = *sg; | ||
193 | 191 | ||
194 | page_pos = desc->pos - outbuf->head[0].iov_len; | 192 | page_pos = desc->pos - outbuf->head[0].iov_len; |
195 | if (page_pos >= 0 && page_pos < outbuf->page_len) { | 193 | if (page_pos >= 0 && page_pos < outbuf->page_len) { |
@@ -199,7 +197,10 @@ encryptor(struct scatterlist *sg, void *data) | |||
199 | } else { | 197 | } else { |
200 | in_page = sg_page(sg); | 198 | in_page = sg_page(sg); |
201 | } | 199 | } |
202 | sg_assign_page(&desc->infrags[desc->fragno], in_page); | 200 | sg_set_page(&desc->infrags[desc->fragno], in_page, sg->length, |
201 | sg->offset); | ||
202 | sg_set_page(&desc->outfrags[desc->fragno], sg_page(sg), sg->length, | ||
203 | sg->offset); | ||
203 | desc->fragno++; | 204 | desc->fragno++; |
204 | desc->fraglen += sg->length; | 205 | desc->fraglen += sg->length; |
205 | desc->pos += sg->length; | 206 | desc->pos += sg->length; |
@@ -210,10 +211,17 @@ encryptor(struct scatterlist *sg, void *data) | |||
210 | if (thislen == 0) | 211 | if (thislen == 0) |
211 | return 0; | 212 | return 0; |
212 | 213 | ||
214 | sg_mark_end(desc->infrags, desc->fragno); | ||
215 | sg_mark_end(desc->outfrags, desc->fragno); | ||
216 | |||
213 | ret = crypto_blkcipher_encrypt_iv(&desc->desc, desc->outfrags, | 217 | ret = crypto_blkcipher_encrypt_iv(&desc->desc, desc->outfrags, |
214 | desc->infrags, thislen); | 218 | desc->infrags, thislen); |
215 | if (ret) | 219 | if (ret) |
216 | return ret; | 220 | return ret; |
221 | |||
222 | sg_init_table(desc->infrags, 4); | ||
223 | sg_init_table(desc->outfrags, 4); | ||
224 | |||
217 | if (fraglen) { | 225 | if (fraglen) { |
218 | sg_set_page(&desc->outfrags[0], sg_page(sg), fraglen, | 226 | sg_set_page(&desc->outfrags[0], sg_page(sg), fraglen, |
219 | sg->offset + sg->length - fraglen); | 227 | sg->offset + sg->length - fraglen); |
@@ -247,6 +255,9 @@ gss_encrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *buf, | |||
247 | desc.fragno = 0; | 255 | desc.fragno = 0; |
248 | desc.fraglen = 0; | 256 | desc.fraglen = 0; |
249 | 257 | ||
258 | sg_init_table(desc.infrags, 4); | ||
259 | sg_init_table(desc.outfrags, 4); | ||
260 | |||
250 | ret = xdr_process_buf(buf, offset, buf->len - offset, encryptor, &desc); | 261 | ret = xdr_process_buf(buf, offset, buf->len - offset, encryptor, &desc); |
251 | return ret; | 262 | return ret; |
252 | } | 263 | } |
@@ -271,7 +282,8 @@ decryptor(struct scatterlist *sg, void *data) | |||
271 | /* Worst case is 4 fragments: head, end of page 1, start | 282 | /* Worst case is 4 fragments: head, end of page 1, start |
272 | * of page 2, tail. Anything more is a bug. */ | 283 | * of page 2, tail. Anything more is a bug. */ |
273 | BUG_ON(desc->fragno > 3); | 284 | BUG_ON(desc->fragno > 3); |
274 | desc->frags[desc->fragno] = *sg; | 285 | sg_set_page(&desc->frags[desc->fragno], sg_page(sg), sg->length, |
286 | sg->offset); | ||
275 | desc->fragno++; | 287 | desc->fragno++; |
276 | desc->fraglen += sg->length; | 288 | desc->fraglen += sg->length; |
277 | 289 | ||
@@ -281,10 +293,15 @@ decryptor(struct scatterlist *sg, void *data) | |||
281 | if (thislen == 0) | 293 | if (thislen == 0) |
282 | return 0; | 294 | return 0; |
283 | 295 | ||
296 | sg_mark_end(desc->frags, desc->fragno); | ||
297 | |||
284 | ret = crypto_blkcipher_decrypt_iv(&desc->desc, desc->frags, | 298 | ret = crypto_blkcipher_decrypt_iv(&desc->desc, desc->frags, |
285 | desc->frags, thislen); | 299 | desc->frags, thislen); |
286 | if (ret) | 300 | if (ret) |
287 | return ret; | 301 | return ret; |
302 | |||
303 | sg_init_table(desc->frags, 4); | ||
304 | |||
288 | if (fraglen) { | 305 | if (fraglen) { |
289 | sg_set_page(&desc->frags[0], sg_page(sg), fraglen, | 306 | sg_set_page(&desc->frags[0], sg_page(sg), fraglen, |
290 | sg->offset + sg->length - fraglen); | 307 | sg->offset + sg->length - fraglen); |
@@ -312,6 +329,9 @@ gss_decrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *buf, | |||
312 | desc.desc.flags = 0; | 329 | desc.desc.flags = 0; |
313 | desc.fragno = 0; | 330 | desc.fragno = 0; |
314 | desc.fraglen = 0; | 331 | desc.fraglen = 0; |
332 | |||
333 | sg_init_table(desc.frags, 4); | ||
334 | |||
315 | return xdr_process_buf(buf, offset, buf->len - offset, decryptor, &desc); | 335 | return xdr_process_buf(buf, offset, buf->len - offset, decryptor, &desc); |
316 | } | 336 | } |
317 | 337 | ||
diff --git a/net/sunrpc/auth_gss/gss_spkm3_seal.c b/net/sunrpc/auth_gss/gss_spkm3_seal.c index d158635de6c0..abf17ce2e3b1 100644 --- a/net/sunrpc/auth_gss/gss_spkm3_seal.c +++ b/net/sunrpc/auth_gss/gss_spkm3_seal.c | |||
@@ -173,7 +173,7 @@ make_spkm3_checksum(s32 cksumtype, struct xdr_netobj *key, char *header, | |||
173 | if (err) | 173 | if (err) |
174 | goto out; | 174 | goto out; |
175 | 175 | ||
176 | sg_set_buf(sg, header, hdrlen); | 176 | sg_init_one(sg, header, hdrlen); |
177 | crypto_hash_update(&desc, sg, sg->length); | 177 | crypto_hash_update(&desc, sg, sg->length); |
178 | 178 | ||
179 | xdr_process_buf(body, body_offset, body->len - body_offset, | 179 | xdr_process_buf(body, body_offset, body->len - body_offset, |
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index f38dac30481b..fdc5e6d7562b 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c | |||
@@ -1030,6 +1030,8 @@ xdr_process_buf(struct xdr_buf *buf, unsigned int offset, unsigned int len, | |||
1030 | unsigned page_len, thislen, page_offset; | 1030 | unsigned page_len, thislen, page_offset; |
1031 | struct scatterlist sg[1]; | 1031 | struct scatterlist sg[1]; |
1032 | 1032 | ||
1033 | sg_init_table(sg, 1); | ||
1034 | |||
1033 | if (offset >= buf->head[0].iov_len) { | 1035 | if (offset >= buf->head[0].iov_len) { |
1034 | offset -= buf->head[0].iov_len; | 1036 | offset -= buf->head[0].iov_len; |
1035 | } else { | 1037 | } else { |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 83c5e76414ce..59594126e8b6 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -4,23 +4,30 @@ | |||
4 | 4 | ||
5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config | 5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config |
6 | 6 | ||
7 | # If a arch/$(SRCARCH)/Kconfig.$(ARCH) file exist use it | ||
8 | ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/Kconfig.$(ARCH)),) | ||
9 | Kconfig := arch/$(SRCARCH)/Kconfig.$(ARCH) | ||
10 | else | ||
11 | Kconfig := arch/$(SRCARCH)/Kconfig | ||
12 | endif | ||
13 | |||
7 | xconfig: $(obj)/qconf | 14 | xconfig: $(obj)/qconf |
8 | $< arch/$(ARCH)/Kconfig | 15 | $< $(Kconfig) |
9 | 16 | ||
10 | gconfig: $(obj)/gconf | 17 | gconfig: $(obj)/gconf |
11 | $< arch/$(ARCH)/Kconfig | 18 | $< $(Kconfig) |
12 | 19 | ||
13 | menuconfig: $(obj)/mconf | 20 | menuconfig: $(obj)/mconf |
14 | $< arch/$(ARCH)/Kconfig | 21 | $< $(Kconfig) |
15 | 22 | ||
16 | config: $(obj)/conf | 23 | config: $(obj)/conf |
17 | $< arch/$(ARCH)/Kconfig | 24 | $< $(Kconfig) |
18 | 25 | ||
19 | oldconfig: $(obj)/conf | 26 | oldconfig: $(obj)/conf |
20 | $< -o arch/$(ARCH)/Kconfig | 27 | $< -o $(Kconfig) |
21 | 28 | ||
22 | silentoldconfig: $(obj)/conf | 29 | silentoldconfig: $(obj)/conf |
23 | $< -s arch/$(ARCH)/Kconfig | 30 | $< -s $(Kconfig) |
24 | 31 | ||
25 | # Create new linux.po file | 32 | # Create new linux.po file |
26 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files | 33 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files |
@@ -45,27 +52,27 @@ update-po-config: $(obj)/kxgettext | |||
45 | PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig | 52 | PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig |
46 | 53 | ||
47 | randconfig: $(obj)/conf | 54 | randconfig: $(obj)/conf |
48 | $< -r arch/$(ARCH)/Kconfig | 55 | $< -r $(Kconfig) |
49 | 56 | ||
50 | allyesconfig: $(obj)/conf | 57 | allyesconfig: $(obj)/conf |
51 | $< -y arch/$(ARCH)/Kconfig | 58 | $< -y $(Kconfig) |
52 | 59 | ||
53 | allnoconfig: $(obj)/conf | 60 | allnoconfig: $(obj)/conf |
54 | $< -n arch/$(ARCH)/Kconfig | 61 | $< -n $(Kconfig) |
55 | 62 | ||
56 | allmodconfig: $(obj)/conf | 63 | allmodconfig: $(obj)/conf |
57 | $< -m arch/$(ARCH)/Kconfig | 64 | $< -m $(Kconfig) |
58 | 65 | ||
59 | defconfig: $(obj)/conf | 66 | defconfig: $(obj)/conf |
60 | ifeq ($(KBUILD_DEFCONFIG),) | 67 | ifeq ($(KBUILD_DEFCONFIG),) |
61 | $< -d arch/$(ARCH)/Kconfig | 68 | $< -d $(Kconfig) |
62 | else | 69 | else |
63 | @echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)' | 70 | @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" |
64 | $(Q)$< -D arch/$(ARCH)/configs/$(KBUILD_DEFCONFIG) arch/$(ARCH)/Kconfig | 71 | $(Q)$< -D arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) |
65 | endif | 72 | endif |
66 | 73 | ||
67 | %_defconfig: $(obj)/conf | 74 | %_defconfig: $(obj)/conf |
68 | $(Q)$< -D arch/$(ARCH)/configs/$@ arch/$(ARCH)/Kconfig | 75 | $(Q)$< -D arch/$(SRCARCH)/configs/$@ $(Kconfig) |
69 | 76 | ||
70 | # Help text used by make help | 77 | # Help text used by make help |
71 | help: | 78 | help: |