Add struct randomization plugin
Subsystems (33)
cover Add struct randomization plugin
This patch set ports over grsecurity's structure randomization feature. The plugin is largely unchanged from grsecurity, with some porting to go over Emese Revfy's v7 patch set for gcc plugin infrastructure. This is an RFC.
Although this set of changes does not directly make exploitation harder, when a number of structures are randomized, it will make it difficult to splat many relevant structures without knowing the exact build of the kernel the target is using. While for one structure, there are limited number of guesses required, in aggregate, this can be a large obstacle for exploitation.
Patch 3 is a grab bag that probably needs to be broken up, although I'm not sure of the best way to do so. Breaking by subsystem would seem to make an unwieldy patch set.
Known TODO that is not addressed as part of this patch set:
* tag security relevant structures for randomization
* add checkpatch checking for non-C99 initialization
* automated testing of randomization
* better description and examples of exploits effectively mitigated by this feature
Tagging of structures to be randomized will come in subsequent series of patches.
--
arch/Kconfig | 35 + arch/x86/include/asm/floppy.h | 20 +- arch/x86/include/asm/paravirt_types.h | 18 +- drivers/acpi/acpica/hwxfsleep.c | 11 +- drivers/block/cciss.h | 30 +- drivers/gpu/drm/nouveau/nouveau_ttm.c | 28 +- drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 +- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 10 +- drivers/infiniband/hw/nes/nes_cm.c | 22 +- drivers/isdn/gigaset/bas-gigaset.c | 32 +- drivers/isdn/gigaset/ser-gigaset.c | 32 +- drivers/isdn/gigaset/usb-gigaset.c | 32 +- drivers/isdn/i4l/isdn_concap.c | 6 +- drivers/isdn/i4l/isdn_x25iface.c | 16 +- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- drivers/net/ethernet/brocade/bna/bna_enet.c | 8 +- drivers/net/wan/lmc/lmc_media.c | 97 +-- drivers/scsi/bfa/bfa_fcs.c | 19 +- drivers/scsi/bfa/bfa_fcs_lport.c | 29 +- drivers/scsi/bfa/bfa_modules.h | 12 +- drivers/scsi/hpsa.h | 40 +- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 10 +- drivers/video/fbdev/matrox/matroxfb_DAC1064.c | 10 +- drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 5 +- fs/reiserfs/item_ops.c | 24 +- include/linux/compiler-gcc.h | 5 + include/linux/compiler.h | 9 + include/linux/rbtree_augmented.h | 4 +- include/linux/vermagic.h | 9 +- kernel/module.c | 27 + lib/rbtree.c | 4 +- mm/page_alloc.c | 2 +- net/atm/lec.c | 6 +- net/atm/mpoa_caches.c | 41 +- net/vmw_vsock/vmci_transport_notify.c | 30 +- net/vmw_vsock/vmci_transport_notify_qstate.c | 30 +- scripts/Makefile.gcc-plugins | 11 +- scripts/gcc-plugins/.gitignore | 1 + scripts/gcc-plugins/Makefile | 12 + scripts/gcc-plugins/gen-random-seed.sh | 8 + scripts/gcc-plugins/randomize_layout_plugin.c | 935 ++++++++++++++++++++++++ sound/synth/emux/emux_seq.c | 14 +- 44 files changed, 1402 insertions(+), 316 deletions(-)
RFC 1/3 Add struct randomizing plugin
This plugin randomizes the layout of certain structures at compile time. This introduces two defines __randomize_layout and __no_randomize_layout. Which, turn, tell the compiler to either try to randomize or not to randomize the struct in question. This also requires struct initalization to use the C99 designated initalizer form.
This feature is ported over from grsecurity. This is largely unchanged from the Original code written by the PaX Team and Spender.
--- scripts/Makefile.gcc-plugins | 11 +- scripts/gcc-plugins/.gitignore | 2 + scripts/gcc-plugins/Makefile | 12 + scripts/gcc-plugins/gen-random-seed.sh | 9 + scripts/gcc-plugins/randomize_layout_plugin.c | 935 ++++++++++++++++++++++++++ 5 files changed, 968 insertions(+), 1 deletion(-) create mode 100644 scripts/gcc-plugins/.gitignore create mode 100644 scripts/gcc-plugins/gen-random-seed.sh create mode 100644 scripts/gcc-plugins/randomize_layout_plugin.c
scripts/Makefile.gcc-plugins +10 -1
@@ -19,7 +19,16 @@ ifdef CONFIG_GCC_PLUGINS endif endif - GCC_PLUGINS_CFLAGS := $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) + + gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so + ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT + RANDSTRUCT_PLUGIN_CFLAGS := -DRANDSTRUCT_PLUGIN + ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE + RANDSTRUCT_PLUGIN_CFLAGS += -fplugin-arg-randomize_layout_plugin-performance-mode + endif + endif + + GCC_PLUGINS_CFLAGS := $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(RANDSTRUCT_PLUGIN_CFLAGS) ifeq ($(PLUGINCC),) ifneq ($(GCC_PLUGINS_CFLAGS),)
scripts/gcc-plugins/.gitignore new file +2 -0
@@ -0,0 +1,2 @@ +# Copyright (c) 2016, Intel Corporation. +randomize_layout_seed.h
scripts/gcc-plugins/Makefile +12 -0
@@ -17,8 +17,20 @@ $(HOSTLIBS)-$(CONFIG_GCC_PLUGIN_CYC_COMPLEXITY) := cyc_complexity_plugin.so ifeq ($(CFLAGS_KCOV), -fplugin=$(objtree)/scripts/gcc-plugins/sancov_plugin.so) $(HOSTLIBS)-$(CONFIG_GCC_PLUGIN_SANCOV) += sancov_plugin.so endif +$(HOSTLIBS)-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so always := $($(HOSTLIBS)-y) cyc_complexity_plugin-objs := cyc_complexity_plugin.o sancov_plugin-objs := sancov_plugin.o +randomize_layout_plugin-objs := randomize_layout_plugin.o + +$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h + +quiet_cmd_create_randomize_layout_seed = GENSEED $@ + cmd_create_randomize_layout_seed = \ + $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/include/generated/randomize_layout_hash.h +$(objtree)/$(obj)/randomize_layout_seed.h: FORCE + $(call if_changed,create_randomize_layout_seed) + +targets += randomize_layout_seed.h randomize_layout_hash.h
scripts/gcc-plugins/gen-random-seed.sh new file +9 -0
@@ -0,0 +1,9 @@ +#!/bin/sh +# Copyright (c) 2016, Intel Corporation. + +if [ ! -f "$1" ]; then + SEED=`od -A n -t x8 -N 32 /dev/urandom | tr -d ' \n'` + echo "const char *randstruct_seed = \"$SEED\";" > "$1" + HASH=`echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d ' \n'` + echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2" +fi
scripts/gcc-plugins/randomize_layout_plugin.c new file +935 -0
935 lines not on this page · raw message
Signature · 1 line
1.9.1
[kernel-hardening] Re: [RFC 1/3] Add struct randomizing plugin
Hi Michael,
Quoted 1 line
+ * Copyright (c) 2016, Intel Corporation.
Can you please describe exactly what changes of yours to my work justify claiming Intel's copyright over even a sliver of the file? What new expression of creativity has Intel provided here?
Was it the whitespace changes? The conversion of // to /* */ ? The single typo fix? Removing the single line that breaks the plugin when used with the constify plugin?
-Brad
[kernel-hardening] Re: [RFC 1/3] Add struct randomizing plugin
Quoted 4 lines · Brad Spengler
Hi Michael,
Quoted 1 line
+ * Copyright (c) 2016, Intel Corporation.
Quoted 8 lines
Can you please describe exactly what changes of yours to my work justify claiming Intel's copyright over even a sliver of the file? What new expression of creativity has Intel provided here?
Was it the whitespace changes? The conversion of // to /* */ ? The single typo fix? Removing the single line that breaks the plugin when used with the constify plugin?
-Brad
The Intel copyright was applied as it is standard operating procedure. After some internal discussions, we basically agree. The changes created here are trivial from the original and the result nearly 100% your work. The next RFC and any subsequent submissions will not have the Intel copyright for trivial changes rotely applied.
Regarding the constify plugin breakage, as we don't presently have a constify plugin, I removed it.
Cheers
Signature · 1 line
Michael Leibowitz
RFC 2/3 Enable the RANDSTRUCT plugin
In reply to Michael LeibowitzThese are config changes necessary to configure/enable the structure layout randomizing gcc plugin
This feature is ported over from grsecurity. This is largely unchanged from the Original code written by the PaX Team and Spender.
--- arch/Kconfig | 43 +++++++++++++++++++++++++++++++++++++++++++ include/linux/compiler-gcc.h | 5 +++++ include/linux/compiler.h | 9 +++++++++ include/linux/vermagic.h | 9 ++++++++- kernel/module.c | 27 +++++++++++++++++++++++++++ 5 files changed, 92 insertions(+), 1 deletion(-)
arch/Kconfig +43 -0
@@ -389,6 +389,49 @@ config GCC_PLUGIN_SANCOV gcc-4.5 on). It is based on the commit "Add fuzzing coverage support" by Dmitry Vyukov <[email protected]>. +config GCC_PLUGIN_RANDSTRUCT + bool "Randomize layout of sensitive kernel structures" + default n + depends on GCC_PLUGINS + select MODVERSIONS if MODULES + help + + If you say Y here, the layouts of a number of sensitive kernel + structures and all structures composed entirely of function pointers + (aka "ops" structs) will be randomized at compile-time. This can make + exploitation that targets these structures more difficult by either + requiring an additional information leak vulnerability, or knowing the + pricise build that the target is running. + + Enabling this feature will have a performance impact, slightly + increase memory usage, and prevent the use of forensic tools like + Volatility against the system (unless the kernel source tree isn't + cleaned after kernel installation). + + Additionally, enabling this feature causes modules compiled with one + random seed to have gibberish names when loaded by a kernel with a + different random seed. + + The seed used for compilation is located at + scripts/gcc-plugins/randomize_layout_seed.h. It remains after a make + clean to allow for external modules to be compiled with the existing + seed and will be removed by a make mrproper or make distclean. + + Note that the implementation requires gcc 4.6.4. or newer. You may need + to install the supporting headers explicitly in addition to the normal + gcc package. + +config GCC_PLUGIN_RANDSTRUCT_PERFORMANCE + bool "Use cacheline-aware structure randomization" + default n + depends on GCC_PLUGIN_RANDSTRUCT + help + If you say Y here, the RANDSTRUCT randomization will make a best effort + at restricting randomization to cacheline-sized groups of elements. It + will further not randomize bitfields in structures. This reduces the + performance hit of RANDSTRUCT at the cost of weakened randomization. + + config HAVE_CC_STACKPROTECTOR bool help
include/linux/compiler-gcc.h +5 -0
@@ -201,6 +201,11 @@/* Mark a function definition as prohibited from being cloned. */ #define __noclone __attribute__((__noclone__)) +#ifdef RANDSTRUCT_PLUGIN +#define __randomize_layout __attribute__((randomize_layout)) +#define __no_randomize_layout __attribute__((no_randomize_layout)) +#endif +#endif /* GCC_VERSION >= 40500 */ #if GCC_VERSION >=40600
include/linux/compiler.h +9 -0
@@ -416,6 +416,15 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s# define __attribute_const__/* unimplemented */ #endif +#ifndef __randomize_layout +# define __randomize_layout +#endif + +#ifndef __no_randomize_layout +# define __no_randomize_layout +#endif + +/* * Tell gcc if a function is cold. The compiler will assume any path * directly leading to the call is unlikely.
include/linux/vermagic.h +8 -1
@@ -24,10 +24,17 @@#ifndef MODULE_ARCH_VERMAGIC #define MODULE_ARCH_VERMAGIC ""#endif +#ifdef RANDSTRUCT_PLUGIN +#include <generated/randomize_layout_hash.h> +#define MODULE_RANDSTRUCT_PLUGIN "RANDSTRUCT_PLUGIN_" RANDSTRUCT_HASHED_SEED +#else +#define MODULE_RANDSTRUCT_PLUGIN +#endif #define VERMAGIC_STRING \ UTS_RELEASE " " \ MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \ - MODULE_ARCH_VERMAGIC + MODULE_ARCH_VERMAGIC \ + MODULE_RANDSTRUCT_PLUGIN
kernel/module.c +27 -0
@@ -1296,12 +1296,31 @@ static int check_version(Elf_Shdr *sechdrs, goto bad_version; } +#ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT +/* +* avoid potentially printing jibberish on attempted load +* of a module randomized with a different seed +*/ +pr_warn ("no symbol version for %s\n" , symname); +#else +pr_warn ("%s: no symbol version for %s\n" , mod->name, symname); +#endif +pr_warn ("%s: no symbol version for %s\n" , mod->name, symname);return 0 ; bad_version: +#ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT +/* +* avoid potentially printing jibberish on attempted load +* of a module randomized with a different seed +*/ +pr_warn ("attempted module disagrees about version of symbol %s\n" , + symname); +#else pr_warn ("%s: disagrees about version of symbol %s\n" , mod->name, symname); +#endif return 0 ; }
@@ -2835,7 +2854,15 @@ static struct module *setup_load_info(struct load_info *info, int flags) mod = (void *)info->sechdrs[info->index.mod].sh_addr;if (info->index.sym ==0 ) { +#ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT +/* +* avoid potentially printing jibberish on attempted load +* of a module randomized with a different seed +*/ +pr_warn ("module has no symbols (stripped?)\n" ); +#else pr_warn ("%s: module has no symbols (stripped?)\n" , mod->name); +#endif return ERR_PTR (-ENOEXEC ); }
Signature · 1 line
1.9.1
[kernel-hardening] Re: [RFC 2/3] Enable the RANDSTRUCT plugin
Quoted 35 lines · Michael Leibowitz
These are config changes necessary to configure/enable the structure layout randomizing gcc plugin
This feature is ported over from grsecurity. This is largely unchanged from the Original code written by the PaX Team and Spender.
Signed-off-by Michael Leibowitz <[email protected]>--- arch/Kconfig | 43 +++++++++++++++++++++++++++++++++++++++++++ include/linux/compiler-gcc.h | 5 +++++ include/linux/compiler.h | 9 +++++++++ include/linux/vermagic.h | 9 ++++++++- kernel/module.c | 27 +++++++++++++++++++++++++++ 5 files changed, 92 insertions(+), 1 deletion(-)arch/Kconfig +12
-0@@ -389,6 +389,49 @@ config GCC_PLUGIN_SANCOV gcc-4.5 on). It is based on the commit "Add fuzzing coverage support" by Dmitry Vyukov <[email protected]>. +config GCC_PLUGIN_RANDSTRUCT + bool "Randomize layout of sensitive kernel structures" + default n + depends on GCC_PLUGINS + select MODVERSIONS if MODULES + help + + If you say Y here, the layouts of a number of sensitive kernel + structures and all structures composed entirely of function pointers + (aka "ops" structs) will be randomized at compile-time. This can make + exploitation that targets these structures more difficult by either + requiring an additional information leak vulnerability, or knowing the
arch/Kconfig config GCC_PLUGIN_SANCOV · line 413
Quoted 10 lines
arch/Kconfig +10
-0+ pricise build that the target is running. + + Enabling this feature will have a performance impact, slightly + increase memory usage, and prevent the use of forensic tools like + Volatility against the system (unless the kernel source tree isn't + cleaned after kernel installation). + + Additionally, enabling this feature causes modules compiled with one + random seed to have gibberish names when loaded by a kernel with a + different random seed.
I think this paragraph can be dropped, since the module name is avoided in the code below.
arch/Kconfig config GCC_PLUGIN_SANCOV · line 422
Quoted 9 lines
arch/Kconfig +9
-0+ + The seed used for compilation is located at + scripts/gcc-plugins/randomize_layout_seed.h. It remains after a make + clean to allow for external modules to be compiled with the existing + seed and will be removed by a make mrproper or make distclean. + + Note that the implementation requires gcc 4.6.4. or newer. You may need + to install the supporting headers explicitly in addition to the normal + gcc package.
Does this use headers not already detected by the gcc plugin infrastructure?
Quoted 83 lines
arch/Kconfig +12
-0+ +config GCC_PLUGIN_RANDSTRUCT_PERFORMANCE + bool "Use cacheline-aware structure randomization" + default n + depends on GCC_PLUGIN_RANDSTRUCT + help + If you say Y here, the RANDSTRUCT randomization will make a best effort + at restricting randomization to cacheline-sized groups of elements. It + will further not randomize bitfields in structures. This reduces the + performance hit of RANDSTRUCT at the cost of weakened randomization. + + config HAVE_CC_STACKPROTECTOR bool helpinclude/linux/compiler-gcc.h +5
-0@@ -201,6 +201,11 @@/* Mark a function definition as prohibited from being cloned. */ #define __noclone __attribute__((__noclone__)) +#ifdef RANDSTRUCT_PLUGIN +#define __randomize_layout __attribute__((randomize_layout)) +#define __no_randomize_layout __attribute__((no_randomize_layout)) +#endif +#endif /* GCC_VERSION >= 40500 */ #if GCC_VERSION >=40600 include/linux/compiler.h +9
-0@@ -416,6 +416,15 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s# define __attribute_const__/* unimplemented */ #endif +#ifndef __randomize_layout +# define __randomize_layout +#endif + +#ifndef __no_randomize_layout +# define __no_randomize_layout +#endif + +/* * Tell gcc if a function is cold. The compiler will assume any path * directly leading to the call is unlikely. include/linux/vermagic.h +8
-1@@ -24,10 +24,17 @@#ifndef MODULE_ARCH_VERMAGIC #define MODULE_ARCH_VERMAGIC ""#endif +#ifdef RANDSTRUCT_PLUGIN +#include <generated/randomize_layout_hash.h> +#define MODULE_RANDSTRUCT_PLUGIN "RANDSTRUCT_PLUGIN_" RANDSTRUCT_HASHED_SEED +#else +#define MODULE_RANDSTRUCT_PLUGIN +#endif #define VERMAGIC_STRING \ UTS_RELEASE " " \ MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \ - MODULE_ARCH_VERMAGIC + MODULE_ARCH_VERMAGIC \ + MODULE_RANDSTRUCT_PLUGINkernel/module.c +1
-0@@ -1296,12 +1296,31 @@ static int check_version(Elf_Shdr *sechdrs, goto bad_version; } +#ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT
kernel/module.c static int check_version(Elf_Shdr *sechdrs, · line 1309
Quoted 10 lines
kernel/module.c +9
-0+/* +* avoid potentially printing jibberish on attempted load +* of a module randomized with a different seed +*/ +pr_warn ("no symbol version for %s\n" , symname); +#else +pr_warn ("%s: no symbol version for %s\n" , mod->name, symname); +#endif +pr_warn ("%s: no symbol version for %s\n" , mod->name, symname);
I think this pr_warn needs to be removed (it looks to have moved inside the define).
I wonder if the module filename can be propagated in some other way besides mod->name?
Quoted 36 lines
kernel/module.c +17
-1return 0 ; bad_version: +#ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT +/* +* avoid potentially printing jibberish on attempted load +* of a module randomized with a different seed +*/ +pr_warn ("attempted module disagrees about version of symbol %s\n" , + symname); +#else pr_warn ("%s: disagrees about version of symbol %s\n" , mod->name, symname); +#endif return 0 ; }@@ -2835,7 +2854,15 @@ static struct module *setup_load_info(struct load_info *info, int flags) mod = (void *)info->sechdrs[info->index.mod].sh_addr;if (info->index.sym ==0 ) { +#ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT +/* +* avoid potentially printing jibberish on attempted load +* of a module randomized with a different seed +*/ +pr_warn ("module has no symbols (stripped?)\n" ); +#else pr_warn ("%s: module has no symbols (stripped?)\n" , mod->name); +#endif return ERR_PTR (-ENOEXEC ); } --1.9.1
Signature · 2 lines
Kees Cook Chrome OS & Brillo Security
RFC 3/3 Change initialization C99 style; tag no_ramdomize_layout structs
In reply to Michael LeibowitzDue to randomization of structs, the in order struct intialization style is replaced with explicit field style.
struct foo_t my_foo = {
one,
two,
three
};
becomes
struct foo_t my_foo = {
.one = one,
.two = two,
.three = three
};Additionally, tag paravirt related structures to explicitly not be randomized, as the structure layout is important.
This feature is ported over from grsecurity. This is largely unchanged from the Original code written by the PaX Team and Spender.
--- arch/x86/include/asm/floppy.h | 20 ++--- arch/x86/include/asm/paravirt_types.h | 18 +++-- drivers/acpi/acpica/hwxfsleep.c | 11 +-- drivers/block/cciss.h | 30 ++++---- drivers/gpu/drm/nouveau/nouveau_ttm.c | 28 +++---- drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 +-- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 10 +-- drivers/infiniband/hw/nes/nes_cm.c | 22 +++--- drivers/isdn/gigaset/bas-gigaset.c | 32 ++++---- drivers/isdn/gigaset/ser-gigaset.c | 32 ++++---- drivers/isdn/gigaset/usb-gigaset.c | 32 ++++---- drivers/isdn/i4l/isdn_concap.c | 6 +- drivers/isdn/i4l/isdn_x25iface.c | 16 ++-- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- drivers/net/ethernet/brocade/bna/bna_enet.c | 8 +- drivers/net/wan/lmc/lmc_media.c | 97 +++++++++++++------------ drivers/scsi/bfa/bfa_fcs.c | 19 ++++- drivers/scsi/bfa/bfa_fcs_lport.c | 29 +++++--- drivers/scsi/bfa/bfa_modules.h | 12 +-- drivers/scsi/hpsa.h | 40 +++++----- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 10 +-- drivers/video/fbdev/matrox/matroxfb_DAC1064.c | 10 ++- drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 5 +- fs/reiserfs/item_ops.c | 24 +++--- include/linux/rbtree_augmented.h | 4 +- lib/rbtree.c | 4 +- mm/page_alloc.c | 2 +- net/atm/lec.c | 6 +- net/atm/mpoa_caches.c | 41 +++++------ net/vmw_vsock/vmci_transport_notify.c | 30 ++++---- net/vmw_vsock/vmci_transport_notify_qstate.c | 30 ++++---- sound/synth/emux/emux_seq.c | 14 ++-- 34 files changed, 352 insertions(+), 314 deletions(-)
arch/x86/include/asm/floppy.h +10 -10
@@ -229,18 +229,18 @@ static struct fd_routine_l {int (*_dma_setup)(char *addr,unsigned long size,int mode,int io); } fd_routine[] = { { - request_dma, - free_dma, - get_dma_residue, - dma_mem_alloc, - hard_dma_setup + ._request_dma = request_dma, + ._free_dma = free_dma, + ._get_dma_residue = get_dma_residue, + ._dma_mem_alloc = dma_mem_alloc, + ._dma_setup = hard_dma_setup }, { - vdma_request_dma, - vdma_nop, - vdma_get_dma_residue, - vdma_mem_alloc, - vdma_dma_setup + ._request_dma = vdma_request_dma, + ._free_dma = vdma_nop, + ._get_dma_residue = vdma_get_dma_residue, + ._dma_mem_alloc = vdma_mem_alloc, + ._dma_setup = vdma_dma_setup } };
arch/x86/include/asm/paravirt_types.h +10 -8
@@ -89,7 +89,7 @@ struct pv_init_ops {*/ unsigned (*patch)(u8 type,u16 clobber,void *insnbuf,unsigned long addr,unsigned len); -}; +} __no_randomize_layout;struct pv_lazy_ops {
@@ -97,12 +97,12 @@ struct pv_lazy_ops {void (*enter)(void );void (*leave)(void );void (*flush)(void ); -}; +} __no_randomize_layout;struct pv_time_ops {unsigned long long (*sched_clock)(void );unsigned long long (*steal_clock)(int cpu); -}; +} __no_randomize_layout;struct pv_cpu_ops {/* hooks for various privileged instructions */
@@ -178,7 +178,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); -}; +} __no_randomize_layout;struct pv_irq_ops {/*
@@ -201,7 +201,7 @@ struct pv_irq_ops {#ifdef CONFIG_X86_64 void (*adjust_exception_frame)(void );#endif -}; +} __no_randomize_layout;struct pv_mmu_ops {unsigned long (*read_cr2)(void );
@@ -296,7 +296,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); -}; +} __no_randomize_layout;struct arch_spinlock ;#ifdef CONFIG_SMP
@@ -322,7 +322,9 @@ struct pv_lock_ops {/* This contains all the paravirt structures: we get a convenient * number for each function using the offset which we use to indicate -* what to patch. */ +* what to patch. +* shouldn't be randomized due to the "NEAT TRICK" in paravirt.c +*/ struct paravirt_patch_template {struct pv_init_ops pv_init_ops;struct pv_time_ops pv_time_ops;
@@ -330,7 +332,7 @@ struct paravirt_patch_template {struct pv_irq_ops pv_irq_ops;struct pv_mmu_ops pv_mmu_ops;struct pv_lock_ops pv_lock_ops; -}; +} __no_randomize_layout;extern struct pv_info pv_info;extern struct pv_init_ops pv_init_ops;
drivers/acpi/acpica/hwxfsleep.c +6 -5
@@ -70,11 +70,12 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), - acpi_hw_extended_sleep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), - acpi_hw_extended_wake_prep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), acpi_hw_extended_wake} + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), + .extended_function = acpi_hw_extended_sleep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), + .extended_function = acpi_hw_extended_wake_prep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), + .extended_function = acpi_hw_extended_wake} };/*
drivers/block/cciss.h +15 -15
@@ -402,27 +402,27 @@ static bool SA5_performant_intr_pending(ctlr_info_t *h) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_fifo_full, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5B_access = { - SA5_submit_command, - SA5B_intr_mask, - SA5_fifo_full, - SA5B_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5B_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5B_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_fifo_full, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {
drivers/gpu/drm/nouveau/nouveau_ttm.c +14 -14
@@ -107,10 +107,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func nouveau_vram_manager = { - nouveau_vram_manager_init, - nouveau_vram_manager_fini, - nouveau_vram_manager_new, - nouveau_vram_manager_del, + .init = nouveau_vram_manager_init, + .takedown = nouveau_vram_manager_fini, + .get_node = nouveau_vram_manager_new, + .put_node = nouveau_vram_manager_del, }; static int
@@ -183,11 +183,11 @@ nouveau_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nouveau_gart_manager = { - nouveau_gart_manager_init, - nouveau_gart_manager_fini, - nouveau_gart_manager_new, - nouveau_gart_manager_del, - nouveau_gart_manager_debug + .init = nouveau_gart_manager_init, + .takedown = nouveau_gart_manager_fini, + .get_node = nouveau_gart_manager_new, + .put_node = nouveau_gart_manager_del, + .debug = nouveau_gart_manager_debug };/*XXX*/
@@ -256,11 +256,11 @@ nv04_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nv04_gart_manager = { - nv04_gart_manager_init, - nv04_gart_manager_fini, - nv04_gart_manager_new, - nv04_gart_manager_del, - nv04_gart_manager_debug + .init = nv04_gart_manager_init, + .takedown = nv04_gart_manager_fini, + .get_node = nv04_gart_manager_new, + .put_node = nv04_gart_manager_del, + .debug = nv04_gart_manager_debug };int
drivers/gpu/drm/ttm/ttm_bo_manager.c +5 -5
@@ -148,10 +148,10 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func ttm_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug };EXPORT_SYMBOL (ttm_bo_manager_func);
drivers/gpu/drm/virtio/virtgpu_ttm.c +5 -5
@@ -198,11 +198,11 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }static const struct ttm_mem_type_manager_func virtio_gpu_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug }; static int virtio_gpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +5 -5
@@ -164,9 +164,9 @@ static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func vmw_gmrid_manager_func = { - vmw_gmrid_man_init, - vmw_gmrid_man_takedown, - vmw_gmrid_man_get_node, - vmw_gmrid_man_put_node, - vmw_gmrid_man_debug + .init = vmw_gmrid_man_init, + .takedown = vmw_gmrid_man_takedown, + .get_node = vmw_gmrid_man_get_node, + .put_node = vmw_gmrid_man_put_node, + .debug = vmw_gmrid_man_debug };
drivers/infiniband/hw/nes/nes_cm.c +11 -11
@@ -135,17 +135,17 @@ static void record_ird_ord(struct nes_cm_node *, u16, u16);/* instance of function pointers for client API */ /* set address of this instance to cm_core->cm_ops at cm_core alloc */ static const struct nes_cm_ops nes_cm_api = { - mini_cm_accelerated, - mini_cm_listen, - mini_cm_del_listen, - mini_cm_connect, - mini_cm_close, - mini_cm_accept, - mini_cm_reject, - mini_cm_recv_pkt, - mini_cm_dealloc_core, - mini_cm_get, - mini_cm_set + .accelerated = mini_cm_accelerated, + .listen = mini_cm_listen, + .stop_listener = mini_cm_del_listen, + .connect = mini_cm_connect, + .close = mini_cm_close, + .accept = mini_cm_accept, + .reject = mini_cm_reject, + .recv_pkt = mini_cm_recv_pkt, + .destroy_cm_core = mini_cm_dealloc_core, + .get = mini_cm_get, + .set = mini_cm_set };static struct nes_cm_core *g_cm_core;
drivers/isdn/gigaset/bas-gigaset.c +16 -16
@@ -2565,22 +2565,22 @@ static int gigaset_post_reset(struct usb_interface *intf)static const struct gigaset_ops gigops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_isoc_send_skb, - gigaset_isoc_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_isoc_send_skb, + .handle_input = gigaset_isoc_input, };/* bas_gigaset_init
drivers/isdn/gigaset/ser-gigaset.c +16 -16
@@ -445,22 +445,22 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb,/* asyncdata.c */ - gigaset_m10x_input,/* asyncdata.c */ + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb,/* asyncdata.c */ + .handle_input = gigaset_m10x_input,/* asyncdata.c */ };
drivers/isdn/gigaset/usb-gigaset.c +16 -16
@@ -862,22 +862,22 @@ static int gigaset_pre_reset(struct usb_interface *intf) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb, - gigaset_m10x_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb, + .handle_input = gigaset_m10x_input, };/*
drivers/isdn/i4l/isdn_concap.c +3 -3
@@ -80,9 +80,9 @@ static int isdn_concap_dl_disconn_req(struct concap_proto *concap) }struct concap_device_ops isdn_concap_reliable_dl_dops = { - &isdn_concap_dl_data_req, - &isdn_concap_dl_connect_req, - &isdn_concap_dl_disconn_req + .data_req = &isdn_concap_dl_data_req, + .connect_req = &isdn_concap_dl_connect_req, + .disconn_req = &isdn_concap_dl_disconn_req };/* The following should better go into a dedicated source file such that
drivers/isdn/i4l/isdn_x25iface.c +8 -8
@@ -53,14 +53,14 @@ static int isdn_x25iface_disconn_ind(struct concap_proto *);static struct concap_proto_ops ix25_pops = { - &isdn_x25iface_proto_new, - &isdn_x25iface_proto_del, - &isdn_x25iface_proto_restart, - &isdn_x25iface_proto_close, - &isdn_x25iface_xmit, - &isdn_x25iface_receive, - &isdn_x25iface_connect_ind, - &isdn_x25iface_disconn_ind + .proto_new = &isdn_x25iface_proto_new, + .proto_del = &isdn_x25iface_proto_del, + .restart = &isdn_x25iface_proto_restart, + .close = &isdn_x25iface_proto_close, + .encap_and_xmit = &isdn_x25iface_xmit, + .data_ind = &isdn_x25iface_receive, + .connect_ind = &isdn_x25iface_connect_ind, + .disconn_ind = &isdn_x25iface_disconn_ind };/* error message helper function */
drivers/media/pci/solo6x10/solo6x10-g723.c +1 -1
@@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)int solo_g723_init (struct solo_dev *solo_dev) { -static struct snd_device_ops ops = {NULL }; +static struct snd_device_ops ops = { };struct snd_card *card;struct snd_kcontrol_new kctl;char name[32 ];
drivers/net/ethernet/brocade/bna/bna_enet.c +4 -4
@@ -1676,10 +1676,10 @@ bna_cb_ioceth_reset(void *arg) }static struct bfa_ioc_cbfn bna_ioceth_cbfn = { - bna_cb_ioceth_enable, - bna_cb_ioceth_disable, - bna_cb_ioceth_hbfail, - bna_cb_ioceth_reset + .enable_cbfn = bna_cb_ioceth_enable, + .disable_cbfn = bna_cb_ioceth_disable, + .hbfail_cbfn = bna_cb_ioceth_hbfail, + .reset_cbfn = bna_cb_ioceth_reset };static void bna_attr_init (struct bna_ioceth *ioceth)
drivers/net/wan/lmc/lmc_media.c +49 -48
111 lines not on this page · raw message
drivers/scsi/bfa/bfa_fcs.c +15 -4
@@ -39,10 +39,21 @@ struct bfa_fcs_mod_s {#define BFA_FCS_MODULE (_mod) { _mod ## _modinit, _mod ## _modexit }static struct bfa_fcs_mod_s fcs_modules[] = { - { bfa_fcs_port_attach,NULL ,NULL }, - { bfa_fcs_uf_attach,NULL ,NULL }, - { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit, - bfa_fcs_fabric_modexit }, + { + .attach = bfa_fcs_port_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_uf_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_fabric_attach, + .modinit = bfa_fcs_fabric_modinit, + .modexit = bfa_fcs_fabric_modexit + }, };/*
drivers/scsi/bfa/bfa_fcs_lport.c +20 -9
@@ -90,15 +90,26 @@ static struct {void (*offline) (struct bfa_fcs_lport_s *port); } __port_action[] = { { - bfa_fcs_lport_unknown_init, bfa_fcs_lport_unknown_online, - bfa_fcs_lport_unknown_offline}, { - bfa_fcs_lport_fab_init, bfa_fcs_lport_fab_online, - bfa_fcs_lport_fab_offline}, { - bfa_fcs_lport_n2n_init, bfa_fcs_lport_n2n_online, - bfa_fcs_lport_n2n_offline}, { - bfa_fcs_lport_loop_init, bfa_fcs_lport_loop_online, - bfa_fcs_lport_loop_offline}, - }; + .init = bfa_fcs_lport_unknown_init, + .online = bfa_fcs_lport_unknown_online, + .offline = bfa_fcs_lport_unknown_offline + }, + { + .init = bfa_fcs_lport_fab_init, + .online = bfa_fcs_lport_fab_online, + .offline = bfa_fcs_lport_fab_offline + }, + { + .init = bfa_fcs_lport_n2n_init, + .online = bfa_fcs_lport_n2n_online, + .offline = bfa_fcs_lport_n2n_offline + }, + { + .init = bfa_fcs_lport_loop_init, + .online = bfa_fcs_lport_loop_online, + .offline = bfa_fcs_lport_loop_offline + }, +}; /* * fcs_port_sm FCS logical port state machine
drivers/scsi/bfa/bfa_modules.h +6 -6
@@ -79,12 +79,12 @@ enum { \ extern struct bfa_module_s hal_mod_ ## __mod; \ struct bfa_module_s hal_mod_ ## __mod = { \ - bfa_ ## __mod ## _meminfo, \ - bfa_ ## __mod ## _attach, \ - bfa_ ## __mod ## _detach, \ - bfa_ ## __mod ## _start, \ - bfa_ ## __mod ## _stop, \ - bfa_ ## __mod ## _iocdisable, \ + .meminfo = bfa_ ## __mod ## _meminfo, \ + .attach = bfa_ ## __mod ## _attach, \ + .detach = bfa_ ## __mod ## _detach, \ + .start = bfa_ ## __mod ## _start, \ + .stop = bfa_ ## __mod ## _stop, \ + .iocdisable = bfa_ ## __mod ## _iocdisable, \ }#define BFA_CACHELINE_SZ (256)
drivers/scsi/hpsa.h +20 -20
@@ -577,38 +577,38 @@ static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_ioaccel_mode1_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_ioaccel_mode1_intr_pending, - SA5_ioaccel_mode1_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_ioaccel_mode1_intr_pending, + .command_completed = SA5_ioaccel_mode1_completed, };static struct access_method SA5_ioaccel_mode2_access = { - SA5_submit_command_ioaccel2, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_ioaccel2, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access_no_read = { - SA5_submit_command_no_read, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_no_read, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {
drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +1 -1
@@ -147,7 +147,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,int added = (mode ==LCK_NL );int overlaps =0 ;int splitted =0 ; -const struct ldlm_callback_suite null_cbs = {NULL }; +const struct ldlm_callback_suite null_cbs = { }; CDEBUG(D_DLMTRACE, "flags %#llx owner %llu pid %u mode %u start %llu end %llu\n",
drivers/staging/lustre/lustre/libcfs/module.c +5 -5
@@ -322,11 +322,11 @@ out: }struct cfs_psdev_ops libcfs_psdev_ops = { - libcfs_psdev_open, - libcfs_psdev_release, -NULL , -NULL , - libcfs_ioctl + .p_open = libcfs_psdev_open, + .p_close = libcfs_psdev_release, + .p_read =NULL , + .p_write =NULL , + .p_ioctl = libcfs_ioctl }; static int proc_call_handler(void *data, int write, loff_t *ppos,
drivers/video/fbdev/matrox/matroxfb_DAC1064.c +8 -2
@@ -1088,14 +1088,20 @@ static void MGAG100_restore(struct matrox_fb_info *minfo)#ifdef CONFIG_FB_MATROX_MYSTIQUE struct matrox_switch matrox_mystique = { - MGA1064_preinit, MGA1064_reset, MGA1064_init, MGA1064_restore, + .preinit = MGA1064_preinit, + .reset = MGA1064_reset, + .init = MGA1064_init, + .restore = MGA1064_restore, };EXPORT_SYMBOL (matrox_mystique);#endif #ifdef CONFIG_FB_MATROX_G struct matrox_switch matrox_G100 = { - MGAG100_preinit, MGAG100_reset, MGAG100_init, MGAG100_restore, + .preinit = MGAG100_preinit, + .reset = MGAG100_reset, + .init = MGAG100_init, + .restore = MGAG100_restore, };EXPORT_SYMBOL (matrox_G100);#endif
drivers/video/fbdev/matrox/matroxfb_Ti3026.c +4 -1
@@ -738,7 +738,10 @@ static int Ti3026_preinit(struct matrox_fb_info *minfo) }struct matrox_switch matrox_millennium = { - Ti3026_preinit, Ti3026_reset, Ti3026_init, Ti3026_restore + .preinit = Ti3026_preinit, + .reset = Ti3026_reset, + .init = Ti3026_init, + .restore = Ti3026_restore };EXPORT_SYMBOL (matrox_millennium);#endif
fs/reiserfs/item_ops.c +12 -12
@@ -724,18 +724,18 @@ static void errcatch_print_vi(struct virtual_item *vi) }static struct item_operations errcatch_ops = { - errcatch_bytes_number, - errcatch_decrement_key, - errcatch_is_left_mergeable, - errcatch_print_item, - errcatch_check_item, - - errcatch_create_vi, - errcatch_check_left, - errcatch_check_right, - errcatch_part_size, - errcatch_unit_num, - errcatch_print_vi + .bytes_number = errcatch_bytes_number, + .decrement_key = errcatch_decrement_key, + .is_left_mergeable = errcatch_is_left_mergeable, + .print_item = errcatch_print_item, + .check_item = errcatch_check_item, + + .create_vi = errcatch_create_vi, + .check_left = errcatch_check_left, + .check_right = errcatch_check_right, + .part_size = errcatch_part_size, + .unit_num = errcatch_unit_num, + .print_vi = errcatch_print_vi };#if ! (TYPE_STAT_DATA ==0 &&TYPE_INDIRECT ==1 &&TYPE_DIRECT ==2 &&TYPE_DIRENTRY ==3 )
include/linux/rbtree_augmented.h +3 -1
@@ -90,7 +90,9 @@ rbname ## _rotate(struct rb_node *rb_old, struct rb_node *rb_new) \ old->rbaugmented =rbcompute (old); \ } \ rbstatic const struct rb_augment_callbacks rbname = { \ - rbname ## _propagate, rbname ## _copy, rbname ## _rotate \ + .propagate = rbname ## _propagate, \ + .copy = rbname ## _copy, \ + .rotate = rbname ## _rotate \ };
lib/rbtree.c +3 -1
@@ -412,7 +412,9 @@ static inline void dummy_copy(struct rb_node *old, struct rb_node *new) {}static inline void dummy_rotate (struct rb_node *old,struct rb_node *new) {}static const struct rb_augment_callbacks dummy_callbacks = { - dummy_propagate, dummy_copy, dummy_rotate + .propagate = dummy_propagate, + .copy = dummy_copy, + .rotate = dummy_rotate };void rb_insert_color (struct rb_node *node,struct rb_root *root)
mm/page_alloc.c +1 -1
@@ -561,7 +561,7 @@ static inline void clear_page_guard(struct zone *zone, struct page *page,__mod_zone_freepage_state (zone, (1 << order), migratetype); }#else -struct page_ext_operations debug_guardpage_ops = {NULL , }; +struct page_ext_operations debug_guardpage_ops = { .need =NULL , .init =NULL };static inline void set_page_guard (struct zone *zone,struct page *page,unsigned int order,int migratetype) {} static inline void clear_page_guard(struct zone *zone, struct page *page,
net/atm/lec.c +3 -3
@@ -111,9 +111,9 @@ static inline void lec_arp_put(struct lec_arp_table *entry) }static struct lane2_ops lane2_ops = { - lane2_resolve,/* resolve, spec 3.1.3 */ - lane2_associate_req,/* associate_req, spec 3.1.4 */ -NULL /* associate indicator, spec 3.1.5 */ + .resolve = lane2_resolve, + .associate_req = lane2_associate_req, + .associate_indicator =NULL };static unsigned char bus_mac[ETH_ALEN ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };
net/atm/mpoa_caches.c +20 -21
50 lines not on this page · raw message
net/vmw_vsock/vmci_transport_notify.c +15 -15
@@ -662,19 +662,19 @@ static void vmci_transport_notify_pkt_process_negotiate(struct sock *sk)/* Socket control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };
net/vmw_vsock/vmci_transport_notify_qstate.c +15 -15
@@ -420,19 +420,19 @@ vmci_transport_notify_pkt_send_pre_enqueue(/* Socket always on control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };
sound/synth/emux/emux_seq.c +7 -7
@@ -33,13 +33,13 @@ static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *inf* MIDI emulation operators */ static struct snd_midi_op emux_ops = { - snd_emux_note_on, - snd_emux_note_off, - snd_emux_key_press, - snd_emux_terminate_note, - snd_emux_control, - snd_emux_nrpn, - snd_emux_sysex, + .note_on = snd_emux_note_on, + .note_off = snd_emux_note_off, + .key_press = snd_emux_key_press, + .note_terminate = snd_emux_terminate_note, + .control = snd_emux_control, + .nrpn = snd_emux_nrpn, + .sysex = snd_emux_sysex, };
Signature · 1 line
1.9.1
[kernel-hardening] Re: [RFC 3/3] Change initialization C99 style; tag no_ramdomize_layout structs
Quoted 9 lines · Michael Leibowitz
Due to randomization of structs, the in order struct intialization style is replaced with explicit field style.
struct
foo_tmy_foo= {
one,
two,
three
};
Quoted 7 lines
becomes
struct foo_t my_foo = { .one = one, .two = two, .three = three };
Can a coccinelle script be written to do this also? It might be useful to keep that around.
Quoted 3 lines
Additionally, tag paravirt related structures to explicitly not be randomized, as the structure layout is important.
This might need to be split out? It's logically separate. Also, I think this needs to come before the plugin, since the plugin isn't usable until this patch is in place.
-Kees
Quoted 1,175 lines
This feature is ported over from grsecurity. This is largely unchanged from the Original code written by the PaX Team and Spender.
Signed-off-by Michael Leibowitz <[email protected]>--- arch/x86/include/asm/floppy.h | 20 ++--- arch/x86/include/asm/paravirt_types.h | 18 +++-- drivers/acpi/acpica/hwxfsleep.c | 11 +-- drivers/block/cciss.h | 30 ++++---- drivers/gpu/drm/nouveau/nouveau_ttm.c | 28 +++---- drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 +-- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 10 +-- drivers/infiniband/hw/nes/nes_cm.c | 22 +++--- drivers/isdn/gigaset/bas-gigaset.c | 32 ++++---- drivers/isdn/gigaset/ser-gigaset.c | 32 ++++---- drivers/isdn/gigaset/usb-gigaset.c | 32 ++++---- drivers/isdn/i4l/isdn_concap.c | 6 +- drivers/isdn/i4l/isdn_x25iface.c | 16 ++-- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- drivers/net/ethernet/brocade/bna/bna_enet.c | 8 +- drivers/net/wan/lmc/lmc_media.c | 97 +++++++++++++------------ drivers/scsi/bfa/bfa_fcs.c | 19 ++++- drivers/scsi/bfa/bfa_fcs_lport.c | 29 +++++--- drivers/scsi/bfa/bfa_modules.h | 12 +-- drivers/scsi/hpsa.h | 40 +++++----- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 10 +-- drivers/video/fbdev/matrox/matroxfb_DAC1064.c | 10 ++- drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 5 +- fs/reiserfs/item_ops.c | 24 +++--- include/linux/rbtree_augmented.h | 4 +- lib/rbtree.c | 4 +- mm/page_alloc.c | 2 +- net/atm/lec.c | 6 +- net/atm/mpoa_caches.c | 41 +++++------ net/vmw_vsock/vmci_transport_notify.c | 30 ++++---- net/vmw_vsock/vmci_transport_notify_qstate.c | 30 ++++---- sound/synth/emux/emux_seq.c | 14 ++-- 34 files changed, 352 insertions(+), 314 deletions(-)arch/x86/include/asm/floppy.h +10
-10@@ -229,18 +229,18 @@ static struct fd_routine_l {int (*_dma_setup)(char *addr,unsigned long size,int mode,int io); } fd_routine[] = { { - request_dma, - free_dma, - get_dma_residue, - dma_mem_alloc, - hard_dma_setup + ._request_dma = request_dma, + ._free_dma = free_dma, + ._get_dma_residue = get_dma_residue, + ._dma_mem_alloc = dma_mem_alloc, + ._dma_setup = hard_dma_setup }, { - vdma_request_dma, - vdma_nop, - vdma_get_dma_residue, - vdma_mem_alloc, - vdma_dma_setup + ._request_dma = vdma_request_dma, + ._free_dma = vdma_nop, + ._get_dma_residue = vdma_get_dma_residue, + ._dma_mem_alloc = vdma_mem_alloc, + ._dma_setup = vdma_dma_setup } };arch/x86/include/asm/paravirt_types.h +10
-8@@ -89,7 +89,7 @@ struct pv_init_ops {*/ unsigned (*patch)(u8 type,u16 clobber,void *insnbuf,unsigned long addr,unsigned len); -}; +} __no_randomize_layout;struct pv_lazy_ops {@@ -97,12 +97,12 @@ struct pv_lazy_ops {void (*enter)(void );void (*leave)(void );void (*flush)(void ); -}; +} __no_randomize_layout;struct pv_time_ops {unsigned long long (*sched_clock)(void );unsigned long long (*steal_clock)(int cpu); -}; +} __no_randomize_layout;struct pv_cpu_ops {/* hooks for various privileged instructions */ @@ -178,7 +178,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); -}; +} __no_randomize_layout;struct pv_irq_ops {/* @@ -201,7 +201,7 @@ struct pv_irq_ops {#ifdef CONFIG_X86_64 void (*adjust_exception_frame)(void );#endif -}; +} __no_randomize_layout;struct pv_mmu_ops {unsigned long (*read_cr2)(void );@@ -296,7 +296,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); -}; +} __no_randomize_layout;struct arch_spinlock ;#ifdef CONFIG_SMP @@ -322,7 +322,9 @@ struct pv_lock_ops {/* This contains all the paravirt structures: we get a convenient * number for each function using the offset which we use to indicate -* what to patch. */ +* what to patch. +* shouldn't be randomized due to the "NEAT TRICK" in paravirt.c +*/ struct paravirt_patch_template {struct pv_init_ops pv_init_ops;struct pv_time_ops pv_time_ops;@@ -330,7 +332,7 @@ struct paravirt_patch_template {struct pv_irq_ops pv_irq_ops;struct pv_mmu_ops pv_mmu_ops;struct pv_lock_ops pv_lock_ops; -}; +} __no_randomize_layout;extern struct pv_info pv_info;extern struct pv_init_ops pv_init_ops;drivers/acpi/acpica/hwxfsleep.c +6
-5@@ -70,11 +70,12 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), - acpi_hw_extended_sleep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), - acpi_hw_extended_wake_prep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), acpi_hw_extended_wake} + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), + .extended_function = acpi_hw_extended_sleep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), + .extended_function = acpi_hw_extended_wake_prep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), + .extended_function = acpi_hw_extended_wake} };/* drivers/block/cciss.h +15
-15@@ -402,27 +402,27 @@ static bool SA5_performant_intr_pending(ctlr_info_t *h) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_fifo_full, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5B_access = { - SA5_submit_command, - SA5B_intr_mask, - SA5_fifo_full, - SA5B_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5B_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5B_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_fifo_full, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/gpu/drm/nouveau/nouveau_ttm.c +14
-14@@ -107,10 +107,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func nouveau_vram_manager = { - nouveau_vram_manager_init, - nouveau_vram_manager_fini, - nouveau_vram_manager_new, - nouveau_vram_manager_del, + .init = nouveau_vram_manager_init, + .takedown = nouveau_vram_manager_fini, + .get_node = nouveau_vram_manager_new, + .put_node = nouveau_vram_manager_del, }; static int@@ -183,11 +183,11 @@ nouveau_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nouveau_gart_manager = { - nouveau_gart_manager_init, - nouveau_gart_manager_fini, - nouveau_gart_manager_new, - nouveau_gart_manager_del, - nouveau_gart_manager_debug + .init = nouveau_gart_manager_init, + .takedown = nouveau_gart_manager_fini, + .get_node = nouveau_gart_manager_new, + .put_node = nouveau_gart_manager_del, + .debug = nouveau_gart_manager_debug };/*XXX*/ @@ -256,11 +256,11 @@ nv04_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nv04_gart_manager = { - nv04_gart_manager_init, - nv04_gart_manager_fini, - nv04_gart_manager_new, - nv04_gart_manager_del, - nv04_gart_manager_debug + .init = nv04_gart_manager_init, + .takedown = nv04_gart_manager_fini, + .get_node = nv04_gart_manager_new, + .put_node = nv04_gart_manager_del, + .debug = nv04_gart_manager_debug };int drivers/gpu/drm/ttm/ttm_bo_manager.c +5
-5@@ -148,10 +148,10 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func ttm_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug };EXPORT_SYMBOL (ttm_bo_manager_func);drivers/gpu/drm/virtio/virtgpu_ttm.c +5
-5@@ -198,11 +198,11 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }static const struct ttm_mem_type_manager_func virtio_gpu_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug }; static int virtio_gpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +5
-5@@ -164,9 +164,9 @@ static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func vmw_gmrid_manager_func = { - vmw_gmrid_man_init, - vmw_gmrid_man_takedown, - vmw_gmrid_man_get_node, - vmw_gmrid_man_put_node, - vmw_gmrid_man_debug + .init = vmw_gmrid_man_init, + .takedown = vmw_gmrid_man_takedown, + .get_node = vmw_gmrid_man_get_node, + .put_node = vmw_gmrid_man_put_node, + .debug = vmw_gmrid_man_debug };drivers/infiniband/hw/nes/nes_cm.c +11
-11@@ -135,17 +135,17 @@ static void record_ird_ord(struct nes_cm_node *, u16, u16);/* instance of function pointers for client API */ /* set address of this instance to cm_core->cm_ops at cm_core alloc */ static const struct nes_cm_ops nes_cm_api = { - mini_cm_accelerated, - mini_cm_listen, - mini_cm_del_listen, - mini_cm_connect, - mini_cm_close, - mini_cm_accept, - mini_cm_reject, - mini_cm_recv_pkt, - mini_cm_dealloc_core, - mini_cm_get, - mini_cm_set + .accelerated = mini_cm_accelerated, + .listen = mini_cm_listen, + .stop_listener = mini_cm_del_listen, + .connect = mini_cm_connect, + .close = mini_cm_close, + .accept = mini_cm_accept, + .reject = mini_cm_reject, + .recv_pkt = mini_cm_recv_pkt, + .destroy_cm_core = mini_cm_dealloc_core, + .get = mini_cm_get, + .set = mini_cm_set };static struct nes_cm_core *g_cm_core;drivers/isdn/gigaset/bas-gigaset.c +16
-16@@ -2565,22 +2565,22 @@ static int gigaset_post_reset(struct usb_interface *intf)static const struct gigaset_ops gigops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_isoc_send_skb, - gigaset_isoc_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_isoc_send_skb, + .handle_input = gigaset_isoc_input, };/* bas_gigaset_init drivers/isdn/gigaset/ser-gigaset.c +16
-16@@ -445,22 +445,22 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb,/* asyncdata.c */ - gigaset_m10x_input,/* asyncdata.c */ + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb,/* asyncdata.c */ + .handle_input = gigaset_m10x_input,/* asyncdata.c */ };drivers/isdn/gigaset/usb-gigaset.c +16
-16@@ -862,22 +862,22 @@ static int gigaset_pre_reset(struct usb_interface *intf) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb, - gigaset_m10x_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb, + .handle_input = gigaset_m10x_input, };/* drivers/isdn/i4l/isdn_concap.c +3
-3@@ -80,9 +80,9 @@ static int isdn_concap_dl_disconn_req(struct concap_proto *concap) }struct concap_device_ops isdn_concap_reliable_dl_dops = { - &isdn_concap_dl_data_req, - &isdn_concap_dl_connect_req, - &isdn_concap_dl_disconn_req + .data_req = &isdn_concap_dl_data_req, + .connect_req = &isdn_concap_dl_connect_req, + .disconn_req = &isdn_concap_dl_disconn_req };/* The following should better go into a dedicated source file such that drivers/isdn/i4l/isdn_x25iface.c +8
-8@@ -53,14 +53,14 @@ static int isdn_x25iface_disconn_ind(struct concap_proto *);static struct concap_proto_ops ix25_pops = { - &isdn_x25iface_proto_new, - &isdn_x25iface_proto_del, - &isdn_x25iface_proto_restart, - &isdn_x25iface_proto_close, - &isdn_x25iface_xmit, - &isdn_x25iface_receive, - &isdn_x25iface_connect_ind, - &isdn_x25iface_disconn_ind + .proto_new = &isdn_x25iface_proto_new, + .proto_del = &isdn_x25iface_proto_del, + .restart = &isdn_x25iface_proto_restart, + .close = &isdn_x25iface_proto_close, + .encap_and_xmit = &isdn_x25iface_xmit, + .data_ind = &isdn_x25iface_receive, + .connect_ind = &isdn_x25iface_connect_ind, + .disconn_ind = &isdn_x25iface_disconn_ind };/* error message helper function */ drivers/media/pci/solo6x10/solo6x10-g723.c +1
-1@@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)int solo_g723_init (struct solo_dev *solo_dev) { -static struct snd_device_ops ops = {NULL }; +static struct snd_device_ops ops = { };struct snd_card *card;struct snd_kcontrol_new kctl;char name[32 ];drivers/net/ethernet/brocade/bna/bna_enet.c +4
-4@@ -1676,10 +1676,10 @@ bna_cb_ioceth_reset(void *arg) }static struct bfa_ioc_cbfn bna_ioceth_cbfn = { - bna_cb_ioceth_enable, - bna_cb_ioceth_disable, - bna_cb_ioceth_hbfail, - bna_cb_ioceth_reset + .enable_cbfn = bna_cb_ioceth_enable, + .disable_cbfn = bna_cb_ioceth_disable, + .hbfail_cbfn = bna_cb_ioceth_hbfail, + .reset_cbfn = bna_cb_ioceth_reset };static void bna_attr_init (struct bna_ioceth *ioceth)drivers/net/wan/lmc/lmc_media.c +49
-48@@ -95,62 +95,63 @@ static inline void write_av9110_bit (lmc_softc_t *, int);static void write_av9110 (lmc_softc_t *,u32 ,u32 ,u32 ,u32 ,u32 );lmc_media_t lmc_ds3_media = { - lmc_ds3_init,/* special media init stuff */ - lmc_ds3_default,/* reset to default state */ - lmc_ds3_set_status,/* reset status to state provided */ - lmc_dummy_set_1,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_ds3_set_100ft,/* set cable length */ - lmc_ds3_set_scram,/* set scrambler */ - lmc_ds3_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_ds3_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ds3_watchdog + .init = lmc_ds3_init,/* special media init stuff */ + .defaults = lmc_ds3_default,/* reset to default state */ + .set_status = lmc_ds3_set_status,/* reset status to state provided */ + .set_clock_source = lmc_dummy_set_1,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_ds3_set_100ft,/* set cable length */ + .set_scrambler = lmc_ds3_set_scram,/* set scrambler */ + .get_link_status = lmc_ds3_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_ds3_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ds3_watchdog };lmc_media_t lmc_hssi_media = { - lmc_hssi_init,/* special media init stuff */ - lmc_hssi_default,/* reset to default state */ - lmc_hssi_set_status,/* reset status to state provided */ - lmc_hssi_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_hssi_get_link_status,/* get link status */ - lmc_hssi_set_link_status,/* set link status */ - lmc_hssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_hssi_watchdog + .init = lmc_hssi_init,/* special media init stuff */ + .defaults = lmc_hssi_default,/* reset to default state */ + .set_status = lmc_hssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_hssi_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_hssi_get_link_status,/* get link status */ + .set_link_status = lmc_hssi_set_link_status,/* set link status */ + .set_crc_length = lmc_hssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_hssi_watchdog }; -lmc_media_t lmc_ssi_media = { lmc_ssi_init,/* special media init stuff */ - lmc_ssi_default,/* reset to default state */ - lmc_ssi_set_status,/* reset status to state provided */ - lmc_ssi_set_clock,/* set clock source */ - lmc_ssi_set_speed,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_ssi_get_link_status,/* get link status */ - lmc_ssi_set_link_status,/* set link status */ - lmc_ssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ssi_watchdog +lmc_media_t lmc_ssi_media = { + .init = lmc_ssi_init,/* special media init stuff */ + .defaults = lmc_ssi_default,/* reset to default state */ + .set_status = lmc_ssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_ssi_set_clock,/* set clock source */ + .set_speed = lmc_ssi_set_speed,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_ssi_get_link_status,/* get link status */ + .set_link_status = lmc_ssi_set_link_status,/* set link status */ + .set_crc_length = lmc_ssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ssi_watchdog };lmc_media_t lmc_t1_media = { - lmc_t1_init,/* special media init stuff */ - lmc_t1_default,/* reset to default state */ - lmc_t1_set_status,/* reset status to state provided */ - lmc_t1_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_t1_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_t1_set_crc_length,/* set CRC length */ - lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ - lmc_t1_watchdog + .init = lmc_t1_init,/* special media init stuff */ + .defaults = lmc_t1_default,/* reset to default state */ + .set_status = lmc_t1_set_status,/* reset status to state provided */ + .set_clock_source = lmc_t1_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_t1_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_t1_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ + .watchdog = lmc_t1_watchdog }; static voiddrivers/scsi/bfa/bfa_fcs.c +15
-4@@ -39,10 +39,21 @@ struct bfa_fcs_mod_s {#define BFA_FCS_MODULE (_mod) { _mod ## _modinit, _mod ## _modexit }static struct bfa_fcs_mod_s fcs_modules[] = { - { bfa_fcs_port_attach,NULL ,NULL }, - { bfa_fcs_uf_attach,NULL ,NULL }, - { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit, - bfa_fcs_fabric_modexit }, + { + .attach = bfa_fcs_port_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_uf_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_fabric_attach, + .modinit = bfa_fcs_fabric_modinit, + .modexit = bfa_fcs_fabric_modexit + }, };/* drivers/scsi/bfa/bfa_fcs_lport.c +20
-9@@ -90,15 +90,26 @@ static struct {void (*offline) (struct bfa_fcs_lport_s *port); } __port_action[] = { { - bfa_fcs_lport_unknown_init, bfa_fcs_lport_unknown_online, - bfa_fcs_lport_unknown_offline}, { - bfa_fcs_lport_fab_init, bfa_fcs_lport_fab_online, - bfa_fcs_lport_fab_offline}, { - bfa_fcs_lport_n2n_init, bfa_fcs_lport_n2n_online, - bfa_fcs_lport_n2n_offline}, { - bfa_fcs_lport_loop_init, bfa_fcs_lport_loop_online, - bfa_fcs_lport_loop_offline}, - }; + .init = bfa_fcs_lport_unknown_init, + .online = bfa_fcs_lport_unknown_online, + .offline = bfa_fcs_lport_unknown_offline + }, + { + .init = bfa_fcs_lport_fab_init, + .online = bfa_fcs_lport_fab_online, + .offline = bfa_fcs_lport_fab_offline + }, + { + .init = bfa_fcs_lport_n2n_init, + .online = bfa_fcs_lport_n2n_online, + .offline = bfa_fcs_lport_n2n_offline + }, + { + .init = bfa_fcs_lport_loop_init, + .online = bfa_fcs_lport_loop_online, + .offline = bfa_fcs_lport_loop_offline + }, +}; /* * fcs_port_sm FCS logical port state machinedrivers/scsi/bfa/bfa_modules.h +6
-6@@ -79,12 +79,12 @@ enum { \ extern struct bfa_module_s hal_mod_ ## __mod; \ struct bfa_module_s hal_mod_ ## __mod = { \ - bfa_ ## __mod ## _meminfo, \ - bfa_ ## __mod ## _attach, \ - bfa_ ## __mod ## _detach, \ - bfa_ ## __mod ## _start, \ - bfa_ ## __mod ## _stop, \ - bfa_ ## __mod ## _iocdisable, \ + .meminfo = bfa_ ## __mod ## _meminfo, \ + .attach = bfa_ ## __mod ## _attach, \ + .detach = bfa_ ## __mod ## _detach, \ + .start = bfa_ ## __mod ## _start, \ + .stop = bfa_ ## __mod ## _stop, \ + .iocdisable = bfa_ ## __mod ## _iocdisable, \ }#define BFA_CACHELINE_SZ (256)drivers/scsi/hpsa.h +20
-20@@ -577,38 +577,38 @@ static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_ioaccel_mode1_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_ioaccel_mode1_intr_pending, - SA5_ioaccel_mode1_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_ioaccel_mode1_intr_pending, + .command_completed = SA5_ioaccel_mode1_completed, };static struct access_method SA5_ioaccel_mode2_access = { - SA5_submit_command_ioaccel2, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_ioaccel2, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access_no_read = { - SA5_submit_command_no_read, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_no_read, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +1
-1@@ -147,7 +147,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,int added = (mode ==LCK_NL );int overlaps =0 ;int splitted =0 ; -const struct ldlm_callback_suite null_cbs = {NULL }; +const struct ldlm_callback_suite null_cbs = { }; CDEBUG(D_DLMTRACE, "flags %#llx owner %llu pid %u mode %u start %llu end %llu\n",drivers/staging/lustre/lustre/libcfs/module.c +5
-5@@ -322,11 +322,11 @@ out: }struct cfs_psdev_ops libcfs_psdev_ops = { - libcfs_psdev_open, - libcfs_psdev_release, -NULL , -NULL , - libcfs_ioctl + .p_open = libcfs_psdev_open, + .p_close = libcfs_psdev_release, + .p_read =NULL , + .p_write =NULL , + .p_ioctl = libcfs_ioctl }; static int proc_call_handler(void *data, int write, loff_t *ppos,drivers/video/fbdev/matrox/matroxfb_DAC1064.c +8
-2@@ -1088,14 +1088,20 @@ static void MGAG100_restore(struct matrox_fb_info *minfo)#ifdef CONFIG_FB_MATROX_MYSTIQUE struct matrox_switch matrox_mystique = { - MGA1064_preinit, MGA1064_reset, MGA1064_init, MGA1064_restore, + .preinit = MGA1064_preinit, + .reset = MGA1064_reset, + .init = MGA1064_init, + .restore = MGA1064_restore, };EXPORT_SYMBOL (matrox_mystique);#endif #ifdef CONFIG_FB_MATROX_G struct matrox_switch matrox_G100 = { - MGAG100_preinit, MGAG100_reset, MGAG100_init, MGAG100_restore, + .preinit = MGAG100_preinit, + .reset = MGAG100_reset, + .init = MGAG100_init, + .restore = MGAG100_restore, };EXPORT_SYMBOL (matrox_G100);#endif drivers/video/fbdev/matrox/matroxfb_Ti3026.c +4
-1@@ -738,7 +738,10 @@ static int Ti3026_preinit(struct matrox_fb_info *minfo) }struct matrox_switch matrox_millennium = { - Ti3026_preinit, Ti3026_reset, Ti3026_init, Ti3026_restore + .preinit = Ti3026_preinit, + .reset = Ti3026_reset, + .init = Ti3026_init, + .restore = Ti3026_restore };EXPORT_SYMBOL (matrox_millennium);#endif fs/reiserfs/item_ops.c +12
-12@@ -724,18 +724,18 @@ static void errcatch_print_vi(struct virtual_item *vi) }static struct item_operations errcatch_ops = { - errcatch_bytes_number, - errcatch_decrement_key, - errcatch_is_left_mergeable, - errcatch_print_item, - errcatch_check_item, - - errcatch_create_vi, - errcatch_check_left, - errcatch_check_right, - errcatch_part_size, - errcatch_unit_num, - errcatch_print_vi + .bytes_number = errcatch_bytes_number, + .decrement_key = errcatch_decrement_key, + .is_left_mergeable = errcatch_is_left_mergeable, + .print_item = errcatch_print_item, + .check_item = errcatch_check_item, + + .create_vi = errcatch_create_vi, + .check_left = errcatch_check_left, + .check_right = errcatch_check_right, + .part_size = errcatch_part_size, + .unit_num = errcatch_unit_num, + .print_vi = errcatch_print_vi };#if ! (TYPE_STAT_DATA ==0 &&TYPE_INDIRECT ==1 &&TYPE_DIRECT ==2 &&TYPE_DIRENTRY ==3 )include/linux/rbtree_augmented.h +3
-1@@ -90,7 +90,9 @@ rbname ## _rotate(struct rb_node *rb_old, struct rb_node *rb_new) \ old->rbaugmented =rbcompute (old); \ } \ rbstatic const struct rb_augment_callbacks rbname = { \ - rbname ## _propagate, rbname ## _copy, rbname ## _rotate \ + .propagate = rbname ## _propagate, \ + .copy = rbname ## _copy, \ + .rotate = rbname ## _rotate \ };lib/rbtree.c +3
-1@@ -412,7 +412,9 @@ static inline void dummy_copy(struct rb_node *old, struct rb_node *new) {}static inline void dummy_rotate (struct rb_node *old,struct rb_node *new) {}static const struct rb_augment_callbacks dummy_callbacks = { - dummy_propagate, dummy_copy, dummy_rotate + .propagate = dummy_propagate, + .copy = dummy_copy, + .rotate = dummy_rotate };void rb_insert_color (struct rb_node *node,struct rb_root *root)mm/page_alloc.c +1
-1@@ -561,7 +561,7 @@ static inline void clear_page_guard(struct zone *zone, struct page *page,__mod_zone_freepage_state (zone, (1 << order), migratetype); }#else -struct page_ext_operations debug_guardpage_ops = {NULL , }; +struct page_ext_operations debug_guardpage_ops = { .need =NULL , .init =NULL };static inline void set_page_guard (struct zone *zone,struct page *page,unsigned int order,int migratetype) {} static inline void clear_page_guard(struct zone *zone, struct page *page,net/atm/lec.c +3
-3@@ -111,9 +111,9 @@ static inline void lec_arp_put(struct lec_arp_table *entry) }static struct lane2_ops lane2_ops = { - lane2_resolve,/* resolve, spec 3.1.3 */ - lane2_associate_req,/* associate_req, spec 3.1.4 */ -NULL /* associate indicator, spec 3.1.5 */ + .resolve = lane2_resolve, + .associate_req = lane2_associate_req, + .associate_indicator =NULL };static unsigned char bus_mac[ETH_ALEN ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };net/atm/mpoa_caches.c +20
-21@@ -535,30 +535,29 @@ static void eg_destroy_cache(struct mpoa_client *mpc)static const struct in_cache_ops ingress_ops = { - in_cache_add_entry,/* add_entry */ - in_cache_get,/* get */ - in_cache_get_with_mask,/* get_with_mask */ - in_cache_get_by_vcc,/* get_by_vcc */ - in_cache_put,/* put */ - in_cache_remove_entry,/* remove_entry */ - cache_hit,/* cache_hit */ - clear_count_and_expired,/* clear_count */ - check_resolving_entries,/* check_resolving */ - refresh_entries,/* refresh */ - in_destroy_cache/* destroy_cache */ + .add_entry = in_cache_add_entry, + .get = in_cache_get, + .get_with_mask = in_cache_get_with_mask, + .get_by_vcc = in_cache_get_by_vcc, + .put = in_cache_put, + .remove_entry = in_cache_remove_entry, + .cache_hit = cache_hit, + .clear_count = clear_count_and_expired, + .check_resolving = check_resolving_entries, + .refresh = refresh_entries, };static const struct eg_cache_ops egress_ops = { - eg_cache_add_entry,/* add_entry */ - eg_cache_get_by_cache_id,/* get_by_cache_id */ - eg_cache_get_by_tag,/* get_by_tag */ - eg_cache_get_by_vcc,/* get_by_vcc */ - eg_cache_get_by_src_ip,/* get_by_src_ip */ - eg_cache_put,/* put */ - eg_cache_remove_entry,/* remove_entry */ - update_eg_cache_entry,/* update */ - clear_expired,/* clear_expired */ - eg_destroy_cache/* destroy_cache */ + .add_entry = eg_cache_add_entry, + .get_by_cache_id = eg_cache_get_by_cache_id, + .get_by_tag = eg_cache_get_by_tag, + .get_by_vcc = eg_cache_get_by_vcc, + .get_by_src_ip = eg_cache_get_by_src_ip, + .put = eg_cache_put, + .remove_entry = eg_cache_remove_entry, + .update = update_eg_cache_entry, + .clear_expired = clear_expired, + .destroy_cache = eg_destroy_cache };net/vmw_vsock/vmci_transport_notify.c +15
-15@@ -662,19 +662,19 @@ static void vmci_transport_notify_pkt_process_negotiate(struct sock *sk)/* Socket control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };net/vmw_vsock/vmci_transport_notify_qstate.c +15
-15@@ -420,19 +420,19 @@ vmci_transport_notify_pkt_send_pre_enqueue(/* Socket always on control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };sound/synth/emux/emux_seq.c +7
-8@@ -33,13 +33,13 @@ static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *inf* MIDI emulation operators */ static struct snd_midi_op emux_ops = { - snd_emux_note_on, - snd_emux_note_off, - snd_emux_key_press, - snd_emux_terminate_note, - snd_emux_control, - snd_emux_nrpn, - snd_emux_sysex, + .note_on = snd_emux_note_on, + .note_off = snd_emux_note_off, + .key_press = snd_emux_key_press, + .note_terminate = snd_emux_terminate_note, + .control = snd_emux_control, + .nrpn = snd_emux_nrpn, + .sysex = snd_emux_sysex, }; --1.9.1
Signature · 2 lines
Kees Cook Chrome OS & Brillo Security
[kernel-hardening] Re: [RFC 3/3] Change initialization C99 style; tag no_ramdomize_layout structs
Quoted 13 lines · Kees Cook
Quoted 11 lines · Michael Leibowitz
Due to randomization of structs, the in order struct intialization style is replaced with explicit field style.
struct
foo_tmy_foo= {
one,
two,
three
};becomes
Quoted 8 lines
Quoted 5 lines
struct foo_t my_foo = { .one = one, .two = two, .three = three };Can a coccinelle script be written to do this also? It might be useful to keep that around.
Yes. I have such a script lying around. I'll ask my intern for this summer to check on it and get it integrated into the kernel.
julia
Quoted 1,192 lines
Quoted 3 lines
Additionally, tag paravirt related structures to explicitly not be randomized, as the structure layout is important.
This might need to be split out? It's logically separate. Also, I think this needs to come before the plugin, since the plugin isn't usable until this patch is in place.
-Kees
Quoted 1,175 lines
This feature is ported over from grsecurity. This is largely unchanged from the Original code written by the PaX Team and Spender.
Signed-off-by Michael Leibowitz <[email protected]>--- arch/x86/include/asm/floppy.h | 20 ++--- arch/x86/include/asm/paravirt_types.h | 18 +++-- drivers/acpi/acpica/hwxfsleep.c | 11 +-- drivers/block/cciss.h | 30 ++++---- drivers/gpu/drm/nouveau/nouveau_ttm.c | 28 +++---- drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 +-- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 10 +-- drivers/infiniband/hw/nes/nes_cm.c | 22 +++--- drivers/isdn/gigaset/bas-gigaset.c | 32 ++++---- drivers/isdn/gigaset/ser-gigaset.c | 32 ++++---- drivers/isdn/gigaset/usb-gigaset.c | 32 ++++---- drivers/isdn/i4l/isdn_concap.c | 6 +- drivers/isdn/i4l/isdn_x25iface.c | 16 ++-- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- drivers/net/ethernet/brocade/bna/bna_enet.c | 8 +- drivers/net/wan/lmc/lmc_media.c | 97 +++++++++++++------------ drivers/scsi/bfa/bfa_fcs.c | 19 ++++- drivers/scsi/bfa/bfa_fcs_lport.c | 29 +++++--- drivers/scsi/bfa/bfa_modules.h | 12 +-- drivers/scsi/hpsa.h | 40 +++++----- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 10 +-- drivers/video/fbdev/matrox/matroxfb_DAC1064.c | 10 ++- drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 5 +- fs/reiserfs/item_ops.c | 24 +++--- include/linux/rbtree_augmented.h | 4 +- lib/rbtree.c | 4 +- mm/page_alloc.c | 2 +- net/atm/lec.c | 6 +- net/atm/mpoa_caches.c | 41 +++++------ net/vmw_vsock/vmci_transport_notify.c | 30 ++++---- net/vmw_vsock/vmci_transport_notify_qstate.c | 30 ++++---- sound/synth/emux/emux_seq.c | 14 ++-- 34 files changed, 352 insertions(+), 314 deletions(-)arch/x86/include/asm/floppy.h +10
-10@@ -229,18 +229,18 @@ static struct fd_routine_l {int (*_dma_setup)(char *addr,unsigned long size,int mode,int io); } fd_routine[] = { { - request_dma, - free_dma, - get_dma_residue, - dma_mem_alloc, - hard_dma_setup + ._request_dma = request_dma, + ._free_dma = free_dma, + ._get_dma_residue = get_dma_residue, + ._dma_mem_alloc = dma_mem_alloc, + ._dma_setup = hard_dma_setup }, { - vdma_request_dma, - vdma_nop, - vdma_get_dma_residue, - vdma_mem_alloc, - vdma_dma_setup + ._request_dma = vdma_request_dma, + ._free_dma = vdma_nop, + ._get_dma_residue = vdma_get_dma_residue, + ._dma_mem_alloc = vdma_mem_alloc, + ._dma_setup = vdma_dma_setup } };arch/x86/include/asm/paravirt_types.h +10
-8@@ -89,7 +89,7 @@ struct pv_init_ops {*/ unsigned (*patch)(u8 type,u16 clobber,void *insnbuf,unsigned long addr,unsigned len); -}; +} __no_randomize_layout;struct pv_lazy_ops {@@ -97,12 +97,12 @@ struct pv_lazy_ops {void (*enter)(void );void (*leave)(void );void (*flush)(void ); -}; +} __no_randomize_layout;struct pv_time_ops {unsigned long long (*sched_clock)(void );unsigned long long (*steal_clock)(int cpu); -}; +} __no_randomize_layout;struct pv_cpu_ops {/* hooks for various privileged instructions */ @@ -178,7 +178,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); -}; +} __no_randomize_layout;struct pv_irq_ops {/* @@ -201,7 +201,7 @@ struct pv_irq_ops {#ifdef CONFIG_X86_64 void (*adjust_exception_frame)(void );#endif -}; +} __no_randomize_layout;struct pv_mmu_ops {unsigned long (*read_cr2)(void );@@ -296,7 +296,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); -}; +} __no_randomize_layout;struct arch_spinlock ;#ifdef CONFIG_SMP @@ -322,7 +322,9 @@ struct pv_lock_ops {/* This contains all the paravirt structures: we get a convenient * number for each function using the offset which we use to indicate -* what to patch. */ +* what to patch. +* shouldn't be randomized due to the "NEAT TRICK" in paravirt.c +*/ struct paravirt_patch_template {struct pv_init_ops pv_init_ops;struct pv_time_ops pv_time_ops;@@ -330,7 +332,7 @@ struct paravirt_patch_template {struct pv_irq_ops pv_irq_ops;struct pv_mmu_ops pv_mmu_ops;struct pv_lock_ops pv_lock_ops; -}; +} __no_randomize_layout;extern struct pv_info pv_info;extern struct pv_init_ops pv_init_ops;drivers/acpi/acpica/hwxfsleep.c +6
-5@@ -70,11 +70,12 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), - acpi_hw_extended_sleep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), - acpi_hw_extended_wake_prep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), acpi_hw_extended_wake} + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), + .extended_function = acpi_hw_extended_sleep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), + .extended_function = acpi_hw_extended_wake_prep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), + .extended_function = acpi_hw_extended_wake} };/* drivers/block/cciss.h +15
-15@@ -402,27 +402,27 @@ static bool SA5_performant_intr_pending(ctlr_info_t *h) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_fifo_full, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5B_access = { - SA5_submit_command, - SA5B_intr_mask, - SA5_fifo_full, - SA5B_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5B_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5B_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_fifo_full, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/gpu/drm/nouveau/nouveau_ttm.c +14
-14@@ -107,10 +107,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func nouveau_vram_manager = { - nouveau_vram_manager_init, - nouveau_vram_manager_fini, - nouveau_vram_manager_new, - nouveau_vram_manager_del, + .init = nouveau_vram_manager_init, + .takedown = nouveau_vram_manager_fini, + .get_node = nouveau_vram_manager_new, + .put_node = nouveau_vram_manager_del, }; static int@@ -183,11 +183,11 @@ nouveau_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nouveau_gart_manager = { - nouveau_gart_manager_init, - nouveau_gart_manager_fini, - nouveau_gart_manager_new, - nouveau_gart_manager_del, - nouveau_gart_manager_debug + .init = nouveau_gart_manager_init, + .takedown = nouveau_gart_manager_fini, + .get_node = nouveau_gart_manager_new, + .put_node = nouveau_gart_manager_del, + .debug = nouveau_gart_manager_debug };/*XXX*/ @@ -256,11 +256,11 @@ nv04_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nv04_gart_manager = { - nv04_gart_manager_init, - nv04_gart_manager_fini, - nv04_gart_manager_new, - nv04_gart_manager_del, - nv04_gart_manager_debug + .init = nv04_gart_manager_init, + .takedown = nv04_gart_manager_fini, + .get_node = nv04_gart_manager_new, + .put_node = nv04_gart_manager_del, + .debug = nv04_gart_manager_debug };int drivers/gpu/drm/ttm/ttm_bo_manager.c +5
-5@@ -148,10 +148,10 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func ttm_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug };EXPORT_SYMBOL (ttm_bo_manager_func);drivers/gpu/drm/virtio/virtgpu_ttm.c +5
-5@@ -198,11 +198,11 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }static const struct ttm_mem_type_manager_func virtio_gpu_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug }; static int virtio_gpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +5
-5@@ -164,9 +164,9 @@ static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func vmw_gmrid_manager_func = { - vmw_gmrid_man_init, - vmw_gmrid_man_takedown, - vmw_gmrid_man_get_node, - vmw_gmrid_man_put_node, - vmw_gmrid_man_debug + .init = vmw_gmrid_man_init, + .takedown = vmw_gmrid_man_takedown, + .get_node = vmw_gmrid_man_get_node, + .put_node = vmw_gmrid_man_put_node, + .debug = vmw_gmrid_man_debug };drivers/infiniband/hw/nes/nes_cm.c +11
-11@@ -135,17 +135,17 @@ static void record_ird_ord(struct nes_cm_node *, u16, u16);/* instance of function pointers for client API */ /* set address of this instance to cm_core->cm_ops at cm_core alloc */ static const struct nes_cm_ops nes_cm_api = { - mini_cm_accelerated, - mini_cm_listen, - mini_cm_del_listen, - mini_cm_connect, - mini_cm_close, - mini_cm_accept, - mini_cm_reject, - mini_cm_recv_pkt, - mini_cm_dealloc_core, - mini_cm_get, - mini_cm_set + .accelerated = mini_cm_accelerated, + .listen = mini_cm_listen, + .stop_listener = mini_cm_del_listen, + .connect = mini_cm_connect, + .close = mini_cm_close, + .accept = mini_cm_accept, + .reject = mini_cm_reject, + .recv_pkt = mini_cm_recv_pkt, + .destroy_cm_core = mini_cm_dealloc_core, + .get = mini_cm_get, + .set = mini_cm_set };static struct nes_cm_core *g_cm_core;drivers/isdn/gigaset/bas-gigaset.c +16
-16@@ -2565,22 +2565,22 @@ static int gigaset_post_reset(struct usb_interface *intf)static const struct gigaset_ops gigops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_isoc_send_skb, - gigaset_isoc_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_isoc_send_skb, + .handle_input = gigaset_isoc_input, };/* bas_gigaset_init drivers/isdn/gigaset/ser-gigaset.c +16
-16@@ -445,22 +445,22 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb,/* asyncdata.c */ - gigaset_m10x_input,/* asyncdata.c */ + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb,/* asyncdata.c */ + .handle_input = gigaset_m10x_input,/* asyncdata.c */ };drivers/isdn/gigaset/usb-gigaset.c +16
-16@@ -862,22 +862,22 @@ static int gigaset_pre_reset(struct usb_interface *intf) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb, - gigaset_m10x_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb, + .handle_input = gigaset_m10x_input, };/* drivers/isdn/i4l/isdn_concap.c +3
-3@@ -80,9 +80,9 @@ static int isdn_concap_dl_disconn_req(struct concap_proto *concap) }struct concap_device_ops isdn_concap_reliable_dl_dops = { - &isdn_concap_dl_data_req, - &isdn_concap_dl_connect_req, - &isdn_concap_dl_disconn_req + .data_req = &isdn_concap_dl_data_req, + .connect_req = &isdn_concap_dl_connect_req, + .disconn_req = &isdn_concap_dl_disconn_req };/* The following should better go into a dedicated source file such that drivers/isdn/i4l/isdn_x25iface.c +8
-8@@ -53,14 +53,14 @@ static int isdn_x25iface_disconn_ind(struct concap_proto *);static struct concap_proto_ops ix25_pops = { - &isdn_x25iface_proto_new, - &isdn_x25iface_proto_del, - &isdn_x25iface_proto_restart, - &isdn_x25iface_proto_close, - &isdn_x25iface_xmit, - &isdn_x25iface_receive, - &isdn_x25iface_connect_ind, - &isdn_x25iface_disconn_ind + .proto_new = &isdn_x25iface_proto_new, + .proto_del = &isdn_x25iface_proto_del, + .restart = &isdn_x25iface_proto_restart, + .close = &isdn_x25iface_proto_close, + .encap_and_xmit = &isdn_x25iface_xmit, + .data_ind = &isdn_x25iface_receive, + .connect_ind = &isdn_x25iface_connect_ind, + .disconn_ind = &isdn_x25iface_disconn_ind };/* error message helper function */ drivers/media/pci/solo6x10/solo6x10-g723.c +1
-1@@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)int solo_g723_init (struct solo_dev *solo_dev) { -static struct snd_device_ops ops = {NULL }; +static struct snd_device_ops ops = { };struct snd_card *card;struct snd_kcontrol_new kctl;char name[32 ];drivers/net/ethernet/brocade/bna/bna_enet.c +4
-4@@ -1676,10 +1676,10 @@ bna_cb_ioceth_reset(void *arg) }static struct bfa_ioc_cbfn bna_ioceth_cbfn = { - bna_cb_ioceth_enable, - bna_cb_ioceth_disable, - bna_cb_ioceth_hbfail, - bna_cb_ioceth_reset + .enable_cbfn = bna_cb_ioceth_enable, + .disable_cbfn = bna_cb_ioceth_disable, + .hbfail_cbfn = bna_cb_ioceth_hbfail, + .reset_cbfn = bna_cb_ioceth_reset };static void bna_attr_init (struct bna_ioceth *ioceth)drivers/net/wan/lmc/lmc_media.c +49
-48@@ -95,62 +95,63 @@ static inline void write_av9110_bit (lmc_softc_t *, int);static void write_av9110 (lmc_softc_t *,u32 ,u32 ,u32 ,u32 ,u32 );lmc_media_t lmc_ds3_media = { - lmc_ds3_init,/* special media init stuff */ - lmc_ds3_default,/* reset to default state */ - lmc_ds3_set_status,/* reset status to state provided */ - lmc_dummy_set_1,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_ds3_set_100ft,/* set cable length */ - lmc_ds3_set_scram,/* set scrambler */ - lmc_ds3_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_ds3_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ds3_watchdog + .init = lmc_ds3_init,/* special media init stuff */ + .defaults = lmc_ds3_default,/* reset to default state */ + .set_status = lmc_ds3_set_status,/* reset status to state provided */ + .set_clock_source = lmc_dummy_set_1,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_ds3_set_100ft,/* set cable length */ + .set_scrambler = lmc_ds3_set_scram,/* set scrambler */ + .get_link_status = lmc_ds3_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_ds3_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ds3_watchdog };lmc_media_t lmc_hssi_media = { - lmc_hssi_init,/* special media init stuff */ - lmc_hssi_default,/* reset to default state */ - lmc_hssi_set_status,/* reset status to state provided */ - lmc_hssi_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_hssi_get_link_status,/* get link status */ - lmc_hssi_set_link_status,/* set link status */ - lmc_hssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_hssi_watchdog + .init = lmc_hssi_init,/* special media init stuff */ + .defaults = lmc_hssi_default,/* reset to default state */ + .set_status = lmc_hssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_hssi_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_hssi_get_link_status,/* get link status */ + .set_link_status = lmc_hssi_set_link_status,/* set link status */ + .set_crc_length = lmc_hssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_hssi_watchdog }; -lmc_media_t lmc_ssi_media = { lmc_ssi_init,/* special media init stuff */ - lmc_ssi_default,/* reset to default state */ - lmc_ssi_set_status,/* reset status to state provided */ - lmc_ssi_set_clock,/* set clock source */ - lmc_ssi_set_speed,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_ssi_get_link_status,/* get link status */ - lmc_ssi_set_link_status,/* set link status */ - lmc_ssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ssi_watchdog +lmc_media_t lmc_ssi_media = { + .init = lmc_ssi_init,/* special media init stuff */ + .defaults = lmc_ssi_default,/* reset to default state */ + .set_status = lmc_ssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_ssi_set_clock,/* set clock source */ + .set_speed = lmc_ssi_set_speed,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_ssi_get_link_status,/* get link status */ + .set_link_status = lmc_ssi_set_link_status,/* set link status */ + .set_crc_length = lmc_ssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ssi_watchdog };lmc_media_t lmc_t1_media = { - lmc_t1_init,/* special media init stuff */ - lmc_t1_default,/* reset to default state */ - lmc_t1_set_status,/* reset status to state provided */ - lmc_t1_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_t1_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_t1_set_crc_length,/* set CRC length */ - lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ - lmc_t1_watchdog + .init = lmc_t1_init,/* special media init stuff */ + .defaults = lmc_t1_default,/* reset to default state */ + .set_status = lmc_t1_set_status,/* reset status to state provided */ + .set_clock_source = lmc_t1_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_t1_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_t1_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ + .watchdog = lmc_t1_watchdog }; static voiddrivers/scsi/bfa/bfa_fcs.c +15
-4@@ -39,10 +39,21 @@ struct bfa_fcs_mod_s {#define BFA_FCS_MODULE (_mod) { _mod ## _modinit, _mod ## _modexit }static struct bfa_fcs_mod_s fcs_modules[] = { - { bfa_fcs_port_attach,NULL ,NULL }, - { bfa_fcs_uf_attach,NULL ,NULL }, - { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit, - bfa_fcs_fabric_modexit }, + { + .attach = bfa_fcs_port_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_uf_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_fabric_attach, + .modinit = bfa_fcs_fabric_modinit, + .modexit = bfa_fcs_fabric_modexit + }, };/* drivers/scsi/bfa/bfa_fcs_lport.c +20
-9@@ -90,15 +90,26 @@ static struct {void (*offline) (struct bfa_fcs_lport_s *port); } __port_action[] = { { - bfa_fcs_lport_unknown_init, bfa_fcs_lport_unknown_online, - bfa_fcs_lport_unknown_offline}, { - bfa_fcs_lport_fab_init, bfa_fcs_lport_fab_online, - bfa_fcs_lport_fab_offline}, { - bfa_fcs_lport_n2n_init, bfa_fcs_lport_n2n_online, - bfa_fcs_lport_n2n_offline}, { - bfa_fcs_lport_loop_init, bfa_fcs_lport_loop_online, - bfa_fcs_lport_loop_offline}, - }; + .init = bfa_fcs_lport_unknown_init, + .online = bfa_fcs_lport_unknown_online, + .offline = bfa_fcs_lport_unknown_offline + }, + { + .init = bfa_fcs_lport_fab_init, + .online = bfa_fcs_lport_fab_online, + .offline = bfa_fcs_lport_fab_offline + }, + { + .init = bfa_fcs_lport_n2n_init, + .online = bfa_fcs_lport_n2n_online, + .offline = bfa_fcs_lport_n2n_offline + }, + { + .init = bfa_fcs_lport_loop_init, + .online = bfa_fcs_lport_loop_online, + .offline = bfa_fcs_lport_loop_offline + }, +}; /* * fcs_port_sm FCS logical port state machinedrivers/scsi/bfa/bfa_modules.h +6
-6@@ -79,12 +79,12 @@ enum { \ extern struct bfa_module_s hal_mod_ ## __mod; \ struct bfa_module_s hal_mod_ ## __mod = { \ - bfa_ ## __mod ## _meminfo, \ - bfa_ ## __mod ## _attach, \ - bfa_ ## __mod ## _detach, \ - bfa_ ## __mod ## _start, \ - bfa_ ## __mod ## _stop, \ - bfa_ ## __mod ## _iocdisable, \ + .meminfo = bfa_ ## __mod ## _meminfo, \ + .attach = bfa_ ## __mod ## _attach, \ + .detach = bfa_ ## __mod ## _detach, \ + .start = bfa_ ## __mod ## _start, \ + .stop = bfa_ ## __mod ## _stop, \ + .iocdisable = bfa_ ## __mod ## _iocdisable, \ }#define BFA_CACHELINE_SZ (256)drivers/scsi/hpsa.h +20
-20@@ -577,38 +577,38 @@ static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_ioaccel_mode1_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_ioaccel_mode1_intr_pending, - SA5_ioaccel_mode1_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_ioaccel_mode1_intr_pending, + .command_completed = SA5_ioaccel_mode1_completed, };static struct access_method SA5_ioaccel_mode2_access = { - SA5_submit_command_ioaccel2, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_ioaccel2, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access_no_read = { - SA5_submit_command_no_read, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_no_read, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +1
-1@@ -147,7 +147,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,int added = (mode ==LCK_NL );int overlaps =0 ;int splitted =0 ; -const struct ldlm_callback_suite null_cbs = {NULL }; +const struct ldlm_callback_suite null_cbs = { }; CDEBUG(D_DLMTRACE, "flags %#llx owner %llu pid %u mode %u start %llu end %llu\n",drivers/staging/lustre/lustre/libcfs/module.c +5
-5@@ -322,11 +322,11 @@ out: }struct cfs_psdev_ops libcfs_psdev_ops = { - libcfs_psdev_open, - libcfs_psdev_release, -NULL , -NULL , - libcfs_ioctl + .p_open = libcfs_psdev_open, + .p_close = libcfs_psdev_release, + .p_read =NULL , + .p_write =NULL , + .p_ioctl = libcfs_ioctl }; static int proc_call_handler(void *data, int write, loff_t *ppos,drivers/video/fbdev/matrox/matroxfb_DAC1064.c +8
-2@@ -1088,14 +1088,20 @@ static void MGAG100_restore(struct matrox_fb_info *minfo)#ifdef CONFIG_FB_MATROX_MYSTIQUE struct matrox_switch matrox_mystique = { - MGA1064_preinit, MGA1064_reset, MGA1064_init, MGA1064_restore, + .preinit = MGA1064_preinit, + .reset = MGA1064_reset, + .init = MGA1064_init, + .restore = MGA1064_restore, };EXPORT_SYMBOL (matrox_mystique);#endif #ifdef CONFIG_FB_MATROX_G struct matrox_switch matrox_G100 = { - MGAG100_preinit, MGAG100_reset, MGAG100_init, MGAG100_restore, + .preinit = MGAG100_preinit, + .reset = MGAG100_reset, + .init = MGAG100_init, + .restore = MGAG100_restore, };EXPORT_SYMBOL (matrox_G100);#endif drivers/video/fbdev/matrox/matroxfb_Ti3026.c +4
-1@@ -738,7 +738,10 @@ static int Ti3026_preinit(struct matrox_fb_info *minfo) }struct matrox_switch matrox_millennium = { - Ti3026_preinit, Ti3026_reset, Ti3026_init, Ti3026_restore + .preinit = Ti3026_preinit, + .reset = Ti3026_reset, + .init = Ti3026_init, + .restore = Ti3026_restore };EXPORT_SYMBOL (matrox_millennium);#endif fs/reiserfs/item_ops.c +12
-12@@ -724,18 +724,18 @@ static void errcatch_print_vi(struct virtual_item *vi) }static struct item_operations errcatch_ops = { - errcatch_bytes_number, - errcatch_decrement_key, - errcatch_is_left_mergeable, - errcatch_print_item, - errcatch_check_item, - - errcatch_create_vi, - errcatch_check_left, - errcatch_check_right, - errcatch_part_size, - errcatch_unit_num, - errcatch_print_vi + .bytes_number = errcatch_bytes_number, + .decrement_key = errcatch_decrement_key, + .is_left_mergeable = errcatch_is_left_mergeable, + .print_item = errcatch_print_item, + .check_item = errcatch_check_item, + + .create_vi = errcatch_create_vi, + .check_left = errcatch_check_left, + .check_right = errcatch_check_right, + .part_size = errcatch_part_size, + .unit_num = errcatch_unit_num, + .print_vi = errcatch_print_vi };#if ! (TYPE_STAT_DATA ==0 &&TYPE_INDIRECT ==1 &&TYPE_DIRECT ==2 &&TYPE_DIRENTRY ==3 )include/linux/rbtree_augmented.h +3
-1@@ -90,7 +90,9 @@ rbname ## _rotate(struct rb_node *rb_old, struct rb_node *rb_new) \ old->rbaugmented =rbcompute (old); \ } \ rbstatic const struct rb_augment_callbacks rbname = { \ - rbname ## _propagate, rbname ## _copy, rbname ## _rotate \ + .propagate = rbname ## _propagate, \ + .copy = rbname ## _copy, \ + .rotate = rbname ## _rotate \ };lib/rbtree.c +3
-1@@ -412,7 +412,9 @@ static inline void dummy_copy(struct rb_node *old, struct rb_node *new) {}static inline void dummy_rotate (struct rb_node *old,struct rb_node *new) {}static const struct rb_augment_callbacks dummy_callbacks = { - dummy_propagate, dummy_copy, dummy_rotate + .propagate = dummy_propagate, + .copy = dummy_copy, + .rotate = dummy_rotate };void rb_insert_color (struct rb_node *node,struct rb_root *root)mm/page_alloc.c +1
-1@@ -561,7 +561,7 @@ static inline void clear_page_guard(struct zone *zone, struct page *page,__mod_zone_freepage_state (zone, (1 << order), migratetype); }#else -struct page_ext_operations debug_guardpage_ops = {NULL , }; +struct page_ext_operations debug_guardpage_ops = { .need =NULL , .init =NULL };static inline void set_page_guard (struct zone *zone,struct page *page,unsigned int order,int migratetype) {} static inline void clear_page_guard(struct zone *zone, struct page *page,net/atm/lec.c +3
-3@@ -111,9 +111,9 @@ static inline void lec_arp_put(struct lec_arp_table *entry) }static struct lane2_ops lane2_ops = { - lane2_resolve,/* resolve, spec 3.1.3 */ - lane2_associate_req,/* associate_req, spec 3.1.4 */ -NULL /* associate indicator, spec 3.1.5 */ + .resolve = lane2_resolve, + .associate_req = lane2_associate_req, + .associate_indicator =NULL };static unsigned char bus_mac[ETH_ALEN ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };net/atm/mpoa_caches.c +20
-21@@ -535,30 +535,29 @@ static void eg_destroy_cache(struct mpoa_client *mpc)static const struct in_cache_ops ingress_ops = { - in_cache_add_entry,/* add_entry */ - in_cache_get,/* get */ - in_cache_get_with_mask,/* get_with_mask */ - in_cache_get_by_vcc,/* get_by_vcc */ - in_cache_put,/* put */ - in_cache_remove_entry,/* remove_entry */ - cache_hit,/* cache_hit */ - clear_count_and_expired,/* clear_count */ - check_resolving_entries,/* check_resolving */ - refresh_entries,/* refresh */ - in_destroy_cache/* destroy_cache */ + .add_entry = in_cache_add_entry, + .get = in_cache_get, + .get_with_mask = in_cache_get_with_mask, + .get_by_vcc = in_cache_get_by_vcc, + .put = in_cache_put, + .remove_entry = in_cache_remove_entry, + .cache_hit = cache_hit, + .clear_count = clear_count_and_expired, + .check_resolving = check_resolving_entries, + .refresh = refresh_entries, };static const struct eg_cache_ops egress_ops = { - eg_cache_add_entry,/* add_entry */ - eg_cache_get_by_cache_id,/* get_by_cache_id */ - eg_cache_get_by_tag,/* get_by_tag */ - eg_cache_get_by_vcc,/* get_by_vcc */ - eg_cache_get_by_src_ip,/* get_by_src_ip */ - eg_cache_put,/* put */ - eg_cache_remove_entry,/* remove_entry */ - update_eg_cache_entry,/* update */ - clear_expired,/* clear_expired */ - eg_destroy_cache/* destroy_cache */ + .add_entry = eg_cache_add_entry, + .get_by_cache_id = eg_cache_get_by_cache_id, + .get_by_tag = eg_cache_get_by_tag, + .get_by_vcc = eg_cache_get_by_vcc, + .get_by_src_ip = eg_cache_get_by_src_ip, + .put = eg_cache_put, + .remove_entry = eg_cache_remove_entry, + .update = update_eg_cache_entry, + .clear_expired = clear_expired, + .destroy_cache = eg_destroy_cache };net/vmw_vsock/vmci_transport_notify.c +15
-15@@ -662,19 +662,19 @@ static void vmci_transport_notify_pkt_process_negotiate(struct sock *sk)/* Socket control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };net/vmw_vsock/vmci_transport_notify_qstate.c +15
-15@@ -420,19 +420,19 @@ vmci_transport_notify_pkt_send_pre_enqueue(/* Socket always on control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };sound/synth/emux/emux_seq.c +7
-8@@ -33,13 +33,13 @@ static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *inf* MIDI emulation operators */ static struct snd_midi_op emux_ops = { - snd_emux_note_on, - snd_emux_note_off, - snd_emux_key_press, - snd_emux_terminate_note, - snd_emux_control, - snd_emux_nrpn, - snd_emux_sysex, + .note_on = snd_emux_note_on, + .note_off = snd_emux_note_off, + .key_press = snd_emux_key_press, + .note_terminate = snd_emux_terminate_note, + .control = snd_emux_control, + .nrpn = snd_emux_nrpn, + .sysex = snd_emux_sysex, }; --1.9.1
Signature · 2 lines
Kees Cook Chrome OS & Brillo Security
[kernel-hardening] Re: [RFC 3/3] Change initialization C99 style; tag no_ramdomize_layout structs
In reply to Kees CookQuoted 13 lines · Kees Cook
Quoted 11 lines · Michael Leibowitz
Due to randomization of structs, the in order struct intialization style is replaced with explicit field style.
struct
foo_tmy_foo= {
one,
two,
three
};becomes
Quoted 8 lines
Quoted 5 lines
struct foo_t my_foo = { .one = one, .two = two, .three = three };Can a coccinelle script be written to do this also? It might be useful to keep that around.
Does randomization apply to all structures? Only global ones? Only those that contain function pointers?
julia
Quoted 1,193 lines
Quoted 4 lines
Additionally, tag paravirt related structures to explicitly not be randomized, as the structure layout is important.
This might need to be split out? It's logically separate. Also, I think this needs to come before the plugin, since the plugin isn't usable until this patch is in place.
-Kees
Quoted 1,173 lines
This feature is ported over from grsecurity. This is largely unchanged from the Original code written by the PaX Team and Spender.
Signed-off-by Michael Leibowitz <[email protected]>--- arch/x86/include/asm/floppy.h | 20 ++--- arch/x86/include/asm/paravirt_types.h | 18 +++-- drivers/acpi/acpica/hwxfsleep.c | 11 +-- drivers/block/cciss.h | 30 ++++---- drivers/gpu/drm/nouveau/nouveau_ttm.c | 28 +++---- drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 +-- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 10 +-- drivers/infiniband/hw/nes/nes_cm.c | 22 +++--- drivers/isdn/gigaset/bas-gigaset.c | 32 ++++---- drivers/isdn/gigaset/ser-gigaset.c | 32 ++++---- drivers/isdn/gigaset/usb-gigaset.c | 32 ++++---- drivers/isdn/i4l/isdn_concap.c | 6 +- drivers/isdn/i4l/isdn_x25iface.c | 16 ++-- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- drivers/net/ethernet/brocade/bna/bna_enet.c | 8 +- drivers/net/wan/lmc/lmc_media.c | 97 +++++++++++++------------ drivers/scsi/bfa/bfa_fcs.c | 19 ++++- drivers/scsi/bfa/bfa_fcs_lport.c | 29 +++++--- drivers/scsi/bfa/bfa_modules.h | 12 +-- drivers/scsi/hpsa.h | 40 +++++----- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 10 +-- drivers/video/fbdev/matrox/matroxfb_DAC1064.c | 10 ++- drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 5 +- fs/reiserfs/item_ops.c | 24 +++--- include/linux/rbtree_augmented.h | 4 +- lib/rbtree.c | 4 +- mm/page_alloc.c | 2 +- net/atm/lec.c | 6 +- net/atm/mpoa_caches.c | 41 +++++------ net/vmw_vsock/vmci_transport_notify.c | 30 ++++---- net/vmw_vsock/vmci_transport_notify_qstate.c | 30 ++++---- sound/synth/emux/emux_seq.c | 14 ++-- 34 files changed, 352 insertions(+), 314 deletions(-)arch/x86/include/asm/floppy.h +10
-10@@ -229,18 +229,18 @@ static struct fd_routine_l {int (*_dma_setup)(char *addr,unsigned long size,int mode,int io); } fd_routine[] = { { - request_dma, - free_dma, - get_dma_residue, - dma_mem_alloc, - hard_dma_setup + ._request_dma = request_dma, + ._free_dma = free_dma, + ._get_dma_residue = get_dma_residue, + ._dma_mem_alloc = dma_mem_alloc, + ._dma_setup = hard_dma_setup }, { - vdma_request_dma, - vdma_nop, - vdma_get_dma_residue, - vdma_mem_alloc, - vdma_dma_setup + ._request_dma = vdma_request_dma, + ._free_dma = vdma_nop, + ._get_dma_residue = vdma_get_dma_residue, + ._dma_mem_alloc = vdma_mem_alloc, + ._dma_setup = vdma_dma_setup } };arch/x86/include/asm/paravirt_types.h +10
-8@@ -89,7 +89,7 @@ struct pv_init_ops {*/ unsigned (*patch)(u8 type,u16 clobber,void *insnbuf,unsigned long addr,unsigned len); -}; +} __no_randomize_layout;struct pv_lazy_ops {@@ -97,12 +97,12 @@ struct pv_lazy_ops {void (*enter)(void );void (*leave)(void );void (*flush)(void ); -}; +} __no_randomize_layout;struct pv_time_ops {unsigned long long (*sched_clock)(void );unsigned long long (*steal_clock)(int cpu); -}; +} __no_randomize_layout;struct pv_cpu_ops {/* hooks for various privileged instructions */ @@ -178,7 +178,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); -}; +} __no_randomize_layout;struct pv_irq_ops {/* @@ -201,7 +201,7 @@ struct pv_irq_ops {#ifdef CONFIG_X86_64 void (*adjust_exception_frame)(void );#endif -}; +} __no_randomize_layout;struct pv_mmu_ops {unsigned long (*read_cr2)(void );@@ -296,7 +296,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); -}; +} __no_randomize_layout;struct arch_spinlock ;#ifdef CONFIG_SMP @@ -322,7 +322,9 @@ struct pv_lock_ops {/* This contains all the paravirt structures: we get a convenient * number for each function using the offset which we use to indicate -* what to patch. */ +* what to patch. +* shouldn't be randomized due to the "NEAT TRICK" in paravirt.c +*/ struct paravirt_patch_template {struct pv_init_ops pv_init_ops;struct pv_time_ops pv_time_ops;@@ -330,7 +332,7 @@ struct paravirt_patch_template {struct pv_irq_ops pv_irq_ops;struct pv_mmu_ops pv_mmu_ops;struct pv_lock_ops pv_lock_ops; -}; +} __no_randomize_layout;extern struct pv_info pv_info;extern struct pv_init_ops pv_init_ops;drivers/acpi/acpica/hwxfsleep.c +6
-5@@ -70,11 +70,12 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), - acpi_hw_extended_sleep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), - acpi_hw_extended_wake_prep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), acpi_hw_extended_wake} + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), + .extended_function = acpi_hw_extended_sleep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), + .extended_function = acpi_hw_extended_wake_prep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), + .extended_function = acpi_hw_extended_wake} };/* drivers/block/cciss.h +15
-15@@ -402,27 +402,27 @@ static bool SA5_performant_intr_pending(ctlr_info_t *h) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_fifo_full, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5B_access = { - SA5_submit_command, - SA5B_intr_mask, - SA5_fifo_full, - SA5B_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5B_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5B_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_fifo_full, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/gpu/drm/nouveau/nouveau_ttm.c +14
-14@@ -107,10 +107,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func nouveau_vram_manager = { - nouveau_vram_manager_init, - nouveau_vram_manager_fini, - nouveau_vram_manager_new, - nouveau_vram_manager_del, + .init = nouveau_vram_manager_init, + .takedown = nouveau_vram_manager_fini, + .get_node = nouveau_vram_manager_new, + .put_node = nouveau_vram_manager_del, }; static int@@ -183,11 +183,11 @@ nouveau_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nouveau_gart_manager = { - nouveau_gart_manager_init, - nouveau_gart_manager_fini, - nouveau_gart_manager_new, - nouveau_gart_manager_del, - nouveau_gart_manager_debug + .init = nouveau_gart_manager_init, + .takedown = nouveau_gart_manager_fini, + .get_node = nouveau_gart_manager_new, + .put_node = nouveau_gart_manager_del, + .debug = nouveau_gart_manager_debug };/*XXX*/ @@ -256,11 +256,11 @@ nv04_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nv04_gart_manager = { - nv04_gart_manager_init, - nv04_gart_manager_fini, - nv04_gart_manager_new, - nv04_gart_manager_del, - nv04_gart_manager_debug + .init = nv04_gart_manager_init, + .takedown = nv04_gart_manager_fini, + .get_node = nv04_gart_manager_new, + .put_node = nv04_gart_manager_del, + .debug = nv04_gart_manager_debug };int drivers/gpu/drm/ttm/ttm_bo_manager.c +5
-5@@ -148,10 +148,10 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func ttm_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug };EXPORT_SYMBOL (ttm_bo_manager_func);drivers/gpu/drm/virtio/virtgpu_ttm.c +5
-5@@ -198,11 +198,11 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }static const struct ttm_mem_type_manager_func virtio_gpu_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug }; static int virtio_gpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +5
-5@@ -164,9 +164,9 @@ static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func vmw_gmrid_manager_func = { - vmw_gmrid_man_init, - vmw_gmrid_man_takedown, - vmw_gmrid_man_get_node, - vmw_gmrid_man_put_node, - vmw_gmrid_man_debug + .init = vmw_gmrid_man_init, + .takedown = vmw_gmrid_man_takedown, + .get_node = vmw_gmrid_man_get_node, + .put_node = vmw_gmrid_man_put_node, + .debug = vmw_gmrid_man_debug };drivers/infiniband/hw/nes/nes_cm.c +11
-11@@ -135,17 +135,17 @@ static void record_ird_ord(struct nes_cm_node *, u16, u16);/* instance of function pointers for client API */ /* set address of this instance to cm_core->cm_ops at cm_core alloc */ static const struct nes_cm_ops nes_cm_api = { - mini_cm_accelerated, - mini_cm_listen, - mini_cm_del_listen, - mini_cm_connect, - mini_cm_close, - mini_cm_accept, - mini_cm_reject, - mini_cm_recv_pkt, - mini_cm_dealloc_core, - mini_cm_get, - mini_cm_set + .accelerated = mini_cm_accelerated, + .listen = mini_cm_listen, + .stop_listener = mini_cm_del_listen, + .connect = mini_cm_connect, + .close = mini_cm_close, + .accept = mini_cm_accept, + .reject = mini_cm_reject, + .recv_pkt = mini_cm_recv_pkt, + .destroy_cm_core = mini_cm_dealloc_core, + .get = mini_cm_get, + .set = mini_cm_set };static struct nes_cm_core *g_cm_core;drivers/isdn/gigaset/bas-gigaset.c +16
-16@@ -2565,22 +2565,22 @@ static int gigaset_post_reset(struct usb_interface *intf)static const struct gigaset_ops gigops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_isoc_send_skb, - gigaset_isoc_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_isoc_send_skb, + .handle_input = gigaset_isoc_input, };/* bas_gigaset_init drivers/isdn/gigaset/ser-gigaset.c +16
-16@@ -445,22 +445,22 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb,/* asyncdata.c */ - gigaset_m10x_input,/* asyncdata.c */ + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb,/* asyncdata.c */ + .handle_input = gigaset_m10x_input,/* asyncdata.c */ };drivers/isdn/gigaset/usb-gigaset.c +16
-16@@ -862,22 +862,22 @@ static int gigaset_pre_reset(struct usb_interface *intf) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb, - gigaset_m10x_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb, + .handle_input = gigaset_m10x_input, };/* drivers/isdn/i4l/isdn_concap.c +3
-3@@ -80,9 +80,9 @@ static int isdn_concap_dl_disconn_req(struct concap_proto *concap) }struct concap_device_ops isdn_concap_reliable_dl_dops = { - &isdn_concap_dl_data_req, - &isdn_concap_dl_connect_req, - &isdn_concap_dl_disconn_req + .data_req = &isdn_concap_dl_data_req, + .connect_req = &isdn_concap_dl_connect_req, + .disconn_req = &isdn_concap_dl_disconn_req };/* The following should better go into a dedicated source file such that drivers/isdn/i4l/isdn_x25iface.c +8
-8@@ -53,14 +53,14 @@ static int isdn_x25iface_disconn_ind(struct concap_proto *);static struct concap_proto_ops ix25_pops = { - &isdn_x25iface_proto_new, - &isdn_x25iface_proto_del, - &isdn_x25iface_proto_restart, - &isdn_x25iface_proto_close, - &isdn_x25iface_xmit, - &isdn_x25iface_receive, - &isdn_x25iface_connect_ind, - &isdn_x25iface_disconn_ind + .proto_new = &isdn_x25iface_proto_new, + .proto_del = &isdn_x25iface_proto_del, + .restart = &isdn_x25iface_proto_restart, + .close = &isdn_x25iface_proto_close, + .encap_and_xmit = &isdn_x25iface_xmit, + .data_ind = &isdn_x25iface_receive, + .connect_ind = &isdn_x25iface_connect_ind, + .disconn_ind = &isdn_x25iface_disconn_ind };/* error message helper function */ drivers/media/pci/solo6x10/solo6x10-g723.c +1
-1@@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)int solo_g723_init (struct solo_dev *solo_dev) { -static struct snd_device_ops ops = {NULL }; +static struct snd_device_ops ops = { };struct snd_card *card;struct snd_kcontrol_new kctl;char name[32 ];drivers/net/ethernet/brocade/bna/bna_enet.c +4
-4@@ -1676,10 +1676,10 @@ bna_cb_ioceth_reset(void *arg) }static struct bfa_ioc_cbfn bna_ioceth_cbfn = { - bna_cb_ioceth_enable, - bna_cb_ioceth_disable, - bna_cb_ioceth_hbfail, - bna_cb_ioceth_reset + .enable_cbfn = bna_cb_ioceth_enable, + .disable_cbfn = bna_cb_ioceth_disable, + .hbfail_cbfn = bna_cb_ioceth_hbfail, + .reset_cbfn = bna_cb_ioceth_reset };static void bna_attr_init (struct bna_ioceth *ioceth)drivers/net/wan/lmc/lmc_media.c +49
-48@@ -95,62 +95,63 @@ static inline void write_av9110_bit (lmc_softc_t *, int);static void write_av9110 (lmc_softc_t *,u32 ,u32 ,u32 ,u32 ,u32 );lmc_media_t lmc_ds3_media = { - lmc_ds3_init,/* special media init stuff */ - lmc_ds3_default,/* reset to default state */ - lmc_ds3_set_status,/* reset status to state provided */ - lmc_dummy_set_1,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_ds3_set_100ft,/* set cable length */ - lmc_ds3_set_scram,/* set scrambler */ - lmc_ds3_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_ds3_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ds3_watchdog + .init = lmc_ds3_init,/* special media init stuff */ + .defaults = lmc_ds3_default,/* reset to default state */ + .set_status = lmc_ds3_set_status,/* reset status to state provided */ + .set_clock_source = lmc_dummy_set_1,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_ds3_set_100ft,/* set cable length */ + .set_scrambler = lmc_ds3_set_scram,/* set scrambler */ + .get_link_status = lmc_ds3_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_ds3_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ds3_watchdog };lmc_media_t lmc_hssi_media = { - lmc_hssi_init,/* special media init stuff */ - lmc_hssi_default,/* reset to default state */ - lmc_hssi_set_status,/* reset status to state provided */ - lmc_hssi_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_hssi_get_link_status,/* get link status */ - lmc_hssi_set_link_status,/* set link status */ - lmc_hssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_hssi_watchdog + .init = lmc_hssi_init,/* special media init stuff */ + .defaults = lmc_hssi_default,/* reset to default state */ + .set_status = lmc_hssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_hssi_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_hssi_get_link_status,/* get link status */ + .set_link_status = lmc_hssi_set_link_status,/* set link status */ + .set_crc_length = lmc_hssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_hssi_watchdog }; -lmc_media_t lmc_ssi_media = { lmc_ssi_init,/* special media init stuff */ - lmc_ssi_default,/* reset to default state */ - lmc_ssi_set_status,/* reset status to state provided */ - lmc_ssi_set_clock,/* set clock source */ - lmc_ssi_set_speed,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_ssi_get_link_status,/* get link status */ - lmc_ssi_set_link_status,/* set link status */ - lmc_ssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ssi_watchdog +lmc_media_t lmc_ssi_media = { + .init = lmc_ssi_init,/* special media init stuff */ + .defaults = lmc_ssi_default,/* reset to default state */ + .set_status = lmc_ssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_ssi_set_clock,/* set clock source */ + .set_speed = lmc_ssi_set_speed,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_ssi_get_link_status,/* get link status */ + .set_link_status = lmc_ssi_set_link_status,/* set link status */ + .set_crc_length = lmc_ssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ssi_watchdog };lmc_media_t lmc_t1_media = { - lmc_t1_init,/* special media init stuff */ - lmc_t1_default,/* reset to default state */ - lmc_t1_set_status,/* reset status to state provided */ - lmc_t1_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_t1_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_t1_set_crc_length,/* set CRC length */ - lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ - lmc_t1_watchdog + .init = lmc_t1_init,/* special media init stuff */ + .defaults = lmc_t1_default,/* reset to default state */ + .set_status = lmc_t1_set_status,/* reset status to state provided */ + .set_clock_source = lmc_t1_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_t1_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_t1_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ + .watchdog = lmc_t1_watchdog }; static voiddrivers/scsi/bfa/bfa_fcs.c +15
-4@@ -39,10 +39,21 @@ struct bfa_fcs_mod_s {#define BFA_FCS_MODULE (_mod) { _mod ## _modinit, _mod ## _modexit }static struct bfa_fcs_mod_s fcs_modules[] = { - { bfa_fcs_port_attach,NULL ,NULL }, - { bfa_fcs_uf_attach,NULL ,NULL }, - { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit, - bfa_fcs_fabric_modexit }, + { + .attach = bfa_fcs_port_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_uf_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_fabric_attach, + .modinit = bfa_fcs_fabric_modinit, + .modexit = bfa_fcs_fabric_modexit + }, };/* drivers/scsi/bfa/bfa_fcs_lport.c +20
-9@@ -90,15 +90,26 @@ static struct {void (*offline) (struct bfa_fcs_lport_s *port); } __port_action[] = { { - bfa_fcs_lport_unknown_init, bfa_fcs_lport_unknown_online, - bfa_fcs_lport_unknown_offline}, { - bfa_fcs_lport_fab_init, bfa_fcs_lport_fab_online, - bfa_fcs_lport_fab_offline}, { - bfa_fcs_lport_n2n_init, bfa_fcs_lport_n2n_online, - bfa_fcs_lport_n2n_offline}, { - bfa_fcs_lport_loop_init, bfa_fcs_lport_loop_online, - bfa_fcs_lport_loop_offline}, - }; + .init = bfa_fcs_lport_unknown_init, + .online = bfa_fcs_lport_unknown_online, + .offline = bfa_fcs_lport_unknown_offline + }, + { + .init = bfa_fcs_lport_fab_init, + .online = bfa_fcs_lport_fab_online, + .offline = bfa_fcs_lport_fab_offline + }, + { + .init = bfa_fcs_lport_n2n_init, + .online = bfa_fcs_lport_n2n_online, + .offline = bfa_fcs_lport_n2n_offline + }, + { + .init = bfa_fcs_lport_loop_init, + .online = bfa_fcs_lport_loop_online, + .offline = bfa_fcs_lport_loop_offline + }, +}; /* * fcs_port_sm FCS logical port state machinedrivers/scsi/bfa/bfa_modules.h +6
-6@@ -79,12 +79,12 @@ enum { \ extern struct bfa_module_s hal_mod_ ## __mod; \ struct bfa_module_s hal_mod_ ## __mod = { \ - bfa_ ## __mod ## _meminfo, \ - bfa_ ## __mod ## _attach, \ - bfa_ ## __mod ## _detach, \ - bfa_ ## __mod ## _start, \ - bfa_ ## __mod ## _stop, \ - bfa_ ## __mod ## _iocdisable, \ + .meminfo = bfa_ ## __mod ## _meminfo, \ + .attach = bfa_ ## __mod ## _attach, \ + .detach = bfa_ ## __mod ## _detach, \ + .start = bfa_ ## __mod ## _start, \ + .stop = bfa_ ## __mod ## _stop, \ + .iocdisable = bfa_ ## __mod ## _iocdisable, \ }#define BFA_CACHELINE_SZ (256)drivers/scsi/hpsa.h +20
-20@@ -577,38 +577,38 @@ static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_ioaccel_mode1_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_ioaccel_mode1_intr_pending, - SA5_ioaccel_mode1_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_ioaccel_mode1_intr_pending, + .command_completed = SA5_ioaccel_mode1_completed, };static struct access_method SA5_ioaccel_mode2_access = { - SA5_submit_command_ioaccel2, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_ioaccel2, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access_no_read = { - SA5_submit_command_no_read, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_no_read, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +1
-1@@ -147,7 +147,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,int added = (mode ==LCK_NL );int overlaps =0 ;int splitted =0 ; -const struct ldlm_callback_suite null_cbs = {NULL }; +const struct ldlm_callback_suite null_cbs = { }; CDEBUG(D_DLMTRACE, "flags %#llx owner %llu pid %u mode %u start %llu end %llu\n",drivers/staging/lustre/lustre/libcfs/module.c +5
-5@@ -322,11 +322,11 @@ out: }struct cfs_psdev_ops libcfs_psdev_ops = { - libcfs_psdev_open, - libcfs_psdev_release, -NULL , -NULL , - libcfs_ioctl + .p_open = libcfs_psdev_open, + .p_close = libcfs_psdev_release, + .p_read =NULL , + .p_write =NULL , + .p_ioctl = libcfs_ioctl }; static int proc_call_handler(void *data, int write, loff_t *ppos,drivers/video/fbdev/matrox/matroxfb_DAC1064.c +8
-2@@ -1088,14 +1088,20 @@ static void MGAG100_restore(struct matrox_fb_info *minfo)#ifdef CONFIG_FB_MATROX_MYSTIQUE struct matrox_switch matrox_mystique = { - MGA1064_preinit, MGA1064_reset, MGA1064_init, MGA1064_restore, + .preinit = MGA1064_preinit, + .reset = MGA1064_reset, + .init = MGA1064_init, + .restore = MGA1064_restore, };EXPORT_SYMBOL (matrox_mystique);#endif #ifdef CONFIG_FB_MATROX_G struct matrox_switch matrox_G100 = { - MGAG100_preinit, MGAG100_reset, MGAG100_init, MGAG100_restore, + .preinit = MGAG100_preinit, + .reset = MGAG100_reset, + .init = MGAG100_init, + .restore = MGAG100_restore, };EXPORT_SYMBOL (matrox_G100);#endif drivers/video/fbdev/matrox/matroxfb_Ti3026.c +4
-1@@ -738,7 +738,10 @@ static int Ti3026_preinit(struct matrox_fb_info *minfo) }struct matrox_switch matrox_millennium = { - Ti3026_preinit, Ti3026_reset, Ti3026_init, Ti3026_restore + .preinit = Ti3026_preinit, + .reset = Ti3026_reset, + .init = Ti3026_init, + .restore = Ti3026_restore };EXPORT_SYMBOL (matrox_millennium);#endif fs/reiserfs/item_ops.c +12
-12@@ -724,18 +724,18 @@ static void errcatch_print_vi(struct virtual_item *vi) }static struct item_operations errcatch_ops = { - errcatch_bytes_number, - errcatch_decrement_key, - errcatch_is_left_mergeable, - errcatch_print_item, - errcatch_check_item, - - errcatch_create_vi, - errcatch_check_left, - errcatch_check_right, - errcatch_part_size, - errcatch_unit_num, - errcatch_print_vi + .bytes_number = errcatch_bytes_number, + .decrement_key = errcatch_decrement_key, + .is_left_mergeable = errcatch_is_left_mergeable, + .print_item = errcatch_print_item, + .check_item = errcatch_check_item, + + .create_vi = errcatch_create_vi, + .check_left = errcatch_check_left, + .check_right = errcatch_check_right, + .part_size = errcatch_part_size, + .unit_num = errcatch_unit_num, + .print_vi = errcatch_print_vi };#if ! (TYPE_STAT_DATA ==0 &&TYPE_INDIRECT ==1 &&TYPE_DIRECT ==2 &&TYPE_DIRENTRY ==3 )include/linux/rbtree_augmented.h +3
-1@@ -90,7 +90,9 @@ rbname ## _rotate(struct rb_node *rb_old, struct rb_node *rb_new) \ old->rbaugmented =rbcompute (old); \ } \ rbstatic const struct rb_augment_callbacks rbname = { \ - rbname ## _propagate, rbname ## _copy, rbname ## _rotate \ + .propagate = rbname ## _propagate, \ + .copy = rbname ## _copy, \ + .rotate = rbname ## _rotate \ };lib/rbtree.c +3
-1@@ -412,7 +412,9 @@ static inline void dummy_copy(struct rb_node *old, struct rb_node *new) {}static inline void dummy_rotate (struct rb_node *old,struct rb_node *new) {}static const struct rb_augment_callbacks dummy_callbacks = { - dummy_propagate, dummy_copy, dummy_rotate + .propagate = dummy_propagate, + .copy = dummy_copy, + .rotate = dummy_rotate };void rb_insert_color (struct rb_node *node,struct rb_root *root)mm/page_alloc.c +1
-1@@ -561,7 +561,7 @@ static inline void clear_page_guard(struct zone *zone, struct page *page,__mod_zone_freepage_state (zone, (1 << order), migratetype); }#else -struct page_ext_operations debug_guardpage_ops = {NULL , }; +struct page_ext_operations debug_guardpage_ops = { .need =NULL , .init =NULL };static inline void set_page_guard (struct zone *zone,struct page *page,unsigned int order,int migratetype) {} static inline void clear_page_guard(struct zone *zone, struct page *page,net/atm/lec.c +3
-3@@ -111,9 +111,9 @@ static inline void lec_arp_put(struct lec_arp_table *entry) }static struct lane2_ops lane2_ops = { - lane2_resolve,/* resolve, spec 3.1.3 */ - lane2_associate_req,/* associate_req, spec 3.1.4 */ -NULL /* associate indicator, spec 3.1.5 */ + .resolve = lane2_resolve, + .associate_req = lane2_associate_req, + .associate_indicator =NULL };static unsigned char bus_mac[ETH_ALEN ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };net/atm/mpoa_caches.c +20
-21@@ -535,30 +535,29 @@ static void eg_destroy_cache(struct mpoa_client *mpc)static const struct in_cache_ops ingress_ops = { - in_cache_add_entry,/* add_entry */ - in_cache_get,/* get */ - in_cache_get_with_mask,/* get_with_mask */ - in_cache_get_by_vcc,/* get_by_vcc */ - in_cache_put,/* put */ - in_cache_remove_entry,/* remove_entry */ - cache_hit,/* cache_hit */ - clear_count_and_expired,/* clear_count */ - check_resolving_entries,/* check_resolving */ - refresh_entries,/* refresh */ - in_destroy_cache/* destroy_cache */ + .add_entry = in_cache_add_entry, + .get = in_cache_get, + .get_with_mask = in_cache_get_with_mask, + .get_by_vcc = in_cache_get_by_vcc, + .put = in_cache_put, + .remove_entry = in_cache_remove_entry, + .cache_hit = cache_hit, + .clear_count = clear_count_and_expired, + .check_resolving = check_resolving_entries, + .refresh = refresh_entries, };static const struct eg_cache_ops egress_ops = { - eg_cache_add_entry,/* add_entry */ - eg_cache_get_by_cache_id,/* get_by_cache_id */ - eg_cache_get_by_tag,/* get_by_tag */ - eg_cache_get_by_vcc,/* get_by_vcc */ - eg_cache_get_by_src_ip,/* get_by_src_ip */ - eg_cache_put,/* put */ - eg_cache_remove_entry,/* remove_entry */ - update_eg_cache_entry,/* update */ - clear_expired,/* clear_expired */ - eg_destroy_cache/* destroy_cache */ + .add_entry = eg_cache_add_entry, + .get_by_cache_id = eg_cache_get_by_cache_id, + .get_by_tag = eg_cache_get_by_tag, + .get_by_vcc = eg_cache_get_by_vcc, + .get_by_src_ip = eg_cache_get_by_src_ip, + .put = eg_cache_put, + .remove_entry = eg_cache_remove_entry, + .update = update_eg_cache_entry, + .clear_expired = clear_expired, + .destroy_cache = eg_destroy_cache };net/vmw_vsock/vmci_transport_notify.c +15
-15@@ -662,19 +662,19 @@ static void vmci_transport_notify_pkt_process_negotiate(struct sock *sk)/* Socket control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };net/vmw_vsock/vmci_transport_notify_qstate.c +15
-15@@ -420,19 +420,19 @@ vmci_transport_notify_pkt_send_pre_enqueue(/* Socket always on control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };sound/synth/emux/emux_seq.c +7
-8@@ -33,13 +33,13 @@ static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *inf* MIDI emulation operators */ static struct snd_midi_op emux_ops = { - snd_emux_note_on, - snd_emux_note_off, - snd_emux_key_press, - snd_emux_terminate_note, - snd_emux_control, - snd_emux_nrpn, - snd_emux_sysex, + .note_on = snd_emux_note_on, + .note_off = snd_emux_note_off, + .key_press = snd_emux_key_press, + .note_terminate = snd_emux_terminate_note, + .control = snd_emux_control, + .nrpn = snd_emux_nrpn, + .sysex = snd_emux_sysex, }; --Quoted 2 lines
1.9.1
--
Kees Cook
Chrome OS & Brillo Security
[kernel-hardening] Re: [RFC 3/3] Change initialization C99 style; tag no_ramdomize_layout structs
In reply to Kees CookQuoted 13 lines · Kees Cook
Quoted 11 lines · Michael Leibowitz
Due to randomization of structs, the in order struct intialization style is replaced with explicit field style.
struct
foo_tmy_foo= {
one,
two,
three
};becomes
Quoted 8 lines
Quoted 5 lines
struct foo_t my_foo = { .one = one, .two = two, .three = three };Can a coccinelle script be written to do this also? It might be useful to keep that around.
Is this needed for all kinds of structure initializations, ie for both local and global variables, or only for global variables?
thanks,
julia
Quoted 1,193 lines
Quoted 4 lines
Additionally, tag paravirt related structures to explicitly not be randomized, as the structure layout is important.
This might need to be split out? It's logically separate. Also, I think this needs to come before the plugin, since the plugin isn't usable until this patch is in place.
-Kees
Quoted 1,173 lines
This feature is ported over from grsecurity. This is largely unchanged from the Original code written by the PaX Team and Spender.
Signed-off-by Michael Leibowitz <[email protected]>--- arch/x86/include/asm/floppy.h | 20 ++--- arch/x86/include/asm/paravirt_types.h | 18 +++-- drivers/acpi/acpica/hwxfsleep.c | 11 +-- drivers/block/cciss.h | 30 ++++---- drivers/gpu/drm/nouveau/nouveau_ttm.c | 28 +++---- drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 +-- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 10 +-- drivers/infiniband/hw/nes/nes_cm.c | 22 +++--- drivers/isdn/gigaset/bas-gigaset.c | 32 ++++---- drivers/isdn/gigaset/ser-gigaset.c | 32 ++++---- drivers/isdn/gigaset/usb-gigaset.c | 32 ++++---- drivers/isdn/i4l/isdn_concap.c | 6 +- drivers/isdn/i4l/isdn_x25iface.c | 16 ++-- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- drivers/net/ethernet/brocade/bna/bna_enet.c | 8 +- drivers/net/wan/lmc/lmc_media.c | 97 +++++++++++++------------ drivers/scsi/bfa/bfa_fcs.c | 19 ++++- drivers/scsi/bfa/bfa_fcs_lport.c | 29 +++++--- drivers/scsi/bfa/bfa_modules.h | 12 +-- drivers/scsi/hpsa.h | 40 +++++----- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 10 +-- drivers/video/fbdev/matrox/matroxfb_DAC1064.c | 10 ++- drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 5 +- fs/reiserfs/item_ops.c | 24 +++--- include/linux/rbtree_augmented.h | 4 +- lib/rbtree.c | 4 +- mm/page_alloc.c | 2 +- net/atm/lec.c | 6 +- net/atm/mpoa_caches.c | 41 +++++------ net/vmw_vsock/vmci_transport_notify.c | 30 ++++---- net/vmw_vsock/vmci_transport_notify_qstate.c | 30 ++++---- sound/synth/emux/emux_seq.c | 14 ++-- 34 files changed, 352 insertions(+), 314 deletions(-)arch/x86/include/asm/floppy.h +10
-10@@ -229,18 +229,18 @@ static struct fd_routine_l {int (*_dma_setup)(char *addr,unsigned long size,int mode,int io); } fd_routine[] = { { - request_dma, - free_dma, - get_dma_residue, - dma_mem_alloc, - hard_dma_setup + ._request_dma = request_dma, + ._free_dma = free_dma, + ._get_dma_residue = get_dma_residue, + ._dma_mem_alloc = dma_mem_alloc, + ._dma_setup = hard_dma_setup }, { - vdma_request_dma, - vdma_nop, - vdma_get_dma_residue, - vdma_mem_alloc, - vdma_dma_setup + ._request_dma = vdma_request_dma, + ._free_dma = vdma_nop, + ._get_dma_residue = vdma_get_dma_residue, + ._dma_mem_alloc = vdma_mem_alloc, + ._dma_setup = vdma_dma_setup } };arch/x86/include/asm/paravirt_types.h +10
-8@@ -89,7 +89,7 @@ struct pv_init_ops {*/ unsigned (*patch)(u8 type,u16 clobber,void *insnbuf,unsigned long addr,unsigned len); -}; +} __no_randomize_layout;struct pv_lazy_ops {@@ -97,12 +97,12 @@ struct pv_lazy_ops {void (*enter)(void );void (*leave)(void );void (*flush)(void ); -}; +} __no_randomize_layout;struct pv_time_ops {unsigned long long (*sched_clock)(void );unsigned long long (*steal_clock)(int cpu); -}; +} __no_randomize_layout;struct pv_cpu_ops {/* hooks for various privileged instructions */ @@ -178,7 +178,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); -}; +} __no_randomize_layout;struct pv_irq_ops {/* @@ -201,7 +201,7 @@ struct pv_irq_ops {#ifdef CONFIG_X86_64 void (*adjust_exception_frame)(void );#endif -}; +} __no_randomize_layout;struct pv_mmu_ops {unsigned long (*read_cr2)(void );@@ -296,7 +296,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); -}; +} __no_randomize_layout;struct arch_spinlock ;#ifdef CONFIG_SMP @@ -322,7 +322,9 @@ struct pv_lock_ops {/* This contains all the paravirt structures: we get a convenient * number for each function using the offset which we use to indicate -* what to patch. */ +* what to patch. +* shouldn't be randomized due to the "NEAT TRICK" in paravirt.c +*/ struct paravirt_patch_template {struct pv_init_ops pv_init_ops;struct pv_time_ops pv_time_ops;@@ -330,7 +332,7 @@ struct paravirt_patch_template {struct pv_irq_ops pv_irq_ops;struct pv_mmu_ops pv_mmu_ops;struct pv_lock_ops pv_lock_ops; -}; +} __no_randomize_layout;extern struct pv_info pv_info;extern struct pv_init_ops pv_init_ops;drivers/acpi/acpica/hwxfsleep.c +6
-5@@ -70,11 +70,12 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), - acpi_hw_extended_sleep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), - acpi_hw_extended_wake_prep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), acpi_hw_extended_wake} + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), + .extended_function = acpi_hw_extended_sleep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), + .extended_function = acpi_hw_extended_wake_prep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), + .extended_function = acpi_hw_extended_wake} };/* drivers/block/cciss.h +15
-15@@ -402,27 +402,27 @@ static bool SA5_performant_intr_pending(ctlr_info_t *h) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_fifo_full, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5B_access = { - SA5_submit_command, - SA5B_intr_mask, - SA5_fifo_full, - SA5B_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5B_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5B_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_fifo_full, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/gpu/drm/nouveau/nouveau_ttm.c +14
-14@@ -107,10 +107,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func nouveau_vram_manager = { - nouveau_vram_manager_init, - nouveau_vram_manager_fini, - nouveau_vram_manager_new, - nouveau_vram_manager_del, + .init = nouveau_vram_manager_init, + .takedown = nouveau_vram_manager_fini, + .get_node = nouveau_vram_manager_new, + .put_node = nouveau_vram_manager_del, }; static int@@ -183,11 +183,11 @@ nouveau_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nouveau_gart_manager = { - nouveau_gart_manager_init, - nouveau_gart_manager_fini, - nouveau_gart_manager_new, - nouveau_gart_manager_del, - nouveau_gart_manager_debug + .init = nouveau_gart_manager_init, + .takedown = nouveau_gart_manager_fini, + .get_node = nouveau_gart_manager_new, + .put_node = nouveau_gart_manager_del, + .debug = nouveau_gart_manager_debug };/*XXX*/ @@ -256,11 +256,11 @@ nv04_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nv04_gart_manager = { - nv04_gart_manager_init, - nv04_gart_manager_fini, - nv04_gart_manager_new, - nv04_gart_manager_del, - nv04_gart_manager_debug + .init = nv04_gart_manager_init, + .takedown = nv04_gart_manager_fini, + .get_node = nv04_gart_manager_new, + .put_node = nv04_gart_manager_del, + .debug = nv04_gart_manager_debug };int drivers/gpu/drm/ttm/ttm_bo_manager.c +5
-5@@ -148,10 +148,10 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func ttm_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug };EXPORT_SYMBOL (ttm_bo_manager_func);drivers/gpu/drm/virtio/virtgpu_ttm.c +5
-5@@ -198,11 +198,11 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }static const struct ttm_mem_type_manager_func virtio_gpu_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug }; static int virtio_gpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +5
-5@@ -164,9 +164,9 @@ static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func vmw_gmrid_manager_func = { - vmw_gmrid_man_init, - vmw_gmrid_man_takedown, - vmw_gmrid_man_get_node, - vmw_gmrid_man_put_node, - vmw_gmrid_man_debug + .init = vmw_gmrid_man_init, + .takedown = vmw_gmrid_man_takedown, + .get_node = vmw_gmrid_man_get_node, + .put_node = vmw_gmrid_man_put_node, + .debug = vmw_gmrid_man_debug };drivers/infiniband/hw/nes/nes_cm.c +11
-11@@ -135,17 +135,17 @@ static void record_ird_ord(struct nes_cm_node *, u16, u16);/* instance of function pointers for client API */ /* set address of this instance to cm_core->cm_ops at cm_core alloc */ static const struct nes_cm_ops nes_cm_api = { - mini_cm_accelerated, - mini_cm_listen, - mini_cm_del_listen, - mini_cm_connect, - mini_cm_close, - mini_cm_accept, - mini_cm_reject, - mini_cm_recv_pkt, - mini_cm_dealloc_core, - mini_cm_get, - mini_cm_set + .accelerated = mini_cm_accelerated, + .listen = mini_cm_listen, + .stop_listener = mini_cm_del_listen, + .connect = mini_cm_connect, + .close = mini_cm_close, + .accept = mini_cm_accept, + .reject = mini_cm_reject, + .recv_pkt = mini_cm_recv_pkt, + .destroy_cm_core = mini_cm_dealloc_core, + .get = mini_cm_get, + .set = mini_cm_set };static struct nes_cm_core *g_cm_core;drivers/isdn/gigaset/bas-gigaset.c +16
-16@@ -2565,22 +2565,22 @@ static int gigaset_post_reset(struct usb_interface *intf)static const struct gigaset_ops gigops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_isoc_send_skb, - gigaset_isoc_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_isoc_send_skb, + .handle_input = gigaset_isoc_input, };/* bas_gigaset_init drivers/isdn/gigaset/ser-gigaset.c +16
-16@@ -445,22 +445,22 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb,/* asyncdata.c */ - gigaset_m10x_input,/* asyncdata.c */ + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb,/* asyncdata.c */ + .handle_input = gigaset_m10x_input,/* asyncdata.c */ };drivers/isdn/gigaset/usb-gigaset.c +16
-16@@ -862,22 +862,22 @@ static int gigaset_pre_reset(struct usb_interface *intf) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb, - gigaset_m10x_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb, + .handle_input = gigaset_m10x_input, };/* drivers/isdn/i4l/isdn_concap.c +3
-3@@ -80,9 +80,9 @@ static int isdn_concap_dl_disconn_req(struct concap_proto *concap) }struct concap_device_ops isdn_concap_reliable_dl_dops = { - &isdn_concap_dl_data_req, - &isdn_concap_dl_connect_req, - &isdn_concap_dl_disconn_req + .data_req = &isdn_concap_dl_data_req, + .connect_req = &isdn_concap_dl_connect_req, + .disconn_req = &isdn_concap_dl_disconn_req };/* The following should better go into a dedicated source file such that drivers/isdn/i4l/isdn_x25iface.c +8
-8@@ -53,14 +53,14 @@ static int isdn_x25iface_disconn_ind(struct concap_proto *);static struct concap_proto_ops ix25_pops = { - &isdn_x25iface_proto_new, - &isdn_x25iface_proto_del, - &isdn_x25iface_proto_restart, - &isdn_x25iface_proto_close, - &isdn_x25iface_xmit, - &isdn_x25iface_receive, - &isdn_x25iface_connect_ind, - &isdn_x25iface_disconn_ind + .proto_new = &isdn_x25iface_proto_new, + .proto_del = &isdn_x25iface_proto_del, + .restart = &isdn_x25iface_proto_restart, + .close = &isdn_x25iface_proto_close, + .encap_and_xmit = &isdn_x25iface_xmit, + .data_ind = &isdn_x25iface_receive, + .connect_ind = &isdn_x25iface_connect_ind, + .disconn_ind = &isdn_x25iface_disconn_ind };/* error message helper function */ drivers/media/pci/solo6x10/solo6x10-g723.c +1
-1@@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)int solo_g723_init (struct solo_dev *solo_dev) { -static struct snd_device_ops ops = {NULL }; +static struct snd_device_ops ops = { };struct snd_card *card;struct snd_kcontrol_new kctl;char name[32 ];drivers/net/ethernet/brocade/bna/bna_enet.c +4
-4@@ -1676,10 +1676,10 @@ bna_cb_ioceth_reset(void *arg) }static struct bfa_ioc_cbfn bna_ioceth_cbfn = { - bna_cb_ioceth_enable, - bna_cb_ioceth_disable, - bna_cb_ioceth_hbfail, - bna_cb_ioceth_reset + .enable_cbfn = bna_cb_ioceth_enable, + .disable_cbfn = bna_cb_ioceth_disable, + .hbfail_cbfn = bna_cb_ioceth_hbfail, + .reset_cbfn = bna_cb_ioceth_reset };static void bna_attr_init (struct bna_ioceth *ioceth)drivers/net/wan/lmc/lmc_media.c +49
-48@@ -95,62 +95,63 @@ static inline void write_av9110_bit (lmc_softc_t *, int);static void write_av9110 (lmc_softc_t *,u32 ,u32 ,u32 ,u32 ,u32 );lmc_media_t lmc_ds3_media = { - lmc_ds3_init,/* special media init stuff */ - lmc_ds3_default,/* reset to default state */ - lmc_ds3_set_status,/* reset status to state provided */ - lmc_dummy_set_1,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_ds3_set_100ft,/* set cable length */ - lmc_ds3_set_scram,/* set scrambler */ - lmc_ds3_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_ds3_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ds3_watchdog + .init = lmc_ds3_init,/* special media init stuff */ + .defaults = lmc_ds3_default,/* reset to default state */ + .set_status = lmc_ds3_set_status,/* reset status to state provided */ + .set_clock_source = lmc_dummy_set_1,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_ds3_set_100ft,/* set cable length */ + .set_scrambler = lmc_ds3_set_scram,/* set scrambler */ + .get_link_status = lmc_ds3_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_ds3_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ds3_watchdog };lmc_media_t lmc_hssi_media = { - lmc_hssi_init,/* special media init stuff */ - lmc_hssi_default,/* reset to default state */ - lmc_hssi_set_status,/* reset status to state provided */ - lmc_hssi_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_hssi_get_link_status,/* get link status */ - lmc_hssi_set_link_status,/* set link status */ - lmc_hssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_hssi_watchdog + .init = lmc_hssi_init,/* special media init stuff */ + .defaults = lmc_hssi_default,/* reset to default state */ + .set_status = lmc_hssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_hssi_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_hssi_get_link_status,/* get link status */ + .set_link_status = lmc_hssi_set_link_status,/* set link status */ + .set_crc_length = lmc_hssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_hssi_watchdog }; -lmc_media_t lmc_ssi_media = { lmc_ssi_init,/* special media init stuff */ - lmc_ssi_default,/* reset to default state */ - lmc_ssi_set_status,/* reset status to state provided */ - lmc_ssi_set_clock,/* set clock source */ - lmc_ssi_set_speed,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_ssi_get_link_status,/* get link status */ - lmc_ssi_set_link_status,/* set link status */ - lmc_ssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ssi_watchdog +lmc_media_t lmc_ssi_media = { + .init = lmc_ssi_init,/* special media init stuff */ + .defaults = lmc_ssi_default,/* reset to default state */ + .set_status = lmc_ssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_ssi_set_clock,/* set clock source */ + .set_speed = lmc_ssi_set_speed,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_ssi_get_link_status,/* get link status */ + .set_link_status = lmc_ssi_set_link_status,/* set link status */ + .set_crc_length = lmc_ssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ssi_watchdog };lmc_media_t lmc_t1_media = { - lmc_t1_init,/* special media init stuff */ - lmc_t1_default,/* reset to default state */ - lmc_t1_set_status,/* reset status to state provided */ - lmc_t1_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_t1_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_t1_set_crc_length,/* set CRC length */ - lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ - lmc_t1_watchdog + .init = lmc_t1_init,/* special media init stuff */ + .defaults = lmc_t1_default,/* reset to default state */ + .set_status = lmc_t1_set_status,/* reset status to state provided */ + .set_clock_source = lmc_t1_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_t1_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_t1_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ + .watchdog = lmc_t1_watchdog }; static voiddrivers/scsi/bfa/bfa_fcs.c +15
-4@@ -39,10 +39,21 @@ struct bfa_fcs_mod_s {#define BFA_FCS_MODULE (_mod) { _mod ## _modinit, _mod ## _modexit }static struct bfa_fcs_mod_s fcs_modules[] = { - { bfa_fcs_port_attach,NULL ,NULL }, - { bfa_fcs_uf_attach,NULL ,NULL }, - { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit, - bfa_fcs_fabric_modexit }, + { + .attach = bfa_fcs_port_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_uf_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_fabric_attach, + .modinit = bfa_fcs_fabric_modinit, + .modexit = bfa_fcs_fabric_modexit + }, };/* drivers/scsi/bfa/bfa_fcs_lport.c +20
-9@@ -90,15 +90,26 @@ static struct {void (*offline) (struct bfa_fcs_lport_s *port); } __port_action[] = { { - bfa_fcs_lport_unknown_init, bfa_fcs_lport_unknown_online, - bfa_fcs_lport_unknown_offline}, { - bfa_fcs_lport_fab_init, bfa_fcs_lport_fab_online, - bfa_fcs_lport_fab_offline}, { - bfa_fcs_lport_n2n_init, bfa_fcs_lport_n2n_online, - bfa_fcs_lport_n2n_offline}, { - bfa_fcs_lport_loop_init, bfa_fcs_lport_loop_online, - bfa_fcs_lport_loop_offline}, - }; + .init = bfa_fcs_lport_unknown_init, + .online = bfa_fcs_lport_unknown_online, + .offline = bfa_fcs_lport_unknown_offline + }, + { + .init = bfa_fcs_lport_fab_init, + .online = bfa_fcs_lport_fab_online, + .offline = bfa_fcs_lport_fab_offline + }, + { + .init = bfa_fcs_lport_n2n_init, + .online = bfa_fcs_lport_n2n_online, + .offline = bfa_fcs_lport_n2n_offline + }, + { + .init = bfa_fcs_lport_loop_init, + .online = bfa_fcs_lport_loop_online, + .offline = bfa_fcs_lport_loop_offline + }, +}; /* * fcs_port_sm FCS logical port state machinedrivers/scsi/bfa/bfa_modules.h +6
-6@@ -79,12 +79,12 @@ enum { \ extern struct bfa_module_s hal_mod_ ## __mod; \ struct bfa_module_s hal_mod_ ## __mod = { \ - bfa_ ## __mod ## _meminfo, \ - bfa_ ## __mod ## _attach, \ - bfa_ ## __mod ## _detach, \ - bfa_ ## __mod ## _start, \ - bfa_ ## __mod ## _stop, \ - bfa_ ## __mod ## _iocdisable, \ + .meminfo = bfa_ ## __mod ## _meminfo, \ + .attach = bfa_ ## __mod ## _attach, \ + .detach = bfa_ ## __mod ## _detach, \ + .start = bfa_ ## __mod ## _start, \ + .stop = bfa_ ## __mod ## _stop, \ + .iocdisable = bfa_ ## __mod ## _iocdisable, \ }#define BFA_CACHELINE_SZ (256)drivers/scsi/hpsa.h +20
-20@@ -577,38 +577,38 @@ static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_ioaccel_mode1_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_ioaccel_mode1_intr_pending, - SA5_ioaccel_mode1_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_ioaccel_mode1_intr_pending, + .command_completed = SA5_ioaccel_mode1_completed, };static struct access_method SA5_ioaccel_mode2_access = { - SA5_submit_command_ioaccel2, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_ioaccel2, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access_no_read = { - SA5_submit_command_no_read, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_no_read, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +1
-1@@ -147,7 +147,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,int added = (mode ==LCK_NL );int overlaps =0 ;int splitted =0 ; -const struct ldlm_callback_suite null_cbs = {NULL }; +const struct ldlm_callback_suite null_cbs = { }; CDEBUG(D_DLMTRACE, "flags %#llx owner %llu pid %u mode %u start %llu end %llu\n",drivers/staging/lustre/lustre/libcfs/module.c +5
-5@@ -322,11 +322,11 @@ out: }struct cfs_psdev_ops libcfs_psdev_ops = { - libcfs_psdev_open, - libcfs_psdev_release, -NULL , -NULL , - libcfs_ioctl + .p_open = libcfs_psdev_open, + .p_close = libcfs_psdev_release, + .p_read =NULL , + .p_write =NULL , + .p_ioctl = libcfs_ioctl }; static int proc_call_handler(void *data, int write, loff_t *ppos,drivers/video/fbdev/matrox/matroxfb_DAC1064.c +8
-2@@ -1088,14 +1088,20 @@ static void MGAG100_restore(struct matrox_fb_info *minfo)#ifdef CONFIG_FB_MATROX_MYSTIQUE struct matrox_switch matrox_mystique = { - MGA1064_preinit, MGA1064_reset, MGA1064_init, MGA1064_restore, + .preinit = MGA1064_preinit, + .reset = MGA1064_reset, + .init = MGA1064_init, + .restore = MGA1064_restore, };EXPORT_SYMBOL (matrox_mystique);#endif #ifdef CONFIG_FB_MATROX_G struct matrox_switch matrox_G100 = { - MGAG100_preinit, MGAG100_reset, MGAG100_init, MGAG100_restore, + .preinit = MGAG100_preinit, + .reset = MGAG100_reset, + .init = MGAG100_init, + .restore = MGAG100_restore, };EXPORT_SYMBOL (matrox_G100);#endif drivers/video/fbdev/matrox/matroxfb_Ti3026.c +4
-1@@ -738,7 +738,10 @@ static int Ti3026_preinit(struct matrox_fb_info *minfo) }struct matrox_switch matrox_millennium = { - Ti3026_preinit, Ti3026_reset, Ti3026_init, Ti3026_restore + .preinit = Ti3026_preinit, + .reset = Ti3026_reset, + .init = Ti3026_init, + .restore = Ti3026_restore };EXPORT_SYMBOL (matrox_millennium);#endif fs/reiserfs/item_ops.c +12
-12@@ -724,18 +724,18 @@ static void errcatch_print_vi(struct virtual_item *vi) }static struct item_operations errcatch_ops = { - errcatch_bytes_number, - errcatch_decrement_key, - errcatch_is_left_mergeable, - errcatch_print_item, - errcatch_check_item, - - errcatch_create_vi, - errcatch_check_left, - errcatch_check_right, - errcatch_part_size, - errcatch_unit_num, - errcatch_print_vi + .bytes_number = errcatch_bytes_number, + .decrement_key = errcatch_decrement_key, + .is_left_mergeable = errcatch_is_left_mergeable, + .print_item = errcatch_print_item, + .check_item = errcatch_check_item, + + .create_vi = errcatch_create_vi, + .check_left = errcatch_check_left, + .check_right = errcatch_check_right, + .part_size = errcatch_part_size, + .unit_num = errcatch_unit_num, + .print_vi = errcatch_print_vi };#if ! (TYPE_STAT_DATA ==0 &&TYPE_INDIRECT ==1 &&TYPE_DIRECT ==2 &&TYPE_DIRENTRY ==3 )include/linux/rbtree_augmented.h +3
-1@@ -90,7 +90,9 @@ rbname ## _rotate(struct rb_node *rb_old, struct rb_node *rb_new) \ old->rbaugmented =rbcompute (old); \ } \ rbstatic const struct rb_augment_callbacks rbname = { \ - rbname ## _propagate, rbname ## _copy, rbname ## _rotate \ + .propagate = rbname ## _propagate, \ + .copy = rbname ## _copy, \ + .rotate = rbname ## _rotate \ };lib/rbtree.c +3
-1@@ -412,7 +412,9 @@ static inline void dummy_copy(struct rb_node *old, struct rb_node *new) {}static inline void dummy_rotate (struct rb_node *old,struct rb_node *new) {}static const struct rb_augment_callbacks dummy_callbacks = { - dummy_propagate, dummy_copy, dummy_rotate + .propagate = dummy_propagate, + .copy = dummy_copy, + .rotate = dummy_rotate };void rb_insert_color (struct rb_node *node,struct rb_root *root)mm/page_alloc.c +1
-1@@ -561,7 +561,7 @@ static inline void clear_page_guard(struct zone *zone, struct page *page,__mod_zone_freepage_state (zone, (1 << order), migratetype); }#else -struct page_ext_operations debug_guardpage_ops = {NULL , }; +struct page_ext_operations debug_guardpage_ops = { .need =NULL , .init =NULL };static inline void set_page_guard (struct zone *zone,struct page *page,unsigned int order,int migratetype) {} static inline void clear_page_guard(struct zone *zone, struct page *page,net/atm/lec.c +3
-3@@ -111,9 +111,9 @@ static inline void lec_arp_put(struct lec_arp_table *entry) }static struct lane2_ops lane2_ops = { - lane2_resolve,/* resolve, spec 3.1.3 */ - lane2_associate_req,/* associate_req, spec 3.1.4 */ -NULL /* associate indicator, spec 3.1.5 */ + .resolve = lane2_resolve, + .associate_req = lane2_associate_req, + .associate_indicator =NULL };static unsigned char bus_mac[ETH_ALEN ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };net/atm/mpoa_caches.c +20
-21@@ -535,30 +535,29 @@ static void eg_destroy_cache(struct mpoa_client *mpc)static const struct in_cache_ops ingress_ops = { - in_cache_add_entry,/* add_entry */ - in_cache_get,/* get */ - in_cache_get_with_mask,/* get_with_mask */ - in_cache_get_by_vcc,/* get_by_vcc */ - in_cache_put,/* put */ - in_cache_remove_entry,/* remove_entry */ - cache_hit,/* cache_hit */ - clear_count_and_expired,/* clear_count */ - check_resolving_entries,/* check_resolving */ - refresh_entries,/* refresh */ - in_destroy_cache/* destroy_cache */ + .add_entry = in_cache_add_entry, + .get = in_cache_get, + .get_with_mask = in_cache_get_with_mask, + .get_by_vcc = in_cache_get_by_vcc, + .put = in_cache_put, + .remove_entry = in_cache_remove_entry, + .cache_hit = cache_hit, + .clear_count = clear_count_and_expired, + .check_resolving = check_resolving_entries, + .refresh = refresh_entries, };static const struct eg_cache_ops egress_ops = { - eg_cache_add_entry,/* add_entry */ - eg_cache_get_by_cache_id,/* get_by_cache_id */ - eg_cache_get_by_tag,/* get_by_tag */ - eg_cache_get_by_vcc,/* get_by_vcc */ - eg_cache_get_by_src_ip,/* get_by_src_ip */ - eg_cache_put,/* put */ - eg_cache_remove_entry,/* remove_entry */ - update_eg_cache_entry,/* update */ - clear_expired,/* clear_expired */ - eg_destroy_cache/* destroy_cache */ + .add_entry = eg_cache_add_entry, + .get_by_cache_id = eg_cache_get_by_cache_id, + .get_by_tag = eg_cache_get_by_tag, + .get_by_vcc = eg_cache_get_by_vcc, + .get_by_src_ip = eg_cache_get_by_src_ip, + .put = eg_cache_put, + .remove_entry = eg_cache_remove_entry, + .update = update_eg_cache_entry, + .clear_expired = clear_expired, + .destroy_cache = eg_destroy_cache };net/vmw_vsock/vmci_transport_notify.c +15
-15@@ -662,19 +662,19 @@ static void vmci_transport_notify_pkt_process_negotiate(struct sock *sk)/* Socket control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };net/vmw_vsock/vmci_transport_notify_qstate.c +15
-15@@ -420,19 +420,19 @@ vmci_transport_notify_pkt_send_pre_enqueue(/* Socket always on control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };sound/synth/emux/emux_seq.c +7
-8@@ -33,13 +33,13 @@ static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *inf* MIDI emulation operators */ static struct snd_midi_op emux_ops = { - snd_emux_note_on, - snd_emux_note_off, - snd_emux_key_press, - snd_emux_terminate_note, - snd_emux_control, - snd_emux_nrpn, - snd_emux_sysex, + .note_on = snd_emux_note_on, + .note_off = snd_emux_note_off, + .key_press = snd_emux_key_press, + .note_terminate = snd_emux_terminate_note, + .control = snd_emux_control, + .nrpn = snd_emux_nrpn, + .sysex = snd_emux_sysex, }; --Quoted 2 lines
1.9.1
--
Kees Cook
Chrome OS & Brillo Security
[kernel-hardening] Re: [RFC 3/3] Change initialization C99 style; tag no_ramdomize_layout structs
Quoted 21 lines · Julia Lawall
Quoted 19 lines · Kees Cook
Quoted 16 lines · Michael Leibowitz
Due to randomization of structs, the in order struct intialization style is replaced with explicit field style.
struct
foo_tmy_foo= {
one,
two,
three
};becomes
struct foo_t my_foo = { .one = one, .two = two, .three = three };
Quoted 5 lines
Quoted 2 lines
Can a coccinelle script be written to do this also? It might be useful to keep that around.
Is this needed for all kinds of structure initializations, ie for both local and global variables, or only for global variables?
It's needed for any structure that has been globally defined. As in, any use of a struct must be using C99 since that structure may be randomized (in any context: global, local).
Michael, what's the state of this series? What're your next steps?
-Kees
Quoted 1,197 lines
thanks,
juliaQuoted 1,193 lines
Quoted 4 lines
Additionally, tag paravirt related structures to explicitly not be randomized, as the structure layout is important.
This might need to be split out? It's logically separate. Also, I think this needs to come before the plugin, since the plugin isn't usable until this patch is in place.
-Kees
Quoted 1,173 lines
This feature is ported over from grsecurity. This is largely unchanged from the Original code written by the PaX Team and Spender.
Signed-off-by Michael Leibowitz <[email protected]>--- arch/x86/include/asm/floppy.h | 20 ++--- arch/x86/include/asm/paravirt_types.h | 18 +++-- drivers/acpi/acpica/hwxfsleep.c | 11 +-- drivers/block/cciss.h | 30 ++++---- drivers/gpu/drm/nouveau/nouveau_ttm.c | 28 +++---- drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 +-- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 10 +-- drivers/infiniband/hw/nes/nes_cm.c | 22 +++--- drivers/isdn/gigaset/bas-gigaset.c | 32 ++++---- drivers/isdn/gigaset/ser-gigaset.c | 32 ++++---- drivers/isdn/gigaset/usb-gigaset.c | 32 ++++---- drivers/isdn/i4l/isdn_concap.c | 6 +- drivers/isdn/i4l/isdn_x25iface.c | 16 ++-- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- drivers/net/ethernet/brocade/bna/bna_enet.c | 8 +- drivers/net/wan/lmc/lmc_media.c | 97 +++++++++++++------------ drivers/scsi/bfa/bfa_fcs.c | 19 ++++- drivers/scsi/bfa/bfa_fcs_lport.c | 29 +++++--- drivers/scsi/bfa/bfa_modules.h | 12 +-- drivers/scsi/hpsa.h | 40 +++++----- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 10 +-- drivers/video/fbdev/matrox/matroxfb_DAC1064.c | 10 ++- drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 5 +- fs/reiserfs/item_ops.c | 24 +++--- include/linux/rbtree_augmented.h | 4 +- lib/rbtree.c | 4 +- mm/page_alloc.c | 2 +- net/atm/lec.c | 6 +- net/atm/mpoa_caches.c | 41 +++++------ net/vmw_vsock/vmci_transport_notify.c | 30 ++++---- net/vmw_vsock/vmci_transport_notify_qstate.c | 30 ++++---- sound/synth/emux/emux_seq.c | 14 ++-- 34 files changed, 352 insertions(+), 314 deletions(-)arch/x86/include/asm/floppy.h +10
-10@@ -229,18 +229,18 @@ static struct fd_routine_l {int (*_dma_setup)(char *addr,unsigned long size,int mode,int io); } fd_routine[] = { { - request_dma, - free_dma, - get_dma_residue, - dma_mem_alloc, - hard_dma_setup + ._request_dma = request_dma, + ._free_dma = free_dma, + ._get_dma_residue = get_dma_residue, + ._dma_mem_alloc = dma_mem_alloc, + ._dma_setup = hard_dma_setup }, { - vdma_request_dma, - vdma_nop, - vdma_get_dma_residue, - vdma_mem_alloc, - vdma_dma_setup + ._request_dma = vdma_request_dma, + ._free_dma = vdma_nop, + ._get_dma_residue = vdma_get_dma_residue, + ._dma_mem_alloc = vdma_mem_alloc, + ._dma_setup = vdma_dma_setup } };arch/x86/include/asm/paravirt_types.h +10
-8@@ -89,7 +89,7 @@ struct pv_init_ops {*/ unsigned (*patch)(u8 type,u16 clobber,void *insnbuf,unsigned long addr,unsigned len); -}; +} __no_randomize_layout;struct pv_lazy_ops {@@ -97,12 +97,12 @@ struct pv_lazy_ops {void (*enter)(void );void (*leave)(void );void (*flush)(void ); -}; +} __no_randomize_layout;struct pv_time_ops {unsigned long long (*sched_clock)(void );unsigned long long (*steal_clock)(int cpu); -}; +} __no_randomize_layout;struct pv_cpu_ops {/* hooks for various privileged instructions */ @@ -178,7 +178,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); -}; +} __no_randomize_layout;struct pv_irq_ops {/* @@ -201,7 +201,7 @@ struct pv_irq_ops {#ifdef CONFIG_X86_64 void (*adjust_exception_frame)(void );#endif -}; +} __no_randomize_layout;struct pv_mmu_ops {unsigned long (*read_cr2)(void );@@ -296,7 +296,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); -}; +} __no_randomize_layout;struct arch_spinlock ;#ifdef CONFIG_SMP @@ -322,7 +322,9 @@ struct pv_lock_ops {/* This contains all the paravirt structures: we get a convenient * number for each function using the offset which we use to indicate -* what to patch. */ +* what to patch. +* shouldn't be randomized due to the "NEAT TRICK" in paravirt.c +*/ struct paravirt_patch_template {struct pv_init_ops pv_init_ops;struct pv_time_ops pv_time_ops;@@ -330,7 +332,7 @@ struct paravirt_patch_template {struct pv_irq_ops pv_irq_ops;struct pv_mmu_ops pv_mmu_ops;struct pv_lock_ops pv_lock_ops; -}; +} __no_randomize_layout;extern struct pv_info pv_info;extern struct pv_init_ops pv_init_ops;drivers/acpi/acpica/hwxfsleep.c +6
-5@@ -70,11 +70,12 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), - acpi_hw_extended_sleep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), - acpi_hw_extended_wake_prep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), acpi_hw_extended_wake} + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), + .extended_function = acpi_hw_extended_sleep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), + .extended_function = acpi_hw_extended_wake_prep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), + .extended_function = acpi_hw_extended_wake} };/* drivers/block/cciss.h +15
-15@@ -402,27 +402,27 @@ static bool SA5_performant_intr_pending(ctlr_info_t *h) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_fifo_full, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5B_access = { - SA5_submit_command, - SA5B_intr_mask, - SA5_fifo_full, - SA5B_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5B_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5B_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_fifo_full, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/gpu/drm/nouveau/nouveau_ttm.c +14
-14@@ -107,10 +107,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func nouveau_vram_manager = { - nouveau_vram_manager_init, - nouveau_vram_manager_fini, - nouveau_vram_manager_new, - nouveau_vram_manager_del, + .init = nouveau_vram_manager_init, + .takedown = nouveau_vram_manager_fini, + .get_node = nouveau_vram_manager_new, + .put_node = nouveau_vram_manager_del, }; static int@@ -183,11 +183,11 @@ nouveau_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nouveau_gart_manager = { - nouveau_gart_manager_init, - nouveau_gart_manager_fini, - nouveau_gart_manager_new, - nouveau_gart_manager_del, - nouveau_gart_manager_debug + .init = nouveau_gart_manager_init, + .takedown = nouveau_gart_manager_fini, + .get_node = nouveau_gart_manager_new, + .put_node = nouveau_gart_manager_del, + .debug = nouveau_gart_manager_debug };/*XXX*/ @@ -256,11 +256,11 @@ nv04_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nv04_gart_manager = { - nv04_gart_manager_init, - nv04_gart_manager_fini, - nv04_gart_manager_new, - nv04_gart_manager_del, - nv04_gart_manager_debug + .init = nv04_gart_manager_init, + .takedown = nv04_gart_manager_fini, + .get_node = nv04_gart_manager_new, + .put_node = nv04_gart_manager_del, + .debug = nv04_gart_manager_debug };int drivers/gpu/drm/ttm/ttm_bo_manager.c +5
-5@@ -148,10 +148,10 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func ttm_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug };EXPORT_SYMBOL (ttm_bo_manager_func);drivers/gpu/drm/virtio/virtgpu_ttm.c +5
-5@@ -198,11 +198,11 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }static const struct ttm_mem_type_manager_func virtio_gpu_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug }; static int virtio_gpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +5
-5@@ -164,9 +164,9 @@ static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func vmw_gmrid_manager_func = { - vmw_gmrid_man_init, - vmw_gmrid_man_takedown, - vmw_gmrid_man_get_node, - vmw_gmrid_man_put_node, - vmw_gmrid_man_debug + .init = vmw_gmrid_man_init, + .takedown = vmw_gmrid_man_takedown, + .get_node = vmw_gmrid_man_get_node, + .put_node = vmw_gmrid_man_put_node, + .debug = vmw_gmrid_man_debug };drivers/infiniband/hw/nes/nes_cm.c +11
-11@@ -135,17 +135,17 @@ static void record_ird_ord(struct nes_cm_node *, u16, u16);/* instance of function pointers for client API */ /* set address of this instance to cm_core->cm_ops at cm_core alloc */ static const struct nes_cm_ops nes_cm_api = { - mini_cm_accelerated, - mini_cm_listen, - mini_cm_del_listen, - mini_cm_connect, - mini_cm_close, - mini_cm_accept, - mini_cm_reject, - mini_cm_recv_pkt, - mini_cm_dealloc_core, - mini_cm_get, - mini_cm_set + .accelerated = mini_cm_accelerated, + .listen = mini_cm_listen, + .stop_listener = mini_cm_del_listen, + .connect = mini_cm_connect, + .close = mini_cm_close, + .accept = mini_cm_accept, + .reject = mini_cm_reject, + .recv_pkt = mini_cm_recv_pkt, + .destroy_cm_core = mini_cm_dealloc_core, + .get = mini_cm_get, + .set = mini_cm_set };static struct nes_cm_core *g_cm_core;drivers/isdn/gigaset/bas-gigaset.c +16
-16@@ -2565,22 +2565,22 @@ static int gigaset_post_reset(struct usb_interface *intf)static const struct gigaset_ops gigops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_isoc_send_skb, - gigaset_isoc_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_isoc_send_skb, + .handle_input = gigaset_isoc_input, };/* bas_gigaset_init drivers/isdn/gigaset/ser-gigaset.c +16
-16@@ -445,22 +445,22 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb,/* asyncdata.c */ - gigaset_m10x_input,/* asyncdata.c */ + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb,/* asyncdata.c */ + .handle_input = gigaset_m10x_input,/* asyncdata.c */ };drivers/isdn/gigaset/usb-gigaset.c +16
-16@@ -862,22 +862,22 @@ static int gigaset_pre_reset(struct usb_interface *intf) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb, - gigaset_m10x_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb, + .handle_input = gigaset_m10x_input, };/* drivers/isdn/i4l/isdn_concap.c +3
-3@@ -80,9 +80,9 @@ static int isdn_concap_dl_disconn_req(struct concap_proto *concap) }struct concap_device_ops isdn_concap_reliable_dl_dops = { - &isdn_concap_dl_data_req, - &isdn_concap_dl_connect_req, - &isdn_concap_dl_disconn_req + .data_req = &isdn_concap_dl_data_req, + .connect_req = &isdn_concap_dl_connect_req, + .disconn_req = &isdn_concap_dl_disconn_req };/* The following should better go into a dedicated source file such that drivers/isdn/i4l/isdn_x25iface.c +8
-8@@ -53,14 +53,14 @@ static int isdn_x25iface_disconn_ind(struct concap_proto *);static struct concap_proto_ops ix25_pops = { - &isdn_x25iface_proto_new, - &isdn_x25iface_proto_del, - &isdn_x25iface_proto_restart, - &isdn_x25iface_proto_close, - &isdn_x25iface_xmit, - &isdn_x25iface_receive, - &isdn_x25iface_connect_ind, - &isdn_x25iface_disconn_ind + .proto_new = &isdn_x25iface_proto_new, + .proto_del = &isdn_x25iface_proto_del, + .restart = &isdn_x25iface_proto_restart, + .close = &isdn_x25iface_proto_close, + .encap_and_xmit = &isdn_x25iface_xmit, + .data_ind = &isdn_x25iface_receive, + .connect_ind = &isdn_x25iface_connect_ind, + .disconn_ind = &isdn_x25iface_disconn_ind };/* error message helper function */ drivers/media/pci/solo6x10/solo6x10-g723.c +1
-1@@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)int solo_g723_init (struct solo_dev *solo_dev) { -static struct snd_device_ops ops = {NULL }; +static struct snd_device_ops ops = { };struct snd_card *card;struct snd_kcontrol_new kctl;char name[32 ];drivers/net/ethernet/brocade/bna/bna_enet.c +4
-4@@ -1676,10 +1676,10 @@ bna_cb_ioceth_reset(void *arg) }static struct bfa_ioc_cbfn bna_ioceth_cbfn = { - bna_cb_ioceth_enable, - bna_cb_ioceth_disable, - bna_cb_ioceth_hbfail, - bna_cb_ioceth_reset + .enable_cbfn = bna_cb_ioceth_enable, + .disable_cbfn = bna_cb_ioceth_disable, + .hbfail_cbfn = bna_cb_ioceth_hbfail, + .reset_cbfn = bna_cb_ioceth_reset };static void bna_attr_init (struct bna_ioceth *ioceth)drivers/net/wan/lmc/lmc_media.c +49
-48@@ -95,62 +95,63 @@ static inline void write_av9110_bit (lmc_softc_t *, int);static void write_av9110 (lmc_softc_t *,u32 ,u32 ,u32 ,u32 ,u32 );lmc_media_t lmc_ds3_media = { - lmc_ds3_init,/* special media init stuff */ - lmc_ds3_default,/* reset to default state */ - lmc_ds3_set_status,/* reset status to state provided */ - lmc_dummy_set_1,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_ds3_set_100ft,/* set cable length */ - lmc_ds3_set_scram,/* set scrambler */ - lmc_ds3_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_ds3_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ds3_watchdog + .init = lmc_ds3_init,/* special media init stuff */ + .defaults = lmc_ds3_default,/* reset to default state */ + .set_status = lmc_ds3_set_status,/* reset status to state provided */ + .set_clock_source = lmc_dummy_set_1,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_ds3_set_100ft,/* set cable length */ + .set_scrambler = lmc_ds3_set_scram,/* set scrambler */ + .get_link_status = lmc_ds3_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_ds3_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ds3_watchdog };lmc_media_t lmc_hssi_media = { - lmc_hssi_init,/* special media init stuff */ - lmc_hssi_default,/* reset to default state */ - lmc_hssi_set_status,/* reset status to state provided */ - lmc_hssi_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_hssi_get_link_status,/* get link status */ - lmc_hssi_set_link_status,/* set link status */ - lmc_hssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_hssi_watchdog + .init = lmc_hssi_init,/* special media init stuff */ + .defaults = lmc_hssi_default,/* reset to default state */ + .set_status = lmc_hssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_hssi_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_hssi_get_link_status,/* get link status */ + .set_link_status = lmc_hssi_set_link_status,/* set link status */ + .set_crc_length = lmc_hssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_hssi_watchdog }; -lmc_media_t lmc_ssi_media = { lmc_ssi_init,/* special media init stuff */ - lmc_ssi_default,/* reset to default state */ - lmc_ssi_set_status,/* reset status to state provided */ - lmc_ssi_set_clock,/* set clock source */ - lmc_ssi_set_speed,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_ssi_get_link_status,/* get link status */ - lmc_ssi_set_link_status,/* set link status */ - lmc_ssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ssi_watchdog +lmc_media_t lmc_ssi_media = { + .init = lmc_ssi_init,/* special media init stuff */ + .defaults = lmc_ssi_default,/* reset to default state */ + .set_status = lmc_ssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_ssi_set_clock,/* set clock source */ + .set_speed = lmc_ssi_set_speed,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_ssi_get_link_status,/* get link status */ + .set_link_status = lmc_ssi_set_link_status,/* set link status */ + .set_crc_length = lmc_ssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ssi_watchdog };lmc_media_t lmc_t1_media = { - lmc_t1_init,/* special media init stuff */ - lmc_t1_default,/* reset to default state */ - lmc_t1_set_status,/* reset status to state provided */ - lmc_t1_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_t1_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_t1_set_crc_length,/* set CRC length */ - lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ - lmc_t1_watchdog + .init = lmc_t1_init,/* special media init stuff */ + .defaults = lmc_t1_default,/* reset to default state */ + .set_status = lmc_t1_set_status,/* reset status to state provided */ + .set_clock_source = lmc_t1_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_t1_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_t1_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ + .watchdog = lmc_t1_watchdog }; static voiddrivers/scsi/bfa/bfa_fcs.c +15
-4@@ -39,10 +39,21 @@ struct bfa_fcs_mod_s {#define BFA_FCS_MODULE (_mod) { _mod ## _modinit, _mod ## _modexit }static struct bfa_fcs_mod_s fcs_modules[] = { - { bfa_fcs_port_attach,NULL ,NULL }, - { bfa_fcs_uf_attach,NULL ,NULL }, - { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit, - bfa_fcs_fabric_modexit }, + { + .attach = bfa_fcs_port_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_uf_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_fabric_attach, + .modinit = bfa_fcs_fabric_modinit, + .modexit = bfa_fcs_fabric_modexit + }, };/* drivers/scsi/bfa/bfa_fcs_lport.c +20
-9@@ -90,15 +90,26 @@ static struct {void (*offline) (struct bfa_fcs_lport_s *port); } __port_action[] = { { - bfa_fcs_lport_unknown_init, bfa_fcs_lport_unknown_online, - bfa_fcs_lport_unknown_offline}, { - bfa_fcs_lport_fab_init, bfa_fcs_lport_fab_online, - bfa_fcs_lport_fab_offline}, { - bfa_fcs_lport_n2n_init, bfa_fcs_lport_n2n_online, - bfa_fcs_lport_n2n_offline}, { - bfa_fcs_lport_loop_init, bfa_fcs_lport_loop_online, - bfa_fcs_lport_loop_offline}, - }; + .init = bfa_fcs_lport_unknown_init, + .online = bfa_fcs_lport_unknown_online, + .offline = bfa_fcs_lport_unknown_offline + }, + { + .init = bfa_fcs_lport_fab_init, + .online = bfa_fcs_lport_fab_online, + .offline = bfa_fcs_lport_fab_offline + }, + { + .init = bfa_fcs_lport_n2n_init, + .online = bfa_fcs_lport_n2n_online, + .offline = bfa_fcs_lport_n2n_offline + }, + { + .init = bfa_fcs_lport_loop_init, + .online = bfa_fcs_lport_loop_online, + .offline = bfa_fcs_lport_loop_offline + }, +}; /* * fcs_port_sm FCS logical port state machinedrivers/scsi/bfa/bfa_modules.h +6
-6@@ -79,12 +79,12 @@ enum { \ extern struct bfa_module_s hal_mod_ ## __mod; \ struct bfa_module_s hal_mod_ ## __mod = { \ - bfa_ ## __mod ## _meminfo, \ - bfa_ ## __mod ## _attach, \ - bfa_ ## __mod ## _detach, \ - bfa_ ## __mod ## _start, \ - bfa_ ## __mod ## _stop, \ - bfa_ ## __mod ## _iocdisable, \ + .meminfo = bfa_ ## __mod ## _meminfo, \ + .attach = bfa_ ## __mod ## _attach, \ + .detach = bfa_ ## __mod ## _detach, \ + .start = bfa_ ## __mod ## _start, \ + .stop = bfa_ ## __mod ## _stop, \ + .iocdisable = bfa_ ## __mod ## _iocdisable, \ }#define BFA_CACHELINE_SZ (256)drivers/scsi/hpsa.h +20
-20@@ -577,38 +577,38 @@ static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_ioaccel_mode1_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_ioaccel_mode1_intr_pending, - SA5_ioaccel_mode1_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_ioaccel_mode1_intr_pending, + .command_completed = SA5_ioaccel_mode1_completed, };static struct access_method SA5_ioaccel_mode2_access = { - SA5_submit_command_ioaccel2, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_ioaccel2, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access_no_read = { - SA5_submit_command_no_read, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_no_read, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +1
-1@@ -147,7 +147,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,int added = (mode ==LCK_NL );int overlaps =0 ;int splitted =0 ; -const struct ldlm_callback_suite null_cbs = {NULL }; +const struct ldlm_callback_suite null_cbs = { }; CDEBUG(D_DLMTRACE, "flags %#llx owner %llu pid %u mode %u start %llu end %llu\n",drivers/staging/lustre/lustre/libcfs/module.c +5
-5@@ -322,11 +322,11 @@ out: }struct cfs_psdev_ops libcfs_psdev_ops = { - libcfs_psdev_open, - libcfs_psdev_release, -NULL , -NULL , - libcfs_ioctl + .p_open = libcfs_psdev_open, + .p_close = libcfs_psdev_release, + .p_read =NULL , + .p_write =NULL , + .p_ioctl = libcfs_ioctl }; static int proc_call_handler(void *data, int write, loff_t *ppos,drivers/video/fbdev/matrox/matroxfb_DAC1064.c +8
-2@@ -1088,14 +1088,20 @@ static void MGAG100_restore(struct matrox_fb_info *minfo)#ifdef CONFIG_FB_MATROX_MYSTIQUE struct matrox_switch matrox_mystique = { - MGA1064_preinit, MGA1064_reset, MGA1064_init, MGA1064_restore, + .preinit = MGA1064_preinit, + .reset = MGA1064_reset, + .init = MGA1064_init, + .restore = MGA1064_restore, };EXPORT_SYMBOL (matrox_mystique);#endif #ifdef CONFIG_FB_MATROX_G struct matrox_switch matrox_G100 = { - MGAG100_preinit, MGAG100_reset, MGAG100_init, MGAG100_restore, + .preinit = MGAG100_preinit, + .reset = MGAG100_reset, + .init = MGAG100_init, + .restore = MGAG100_restore, };EXPORT_SYMBOL (matrox_G100);#endif drivers/video/fbdev/matrox/matroxfb_Ti3026.c +4
-1@@ -738,7 +738,10 @@ static int Ti3026_preinit(struct matrox_fb_info *minfo) }struct matrox_switch matrox_millennium = { - Ti3026_preinit, Ti3026_reset, Ti3026_init, Ti3026_restore + .preinit = Ti3026_preinit, + .reset = Ti3026_reset, + .init = Ti3026_init, + .restore = Ti3026_restore };EXPORT_SYMBOL (matrox_millennium);#endif fs/reiserfs/item_ops.c +12
-12@@ -724,18 +724,18 @@ static void errcatch_print_vi(struct virtual_item *vi) }static struct item_operations errcatch_ops = { - errcatch_bytes_number, - errcatch_decrement_key, - errcatch_is_left_mergeable, - errcatch_print_item, - errcatch_check_item, - - errcatch_create_vi, - errcatch_check_left, - errcatch_check_right, - errcatch_part_size, - errcatch_unit_num, - errcatch_print_vi + .bytes_number = errcatch_bytes_number, + .decrement_key = errcatch_decrement_key, + .is_left_mergeable = errcatch_is_left_mergeable, + .print_item = errcatch_print_item, + .check_item = errcatch_check_item, + + .create_vi = errcatch_create_vi, + .check_left = errcatch_check_left, + .check_right = errcatch_check_right, + .part_size = errcatch_part_size, + .unit_num = errcatch_unit_num, + .print_vi = errcatch_print_vi };#if ! (TYPE_STAT_DATA ==0 &&TYPE_INDIRECT ==1 &&TYPE_DIRECT ==2 &&TYPE_DIRENTRY ==3 )include/linux/rbtree_augmented.h +3
-1@@ -90,7 +90,9 @@ rbname ## _rotate(struct rb_node *rb_old, struct rb_node *rb_new) \ old->rbaugmented =rbcompute (old); \ } \ rbstatic const struct rb_augment_callbacks rbname = { \ - rbname ## _propagate, rbname ## _copy, rbname ## _rotate \ + .propagate = rbname ## _propagate, \ + .copy = rbname ## _copy, \ + .rotate = rbname ## _rotate \ };lib/rbtree.c +3
-1@@ -412,7 +412,9 @@ static inline void dummy_copy(struct rb_node *old, struct rb_node *new) {}static inline void dummy_rotate (struct rb_node *old,struct rb_node *new) {}static const struct rb_augment_callbacks dummy_callbacks = { - dummy_propagate, dummy_copy, dummy_rotate + .propagate = dummy_propagate, + .copy = dummy_copy, + .rotate = dummy_rotate };void rb_insert_color (struct rb_node *node,struct rb_root *root)mm/page_alloc.c +1
-1@@ -561,7 +561,7 @@ static inline void clear_page_guard(struct zone *zone, struct page *page,__mod_zone_freepage_state (zone, (1 << order), migratetype); }#else -struct page_ext_operations debug_guardpage_ops = {NULL , }; +struct page_ext_operations debug_guardpage_ops = { .need =NULL , .init =NULL };static inline void set_page_guard (struct zone *zone,struct page *page,unsigned int order,int migratetype) {} static inline void clear_page_guard(struct zone *zone, struct page *page,net/atm/lec.c +3
-3@@ -111,9 +111,9 @@ static inline void lec_arp_put(struct lec_arp_table *entry) }static struct lane2_ops lane2_ops = { - lane2_resolve,/* resolve, spec 3.1.3 */ - lane2_associate_req,/* associate_req, spec 3.1.4 */ -NULL /* associate indicator, spec 3.1.5 */ + .resolve = lane2_resolve, + .associate_req = lane2_associate_req, + .associate_indicator =NULL };static unsigned char bus_mac[ETH_ALEN ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };net/atm/mpoa_caches.c +20
-21@@ -535,30 +535,29 @@ static void eg_destroy_cache(struct mpoa_client *mpc)static const struct in_cache_ops ingress_ops = { - in_cache_add_entry,/* add_entry */ - in_cache_get,/* get */ - in_cache_get_with_mask,/* get_with_mask */ - in_cache_get_by_vcc,/* get_by_vcc */ - in_cache_put,/* put */ - in_cache_remove_entry,/* remove_entry */ - cache_hit,/* cache_hit */ - clear_count_and_expired,/* clear_count */ - check_resolving_entries,/* check_resolving */ - refresh_entries,/* refresh */ - in_destroy_cache/* destroy_cache */ + .add_entry = in_cache_add_entry, + .get = in_cache_get, + .get_with_mask = in_cache_get_with_mask, + .get_by_vcc = in_cache_get_by_vcc, + .put = in_cache_put, + .remove_entry = in_cache_remove_entry, + .cache_hit = cache_hit, + .clear_count = clear_count_and_expired, + .check_resolving = check_resolving_entries, + .refresh = refresh_entries, };static const struct eg_cache_ops egress_ops = { - eg_cache_add_entry,/* add_entry */ - eg_cache_get_by_cache_id,/* get_by_cache_id */ - eg_cache_get_by_tag,/* get_by_tag */ - eg_cache_get_by_vcc,/* get_by_vcc */ - eg_cache_get_by_src_ip,/* get_by_src_ip */ - eg_cache_put,/* put */ - eg_cache_remove_entry,/* remove_entry */ - update_eg_cache_entry,/* update */ - clear_expired,/* clear_expired */ - eg_destroy_cache/* destroy_cache */ + .add_entry = eg_cache_add_entry, + .get_by_cache_id = eg_cache_get_by_cache_id, + .get_by_tag = eg_cache_get_by_tag, + .get_by_vcc = eg_cache_get_by_vcc, + .get_by_src_ip = eg_cache_get_by_src_ip, + .put = eg_cache_put, + .remove_entry = eg_cache_remove_entry, + .update = update_eg_cache_entry, + .clear_expired = clear_expired, + .destroy_cache = eg_destroy_cache };net/vmw_vsock/vmci_transport_notify.c +15
-15@@ -662,19 +662,19 @@ static void vmci_transport_notify_pkt_process_negotiate(struct sock *sk)/* Socket control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };net/vmw_vsock/vmci_transport_notify_qstate.c +15
-15@@ -420,19 +420,19 @@ vmci_transport_notify_pkt_send_pre_enqueue(/* Socket always on control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };sound/synth/emux/emux_seq.c +7
-8@@ -33,13 +33,13 @@ static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *inf* MIDI emulation operators */ static struct snd_midi_op emux_ops = { - snd_emux_note_on, - snd_emux_note_off, - snd_emux_key_press, - snd_emux_terminate_note, - snd_emux_control, - snd_emux_nrpn, - snd_emux_sysex, + .note_on = snd_emux_note_on, + .note_off = snd_emux_note_off, + .key_press = snd_emux_key_press, + .note_terminate = snd_emux_terminate_note, + .control = snd_emux_control, + .nrpn = snd_emux_nrpn, + .sysex = snd_emux_sysex, }; --Quoted 2 lines
1.9.1
--
Kees Cook
Chrome OS & Brillo Security
Signature · 2 lines
Kees Cook Chrome OS & Brillo Security
[kernel-hardening] Re: [RFC 3/3] Change initialization C99 style; tag no_ramdomize_layout structs
Quoted 25 lines · Kees Cook
Quoted 24 lines · Julia Lawall
Quoted 21 lines · Kees Cook
Quoted 9 lines · Michael Leibowitz
Due to randomization of structs, the in order struct intialization style is replaced with explicit field style.
struct
foo_tmy_foo= {
one,
two,
three
};Quoted 7 lines
becomes
struct foo_t my_foo = { .one = one, .two = two, .three = three };Can a coccinelle script be written to do this also? It might be useful to keep that around.
Quoted 6 lines
Quoted 2 lines
Is this needed for all kinds of structure initializations, ie for both local and global variables, or only for global variables?
It's needed for any structure that has been globally defined. As in, any use of a struct must be using C99 since that structure may be randomized (in any context: global, local).
I'm not sure to understand what it means for a structure to be globally defined. If the code is:
int f(...) {
struct foo x = { 3, 4, 5, };
...
}
is it correct that it does not need to use C99?
thanks,
julia
Quoted 1,208 lines
Michael, what's the state of this series? What're your next steps?
-Kees
Quoted 1,197 lines
thanks,
juliaQuoted 1,193 lines
Quoted 4 lines
Additionally, tag paravirt related structures to explicitly not be randomized, as the structure layout is important.
This might need to be split out? It's logically separate. Also, I think this needs to come before the plugin, since the plugin isn't usable until this patch is in place.
-Kees
Quoted 1,173 lines
This feature is ported over from grsecurity. This is largely unchanged from the Original code written by the PaX Team and Spender.
Signed-off-by Michael Leibowitz <[email protected]>--- arch/x86/include/asm/floppy.h | 20 ++--- arch/x86/include/asm/paravirt_types.h | 18 +++-- drivers/acpi/acpica/hwxfsleep.c | 11 +-- drivers/block/cciss.h | 30 ++++---- drivers/gpu/drm/nouveau/nouveau_ttm.c | 28 +++---- drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 +-- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 10 +-- drivers/infiniband/hw/nes/nes_cm.c | 22 +++--- drivers/isdn/gigaset/bas-gigaset.c | 32 ++++---- drivers/isdn/gigaset/ser-gigaset.c | 32 ++++---- drivers/isdn/gigaset/usb-gigaset.c | 32 ++++---- drivers/isdn/i4l/isdn_concap.c | 6 +- drivers/isdn/i4l/isdn_x25iface.c | 16 ++-- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- drivers/net/ethernet/brocade/bna/bna_enet.c | 8 +- drivers/net/wan/lmc/lmc_media.c | 97 +++++++++++++------------ drivers/scsi/bfa/bfa_fcs.c | 19 ++++- drivers/scsi/bfa/bfa_fcs_lport.c | 29 +++++--- drivers/scsi/bfa/bfa_modules.h | 12 +-- drivers/scsi/hpsa.h | 40 +++++----- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 10 +-- drivers/video/fbdev/matrox/matroxfb_DAC1064.c | 10 ++- drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 5 +- fs/reiserfs/item_ops.c | 24 +++--- include/linux/rbtree_augmented.h | 4 +- lib/rbtree.c | 4 +- mm/page_alloc.c | 2 +- net/atm/lec.c | 6 +- net/atm/mpoa_caches.c | 41 +++++------ net/vmw_vsock/vmci_transport_notify.c | 30 ++++---- net/vmw_vsock/vmci_transport_notify_qstate.c | 30 ++++---- sound/synth/emux/emux_seq.c | 14 ++-- 34 files changed, 352 insertions(+), 314 deletions(-)arch/x86/include/asm/floppy.h +10
-10@@ -229,18 +229,18 @@ static struct fd_routine_l {int (*_dma_setup)(char *addr,unsigned long size,int mode,int io); } fd_routine[] = { { - request_dma, - free_dma, - get_dma_residue, - dma_mem_alloc, - hard_dma_setup + ._request_dma = request_dma, + ._free_dma = free_dma, + ._get_dma_residue = get_dma_residue, + ._dma_mem_alloc = dma_mem_alloc, + ._dma_setup = hard_dma_setup }, { - vdma_request_dma, - vdma_nop, - vdma_get_dma_residue, - vdma_mem_alloc, - vdma_dma_setup + ._request_dma = vdma_request_dma, + ._free_dma = vdma_nop, + ._get_dma_residue = vdma_get_dma_residue, + ._dma_mem_alloc = vdma_mem_alloc, + ._dma_setup = vdma_dma_setup } };arch/x86/include/asm/paravirt_types.h +10
-8@@ -89,7 +89,7 @@ struct pv_init_ops {*/ unsigned (*patch)(u8 type,u16 clobber,void *insnbuf,unsigned long addr,unsigned len); -}; +} __no_randomize_layout;struct pv_lazy_ops {@@ -97,12 +97,12 @@ struct pv_lazy_ops {void (*enter)(void );void (*leave)(void );void (*flush)(void ); -}; +} __no_randomize_layout;struct pv_time_ops {unsigned long long (*sched_clock)(void );unsigned long long (*steal_clock)(int cpu); -}; +} __no_randomize_layout;struct pv_cpu_ops {/* hooks for various privileged instructions */ @@ -178,7 +178,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); -}; +} __no_randomize_layout;struct pv_irq_ops {/* @@ -201,7 +201,7 @@ struct pv_irq_ops {#ifdef CONFIG_X86_64 void (*adjust_exception_frame)(void );#endif -}; +} __no_randomize_layout;struct pv_mmu_ops {unsigned long (*read_cr2)(void );@@ -296,7 +296,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); -}; +} __no_randomize_layout;struct arch_spinlock ;#ifdef CONFIG_SMP @@ -322,7 +322,9 @@ struct pv_lock_ops {/* This contains all the paravirt structures: we get a convenient * number for each function using the offset which we use to indicate -* what to patch. */ +* what to patch. +* shouldn't be randomized due to the "NEAT TRICK" in paravirt.c +*/ struct paravirt_patch_template {struct pv_init_ops pv_init_ops;struct pv_time_ops pv_time_ops;@@ -330,7 +332,7 @@ struct paravirt_patch_template {struct pv_irq_ops pv_irq_ops;struct pv_mmu_ops pv_mmu_ops;struct pv_lock_ops pv_lock_ops; -}; +} __no_randomize_layout;extern struct pv_info pv_info;extern struct pv_init_ops pv_init_ops;drivers/acpi/acpica/hwxfsleep.c +6
-5@@ -70,11 +70,12 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), - acpi_hw_extended_sleep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), - acpi_hw_extended_wake_prep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), acpi_hw_extended_wake} + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), + .extended_function = acpi_hw_extended_sleep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), + .extended_function = acpi_hw_extended_wake_prep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), + .extended_function = acpi_hw_extended_wake} };/* drivers/block/cciss.h +15
-15@@ -402,27 +402,27 @@ static bool SA5_performant_intr_pending(ctlr_info_t *h) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_fifo_full, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5B_access = { - SA5_submit_command, - SA5B_intr_mask, - SA5_fifo_full, - SA5B_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5B_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5B_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_fifo_full, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/gpu/drm/nouveau/nouveau_ttm.c +14
-14@@ -107,10 +107,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func nouveau_vram_manager = { - nouveau_vram_manager_init, - nouveau_vram_manager_fini, - nouveau_vram_manager_new, - nouveau_vram_manager_del, + .init = nouveau_vram_manager_init, + .takedown = nouveau_vram_manager_fini, + .get_node = nouveau_vram_manager_new, + .put_node = nouveau_vram_manager_del, }; static int@@ -183,11 +183,11 @@ nouveau_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nouveau_gart_manager = { - nouveau_gart_manager_init, - nouveau_gart_manager_fini, - nouveau_gart_manager_new, - nouveau_gart_manager_del, - nouveau_gart_manager_debug + .init = nouveau_gart_manager_init, + .takedown = nouveau_gart_manager_fini, + .get_node = nouveau_gart_manager_new, + .put_node = nouveau_gart_manager_del, + .debug = nouveau_gart_manager_debug };/*XXX*/ @@ -256,11 +256,11 @@ nv04_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nv04_gart_manager = { - nv04_gart_manager_init, - nv04_gart_manager_fini, - nv04_gart_manager_new, - nv04_gart_manager_del, - nv04_gart_manager_debug + .init = nv04_gart_manager_init, + .takedown = nv04_gart_manager_fini, + .get_node = nv04_gart_manager_new, + .put_node = nv04_gart_manager_del, + .debug = nv04_gart_manager_debug };int drivers/gpu/drm/ttm/ttm_bo_manager.c +5
-5@@ -148,10 +148,10 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func ttm_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug };EXPORT_SYMBOL (ttm_bo_manager_func);drivers/gpu/drm/virtio/virtgpu_ttm.c +5
-5@@ -198,11 +198,11 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }static const struct ttm_mem_type_manager_func virtio_gpu_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug }; static int virtio_gpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +5
-5@@ -164,9 +164,9 @@ static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func vmw_gmrid_manager_func = { - vmw_gmrid_man_init, - vmw_gmrid_man_takedown, - vmw_gmrid_man_get_node, - vmw_gmrid_man_put_node, - vmw_gmrid_man_debug + .init = vmw_gmrid_man_init, + .takedown = vmw_gmrid_man_takedown, + .get_node = vmw_gmrid_man_get_node, + .put_node = vmw_gmrid_man_put_node, + .debug = vmw_gmrid_man_debug };drivers/infiniband/hw/nes/nes_cm.c +11
-11@@ -135,17 +135,17 @@ static void record_ird_ord(struct nes_cm_node *, u16, u16);/* instance of function pointers for client API */ /* set address of this instance to cm_core->cm_ops at cm_core alloc */ static const struct nes_cm_ops nes_cm_api = { - mini_cm_accelerated, - mini_cm_listen, - mini_cm_del_listen, - mini_cm_connect, - mini_cm_close, - mini_cm_accept, - mini_cm_reject, - mini_cm_recv_pkt, - mini_cm_dealloc_core, - mini_cm_get, - mini_cm_set + .accelerated = mini_cm_accelerated, + .listen = mini_cm_listen, + .stop_listener = mini_cm_del_listen, + .connect = mini_cm_connect, + .close = mini_cm_close, + .accept = mini_cm_accept, + .reject = mini_cm_reject, + .recv_pkt = mini_cm_recv_pkt, + .destroy_cm_core = mini_cm_dealloc_core, + .get = mini_cm_get, + .set = mini_cm_set };static struct nes_cm_core *g_cm_core;drivers/isdn/gigaset/bas-gigaset.c +16
-16@@ -2565,22 +2565,22 @@ static int gigaset_post_reset(struct usb_interface *intf)static const struct gigaset_ops gigops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_isoc_send_skb, - gigaset_isoc_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_isoc_send_skb, + .handle_input = gigaset_isoc_input, };/* bas_gigaset_init drivers/isdn/gigaset/ser-gigaset.c +16
-16@@ -445,22 +445,22 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb,/* asyncdata.c */ - gigaset_m10x_input,/* asyncdata.c */ + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb,/* asyncdata.c */ + .handle_input = gigaset_m10x_input,/* asyncdata.c */ };drivers/isdn/gigaset/usb-gigaset.c +16
-16@@ -862,22 +862,22 @@ static int gigaset_pre_reset(struct usb_interface *intf) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb, - gigaset_m10x_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb, + .handle_input = gigaset_m10x_input, };/* drivers/isdn/i4l/isdn_concap.c +3
-3@@ -80,9 +80,9 @@ static int isdn_concap_dl_disconn_req(struct concap_proto *concap) }struct concap_device_ops isdn_concap_reliable_dl_dops = { - &isdn_concap_dl_data_req, - &isdn_concap_dl_connect_req, - &isdn_concap_dl_disconn_req + .data_req = &isdn_concap_dl_data_req, + .connect_req = &isdn_concap_dl_connect_req, + .disconn_req = &isdn_concap_dl_disconn_req };/* The following should better go into a dedicated source file such that drivers/isdn/i4l/isdn_x25iface.c +8
-8@@ -53,14 +53,14 @@ static int isdn_x25iface_disconn_ind(struct concap_proto *);static struct concap_proto_ops ix25_pops = { - &isdn_x25iface_proto_new, - &isdn_x25iface_proto_del, - &isdn_x25iface_proto_restart, - &isdn_x25iface_proto_close, - &isdn_x25iface_xmit, - &isdn_x25iface_receive, - &isdn_x25iface_connect_ind, - &isdn_x25iface_disconn_ind + .proto_new = &isdn_x25iface_proto_new, + .proto_del = &isdn_x25iface_proto_del, + .restart = &isdn_x25iface_proto_restart, + .close = &isdn_x25iface_proto_close, + .encap_and_xmit = &isdn_x25iface_xmit, + .data_ind = &isdn_x25iface_receive, + .connect_ind = &isdn_x25iface_connect_ind, + .disconn_ind = &isdn_x25iface_disconn_ind };/* error message helper function */ drivers/media/pci/solo6x10/solo6x10-g723.c +1
-1@@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)int solo_g723_init (struct solo_dev *solo_dev) { -static struct snd_device_ops ops = {NULL }; +static struct snd_device_ops ops = { };struct snd_card *card;struct snd_kcontrol_new kctl;char name[32 ];drivers/net/ethernet/brocade/bna/bna_enet.c +4
-4@@ -1676,10 +1676,10 @@ bna_cb_ioceth_reset(void *arg) }static struct bfa_ioc_cbfn bna_ioceth_cbfn = { - bna_cb_ioceth_enable, - bna_cb_ioceth_disable, - bna_cb_ioceth_hbfail, - bna_cb_ioceth_reset + .enable_cbfn = bna_cb_ioceth_enable, + .disable_cbfn = bna_cb_ioceth_disable, + .hbfail_cbfn = bna_cb_ioceth_hbfail, + .reset_cbfn = bna_cb_ioceth_reset };static void bna_attr_init (struct bna_ioceth *ioceth)drivers/net/wan/lmc/lmc_media.c +49
-48@@ -95,62 +95,63 @@ static inline void write_av9110_bit (lmc_softc_t *, int);static void write_av9110 (lmc_softc_t *,u32 ,u32 ,u32 ,u32 ,u32 );lmc_media_t lmc_ds3_media = { - lmc_ds3_init,/* special media init stuff */ - lmc_ds3_default,/* reset to default state */ - lmc_ds3_set_status,/* reset status to state provided */ - lmc_dummy_set_1,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_ds3_set_100ft,/* set cable length */ - lmc_ds3_set_scram,/* set scrambler */ - lmc_ds3_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_ds3_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ds3_watchdog + .init = lmc_ds3_init,/* special media init stuff */ + .defaults = lmc_ds3_default,/* reset to default state */ + .set_status = lmc_ds3_set_status,/* reset status to state provided */ + .set_clock_source = lmc_dummy_set_1,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_ds3_set_100ft,/* set cable length */ + .set_scrambler = lmc_ds3_set_scram,/* set scrambler */ + .get_link_status = lmc_ds3_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_ds3_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ds3_watchdog };lmc_media_t lmc_hssi_media = { - lmc_hssi_init,/* special media init stuff */ - lmc_hssi_default,/* reset to default state */ - lmc_hssi_set_status,/* reset status to state provided */ - lmc_hssi_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_hssi_get_link_status,/* get link status */ - lmc_hssi_set_link_status,/* set link status */ - lmc_hssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_hssi_watchdog + .init = lmc_hssi_init,/* special media init stuff */ + .defaults = lmc_hssi_default,/* reset to default state */ + .set_status = lmc_hssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_hssi_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_hssi_get_link_status,/* get link status */ + .set_link_status = lmc_hssi_set_link_status,/* set link status */ + .set_crc_length = lmc_hssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_hssi_watchdog }; -lmc_media_t lmc_ssi_media = { lmc_ssi_init,/* special media init stuff */ - lmc_ssi_default,/* reset to default state */ - lmc_ssi_set_status,/* reset status to state provided */ - lmc_ssi_set_clock,/* set clock source */ - lmc_ssi_set_speed,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_ssi_get_link_status,/* get link status */ - lmc_ssi_set_link_status,/* set link status */ - lmc_ssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ssi_watchdog +lmc_media_t lmc_ssi_media = { + .init = lmc_ssi_init,/* special media init stuff */ + .defaults = lmc_ssi_default,/* reset to default state */ + .set_status = lmc_ssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_ssi_set_clock,/* set clock source */ + .set_speed = lmc_ssi_set_speed,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_ssi_get_link_status,/* get link status */ + .set_link_status = lmc_ssi_set_link_status,/* set link status */ + .set_crc_length = lmc_ssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ssi_watchdog };lmc_media_t lmc_t1_media = { - lmc_t1_init,/* special media init stuff */ - lmc_t1_default,/* reset to default state */ - lmc_t1_set_status,/* reset status to state provided */ - lmc_t1_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_t1_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_t1_set_crc_length,/* set CRC length */ - lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ - lmc_t1_watchdog + .init = lmc_t1_init,/* special media init stuff */ + .defaults = lmc_t1_default,/* reset to default state */ + .set_status = lmc_t1_set_status,/* reset status to state provided */ + .set_clock_source = lmc_t1_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_t1_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_t1_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ + .watchdog = lmc_t1_watchdog }; static voiddrivers/scsi/bfa/bfa_fcs.c +15
-4@@ -39,10 +39,21 @@ struct bfa_fcs_mod_s {#define BFA_FCS_MODULE (_mod) { _mod ## _modinit, _mod ## _modexit }static struct bfa_fcs_mod_s fcs_modules[] = { - { bfa_fcs_port_attach,NULL ,NULL }, - { bfa_fcs_uf_attach,NULL ,NULL }, - { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit, - bfa_fcs_fabric_modexit }, + { + .attach = bfa_fcs_port_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_uf_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_fabric_attach, + .modinit = bfa_fcs_fabric_modinit, + .modexit = bfa_fcs_fabric_modexit + }, };/* drivers/scsi/bfa/bfa_fcs_lport.c +20
-9@@ -90,15 +90,26 @@ static struct {void (*offline) (struct bfa_fcs_lport_s *port); } __port_action[] = { { - bfa_fcs_lport_unknown_init, bfa_fcs_lport_unknown_online, - bfa_fcs_lport_unknown_offline}, { - bfa_fcs_lport_fab_init, bfa_fcs_lport_fab_online, - bfa_fcs_lport_fab_offline}, { - bfa_fcs_lport_n2n_init, bfa_fcs_lport_n2n_online, - bfa_fcs_lport_n2n_offline}, { - bfa_fcs_lport_loop_init, bfa_fcs_lport_loop_online, - bfa_fcs_lport_loop_offline}, - }; + .init = bfa_fcs_lport_unknown_init, + .online = bfa_fcs_lport_unknown_online, + .offline = bfa_fcs_lport_unknown_offline + }, + { + .init = bfa_fcs_lport_fab_init, + .online = bfa_fcs_lport_fab_online, + .offline = bfa_fcs_lport_fab_offline + }, + { + .init = bfa_fcs_lport_n2n_init, + .online = bfa_fcs_lport_n2n_online, + .offline = bfa_fcs_lport_n2n_offline + }, + { + .init = bfa_fcs_lport_loop_init, + .online = bfa_fcs_lport_loop_online, + .offline = bfa_fcs_lport_loop_offline + }, +}; /* * fcs_port_sm FCS logical port state machinedrivers/scsi/bfa/bfa_modules.h +6
-6@@ -79,12 +79,12 @@ enum { \ extern struct bfa_module_s hal_mod_ ## __mod; \ struct bfa_module_s hal_mod_ ## __mod = { \ - bfa_ ## __mod ## _meminfo, \ - bfa_ ## __mod ## _attach, \ - bfa_ ## __mod ## _detach, \ - bfa_ ## __mod ## _start, \ - bfa_ ## __mod ## _stop, \ - bfa_ ## __mod ## _iocdisable, \ + .meminfo = bfa_ ## __mod ## _meminfo, \ + .attach = bfa_ ## __mod ## _attach, \ + .detach = bfa_ ## __mod ## _detach, \ + .start = bfa_ ## __mod ## _start, \ + .stop = bfa_ ## __mod ## _stop, \ + .iocdisable = bfa_ ## __mod ## _iocdisable, \ }#define BFA_CACHELINE_SZ (256)drivers/scsi/hpsa.h +20
-20@@ -577,38 +577,38 @@ static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_ioaccel_mode1_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_ioaccel_mode1_intr_pending, - SA5_ioaccel_mode1_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_ioaccel_mode1_intr_pending, + .command_completed = SA5_ioaccel_mode1_completed, };static struct access_method SA5_ioaccel_mode2_access = { - SA5_submit_command_ioaccel2, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_ioaccel2, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access_no_read = { - SA5_submit_command_no_read, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_no_read, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +1
-1@@ -147,7 +147,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,int added = (mode ==LCK_NL );int overlaps =0 ;int splitted =0 ; -const struct ldlm_callback_suite null_cbs = {NULL }; +const struct ldlm_callback_suite null_cbs = { }; CDEBUG(D_DLMTRACE, "flags %#llx owner %llu pid %u mode %u start %llu end %llu\n",drivers/staging/lustre/lustre/libcfs/module.c +5
-5@@ -322,11 +322,11 @@ out: }struct cfs_psdev_ops libcfs_psdev_ops = { - libcfs_psdev_open, - libcfs_psdev_release, -NULL , -NULL , - libcfs_ioctl + .p_open = libcfs_psdev_open, + .p_close = libcfs_psdev_release, + .p_read =NULL , + .p_write =NULL , + .p_ioctl = libcfs_ioctl }; static int proc_call_handler(void *data, int write, loff_t *ppos,drivers/video/fbdev/matrox/matroxfb_DAC1064.c +8
-2@@ -1088,14 +1088,20 @@ static void MGAG100_restore(struct matrox_fb_info *minfo)#ifdef CONFIG_FB_MATROX_MYSTIQUE struct matrox_switch matrox_mystique = { - MGA1064_preinit, MGA1064_reset, MGA1064_init, MGA1064_restore, + .preinit = MGA1064_preinit, + .reset = MGA1064_reset, + .init = MGA1064_init, + .restore = MGA1064_restore, };EXPORT_SYMBOL (matrox_mystique);#endif #ifdef CONFIG_FB_MATROX_G struct matrox_switch matrox_G100 = { - MGAG100_preinit, MGAG100_reset, MGAG100_init, MGAG100_restore, + .preinit = MGAG100_preinit, + .reset = MGAG100_reset, + .init = MGAG100_init, + .restore = MGAG100_restore, };EXPORT_SYMBOL (matrox_G100);#endif drivers/video/fbdev/matrox/matroxfb_Ti3026.c +4
-1@@ -738,7 +738,10 @@ static int Ti3026_preinit(struct matrox_fb_info *minfo) }struct matrox_switch matrox_millennium = { - Ti3026_preinit, Ti3026_reset, Ti3026_init, Ti3026_restore + .preinit = Ti3026_preinit, + .reset = Ti3026_reset, + .init = Ti3026_init, + .restore = Ti3026_restore };EXPORT_SYMBOL (matrox_millennium);#endif fs/reiserfs/item_ops.c +12
-12@@ -724,18 +724,18 @@ static void errcatch_print_vi(struct virtual_item *vi) }static struct item_operations errcatch_ops = { - errcatch_bytes_number, - errcatch_decrement_key, - errcatch_is_left_mergeable, - errcatch_print_item, - errcatch_check_item, - - errcatch_create_vi, - errcatch_check_left, - errcatch_check_right, - errcatch_part_size, - errcatch_unit_num, - errcatch_print_vi + .bytes_number = errcatch_bytes_number, + .decrement_key = errcatch_decrement_key, + .is_left_mergeable = errcatch_is_left_mergeable, + .print_item = errcatch_print_item, + .check_item = errcatch_check_item, + + .create_vi = errcatch_create_vi, + .check_left = errcatch_check_left, + .check_right = errcatch_check_right, + .part_size = errcatch_part_size, + .unit_num = errcatch_unit_num, + .print_vi = errcatch_print_vi };#if ! (TYPE_STAT_DATA ==0 &&TYPE_INDIRECT ==1 &&TYPE_DIRECT ==2 &&TYPE_DIRENTRY ==3 )include/linux/rbtree_augmented.h +3
-1@@ -90,7 +90,9 @@ rbname ## _rotate(struct rb_node *rb_old, struct rb_node *rb_new) \ old->rbaugmented =rbcompute (old); \ } \ rbstatic const struct rb_augment_callbacks rbname = { \ - rbname ## _propagate, rbname ## _copy, rbname ## _rotate \ + .propagate = rbname ## _propagate, \ + .copy = rbname ## _copy, \ + .rotate = rbname ## _rotate \ };lib/rbtree.c +3
-1@@ -412,7 +412,9 @@ static inline void dummy_copy(struct rb_node *old, struct rb_node *new) {}static inline void dummy_rotate (struct rb_node *old,struct rb_node *new) {}static const struct rb_augment_callbacks dummy_callbacks = { - dummy_propagate, dummy_copy, dummy_rotate + .propagate = dummy_propagate, + .copy = dummy_copy, + .rotate = dummy_rotate };void rb_insert_color (struct rb_node *node,struct rb_root *root)mm/page_alloc.c +1
-1@@ -561,7 +561,7 @@ static inline void clear_page_guard(struct zone *zone, struct page *page,__mod_zone_freepage_state (zone, (1 << order), migratetype); }#else -struct page_ext_operations debug_guardpage_ops = {NULL , }; +struct page_ext_operations debug_guardpage_ops = { .need =NULL , .init =NULL };static inline void set_page_guard (struct zone *zone,struct page *page,unsigned int order,int migratetype) {} static inline void clear_page_guard(struct zone *zone, struct page *page,net/atm/lec.c +3
-3@@ -111,9 +111,9 @@ static inline void lec_arp_put(struct lec_arp_table *entry) }static struct lane2_ops lane2_ops = { - lane2_resolve,/* resolve, spec 3.1.3 */ - lane2_associate_req,/* associate_req, spec 3.1.4 */ -NULL /* associate indicator, spec 3.1.5 */ + .resolve = lane2_resolve, + .associate_req = lane2_associate_req, + .associate_indicator =NULL };static unsigned char bus_mac[ETH_ALEN ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };net/atm/mpoa_caches.c +20
-21@@ -535,30 +535,29 @@ static void eg_destroy_cache(struct mpoa_client *mpc)static const struct in_cache_ops ingress_ops = { - in_cache_add_entry,/* add_entry */ - in_cache_get,/* get */ - in_cache_get_with_mask,/* get_with_mask */ - in_cache_get_by_vcc,/* get_by_vcc */ - in_cache_put,/* put */ - in_cache_remove_entry,/* remove_entry */ - cache_hit,/* cache_hit */ - clear_count_and_expired,/* clear_count */ - check_resolving_entries,/* check_resolving */ - refresh_entries,/* refresh */ - in_destroy_cache/* destroy_cache */ + .add_entry = in_cache_add_entry, + .get = in_cache_get, + .get_with_mask = in_cache_get_with_mask, + .get_by_vcc = in_cache_get_by_vcc, + .put = in_cache_put, + .remove_entry = in_cache_remove_entry, + .cache_hit = cache_hit, + .clear_count = clear_count_and_expired, + .check_resolving = check_resolving_entries, + .refresh = refresh_entries, };static const struct eg_cache_ops egress_ops = { - eg_cache_add_entry,/* add_entry */ - eg_cache_get_by_cache_id,/* get_by_cache_id */ - eg_cache_get_by_tag,/* get_by_tag */ - eg_cache_get_by_vcc,/* get_by_vcc */ - eg_cache_get_by_src_ip,/* get_by_src_ip */ - eg_cache_put,/* put */ - eg_cache_remove_entry,/* remove_entry */ - update_eg_cache_entry,/* update */ - clear_expired,/* clear_expired */ - eg_destroy_cache/* destroy_cache */ + .add_entry = eg_cache_add_entry, + .get_by_cache_id = eg_cache_get_by_cache_id, + .get_by_tag = eg_cache_get_by_tag, + .get_by_vcc = eg_cache_get_by_vcc, + .get_by_src_ip = eg_cache_get_by_src_ip, + .put = eg_cache_put, + .remove_entry = eg_cache_remove_entry, + .update = update_eg_cache_entry, + .clear_expired = clear_expired, + .destroy_cache = eg_destroy_cache };net/vmw_vsock/vmci_transport_notify.c +15
-15@@ -662,19 +662,19 @@ static void vmci_transport_notify_pkt_process_negotiate(struct sock *sk)/* Socket control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };net/vmw_vsock/vmci_transport_notify_qstate.c +15
-15@@ -420,19 +420,19 @@ vmci_transport_notify_pkt_send_pre_enqueue(/* Socket always on control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };sound/synth/emux/emux_seq.c +7
-8@@ -33,13 +33,13 @@ static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *inf* MIDI emulation operators */ static struct snd_midi_op emux_ops = { - snd_emux_note_on, - snd_emux_note_off, - snd_emux_key_press, - snd_emux_terminate_note, - snd_emux_control, - snd_emux_nrpn, - snd_emux_sysex, + .note_on = snd_emux_note_on, + .note_off = snd_emux_note_off, + .key_press = snd_emux_key_press, + .note_terminate = snd_emux_terminate_note, + .control = snd_emux_control, + .nrpn = snd_emux_nrpn, + .sysex = snd_emux_sysex, }; --Quoted 2 lines
1.9.1
--
Kees Cook
Chrome OS & Brillo SecuritySignature · 2 lines
Kees Cook Chrome OS & Brillo Security
[kernel-hardening] Re: [RFC 3/3] Change initialization C99 style; tag no_ramdomize_layout structs
Quoted 37 lines · Julia Lawall
Quoted 25 lines · Kees Cook
Quoted 24 lines · Julia Lawall
Quoted 21 lines · Kees Cook
Quoted 9 lines · Michael Leibowitz
Due to randomization of structs, the in order struct intialization style is replaced with explicit field style.
struct
foo_tmy_foo= {
one,
two,
three
};Quoted 7 lines
becomes
struct foo_t my_foo = { .one = one, .two = two, .three = three };Can a coccinelle script be written to do this also? It might be useful to keep that around.
Quoted 6 lines
Quoted 2 lines
Is this needed for all kinds of structure initializations, ie for both local and global variables, or only for global variables?
It's needed for any structure that has been globally defined. As in, any use of a struct must be using C99 since that structure may be randomized (in any context: global, local).
I'm not sure to understand what it means for a structure to be globally defined. If the code is:
Quoted 6 lines
int f(...) {
struct foo x = { 3, 4, 5, };
...
}is it correct that it does not need to use C99?
As I understand it, your example will need to use C99 initialization.
-Kees
Quoted 1,212 lines
thanks,
juliaQuoted 1,208 lines
Michael, what's the state of this series? What're your next steps?
-Kees
Quoted 1,197 lines
thanks,
juliaQuoted 1,193 lines
Quoted 4 lines
Additionally, tag paravirt related structures to explicitly not be randomized, as the structure layout is important.
This might need to be split out? It's logically separate. Also, I think this needs to come before the plugin, since the plugin isn't usable until this patch is in place.
-Kees
Quoted 1,173 lines
This feature is ported over from grsecurity. This is largely unchanged from the Original code written by the PaX Team and Spender.
Signed-off-by Michael Leibowitz <[email protected]>--- arch/x86/include/asm/floppy.h | 20 ++--- arch/x86/include/asm/paravirt_types.h | 18 +++-- drivers/acpi/acpica/hwxfsleep.c | 11 +-- drivers/block/cciss.h | 30 ++++---- drivers/gpu/drm/nouveau/nouveau_ttm.c | 28 +++---- drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 +-- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 10 +-- drivers/infiniband/hw/nes/nes_cm.c | 22 +++--- drivers/isdn/gigaset/bas-gigaset.c | 32 ++++---- drivers/isdn/gigaset/ser-gigaset.c | 32 ++++---- drivers/isdn/gigaset/usb-gigaset.c | 32 ++++---- drivers/isdn/i4l/isdn_concap.c | 6 +- drivers/isdn/i4l/isdn_x25iface.c | 16 ++-- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- drivers/net/ethernet/brocade/bna/bna_enet.c | 8 +- drivers/net/wan/lmc/lmc_media.c | 97 +++++++++++++------------ drivers/scsi/bfa/bfa_fcs.c | 19 ++++- drivers/scsi/bfa/bfa_fcs_lport.c | 29 +++++--- drivers/scsi/bfa/bfa_modules.h | 12 +-- drivers/scsi/hpsa.h | 40 +++++----- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 10 +-- drivers/video/fbdev/matrox/matroxfb_DAC1064.c | 10 ++- drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 5 +- fs/reiserfs/item_ops.c | 24 +++--- include/linux/rbtree_augmented.h | 4 +- lib/rbtree.c | 4 +- mm/page_alloc.c | 2 +- net/atm/lec.c | 6 +- net/atm/mpoa_caches.c | 41 +++++------ net/vmw_vsock/vmci_transport_notify.c | 30 ++++---- net/vmw_vsock/vmci_transport_notify_qstate.c | 30 ++++---- sound/synth/emux/emux_seq.c | 14 ++-- 34 files changed, 352 insertions(+), 314 deletions(-)arch/x86/include/asm/floppy.h +10
-10@@ -229,18 +229,18 @@ static struct fd_routine_l {int (*_dma_setup)(char *addr,unsigned long size,int mode,int io); } fd_routine[] = { { - request_dma, - free_dma, - get_dma_residue, - dma_mem_alloc, - hard_dma_setup + ._request_dma = request_dma, + ._free_dma = free_dma, + ._get_dma_residue = get_dma_residue, + ._dma_mem_alloc = dma_mem_alloc, + ._dma_setup = hard_dma_setup }, { - vdma_request_dma, - vdma_nop, - vdma_get_dma_residue, - vdma_mem_alloc, - vdma_dma_setup + ._request_dma = vdma_request_dma, + ._free_dma = vdma_nop, + ._get_dma_residue = vdma_get_dma_residue, + ._dma_mem_alloc = vdma_mem_alloc, + ._dma_setup = vdma_dma_setup } };arch/x86/include/asm/paravirt_types.h +10
-8@@ -89,7 +89,7 @@ struct pv_init_ops {*/ unsigned (*patch)(u8 type,u16 clobber,void *insnbuf,unsigned long addr,unsigned len); -}; +} __no_randomize_layout;struct pv_lazy_ops {@@ -97,12 +97,12 @@ struct pv_lazy_ops {void (*enter)(void );void (*leave)(void );void (*flush)(void ); -}; +} __no_randomize_layout;struct pv_time_ops {unsigned long long (*sched_clock)(void );unsigned long long (*steal_clock)(int cpu); -}; +} __no_randomize_layout;struct pv_cpu_ops {/* hooks for various privileged instructions */ @@ -178,7 +178,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); -}; +} __no_randomize_layout;struct pv_irq_ops {/* @@ -201,7 +201,7 @@ struct pv_irq_ops {#ifdef CONFIG_X86_64 void (*adjust_exception_frame)(void );#endif -}; +} __no_randomize_layout;struct pv_mmu_ops {unsigned long (*read_cr2)(void );@@ -296,7 +296,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); -}; +} __no_randomize_layout;struct arch_spinlock ;#ifdef CONFIG_SMP @@ -322,7 +322,9 @@ struct pv_lock_ops {/* This contains all the paravirt structures: we get a convenient * number for each function using the offset which we use to indicate -* what to patch. */ +* what to patch. +* shouldn't be randomized due to the "NEAT TRICK" in paravirt.c +*/ struct paravirt_patch_template {struct pv_init_ops pv_init_ops;struct pv_time_ops pv_time_ops;@@ -330,7 +332,7 @@ struct paravirt_patch_template {struct pv_irq_ops pv_irq_ops;struct pv_mmu_ops pv_mmu_ops;struct pv_lock_ops pv_lock_ops; -}; +} __no_randomize_layout;extern struct pv_info pv_info;extern struct pv_init_ops pv_init_ops;drivers/acpi/acpica/hwxfsleep.c +6
-5@@ -70,11 +70,12 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), - acpi_hw_extended_sleep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), - acpi_hw_extended_wake_prep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), acpi_hw_extended_wake} + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), + .extended_function = acpi_hw_extended_sleep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), + .extended_function = acpi_hw_extended_wake_prep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), + .extended_function = acpi_hw_extended_wake} };/* drivers/block/cciss.h +15
-15@@ -402,27 +402,27 @@ static bool SA5_performant_intr_pending(ctlr_info_t *h) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_fifo_full, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5B_access = { - SA5_submit_command, - SA5B_intr_mask, - SA5_fifo_full, - SA5B_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5B_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5B_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_fifo_full, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/gpu/drm/nouveau/nouveau_ttm.c +14
-14@@ -107,10 +107,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func nouveau_vram_manager = { - nouveau_vram_manager_init, - nouveau_vram_manager_fini, - nouveau_vram_manager_new, - nouveau_vram_manager_del, + .init = nouveau_vram_manager_init, + .takedown = nouveau_vram_manager_fini, + .get_node = nouveau_vram_manager_new, + .put_node = nouveau_vram_manager_del, }; static int@@ -183,11 +183,11 @@ nouveau_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nouveau_gart_manager = { - nouveau_gart_manager_init, - nouveau_gart_manager_fini, - nouveau_gart_manager_new, - nouveau_gart_manager_del, - nouveau_gart_manager_debug + .init = nouveau_gart_manager_init, + .takedown = nouveau_gart_manager_fini, + .get_node = nouveau_gart_manager_new, + .put_node = nouveau_gart_manager_del, + .debug = nouveau_gart_manager_debug };/*XXX*/ @@ -256,11 +256,11 @@ nv04_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nv04_gart_manager = { - nv04_gart_manager_init, - nv04_gart_manager_fini, - nv04_gart_manager_new, - nv04_gart_manager_del, - nv04_gart_manager_debug + .init = nv04_gart_manager_init, + .takedown = nv04_gart_manager_fini, + .get_node = nv04_gart_manager_new, + .put_node = nv04_gart_manager_del, + .debug = nv04_gart_manager_debug };int drivers/gpu/drm/ttm/ttm_bo_manager.c +5
-5@@ -148,10 +148,10 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func ttm_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug };EXPORT_SYMBOL (ttm_bo_manager_func);drivers/gpu/drm/virtio/virtgpu_ttm.c +5
-5@@ -198,11 +198,11 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }static const struct ttm_mem_type_manager_func virtio_gpu_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug }; static int virtio_gpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +5
-5@@ -164,9 +164,9 @@ static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func vmw_gmrid_manager_func = { - vmw_gmrid_man_init, - vmw_gmrid_man_takedown, - vmw_gmrid_man_get_node, - vmw_gmrid_man_put_node, - vmw_gmrid_man_debug + .init = vmw_gmrid_man_init, + .takedown = vmw_gmrid_man_takedown, + .get_node = vmw_gmrid_man_get_node, + .put_node = vmw_gmrid_man_put_node, + .debug = vmw_gmrid_man_debug };drivers/infiniband/hw/nes/nes_cm.c +11
-11@@ -135,17 +135,17 @@ static void record_ird_ord(struct nes_cm_node *, u16, u16);/* instance of function pointers for client API */ /* set address of this instance to cm_core->cm_ops at cm_core alloc */ static const struct nes_cm_ops nes_cm_api = { - mini_cm_accelerated, - mini_cm_listen, - mini_cm_del_listen, - mini_cm_connect, - mini_cm_close, - mini_cm_accept, - mini_cm_reject, - mini_cm_recv_pkt, - mini_cm_dealloc_core, - mini_cm_get, - mini_cm_set + .accelerated = mini_cm_accelerated, + .listen = mini_cm_listen, + .stop_listener = mini_cm_del_listen, + .connect = mini_cm_connect, + .close = mini_cm_close, + .accept = mini_cm_accept, + .reject = mini_cm_reject, + .recv_pkt = mini_cm_recv_pkt, + .destroy_cm_core = mini_cm_dealloc_core, + .get = mini_cm_get, + .set = mini_cm_set };static struct nes_cm_core *g_cm_core;drivers/isdn/gigaset/bas-gigaset.c +16
-16@@ -2565,22 +2565,22 @@ static int gigaset_post_reset(struct usb_interface *intf)static const struct gigaset_ops gigops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_isoc_send_skb, - gigaset_isoc_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_isoc_send_skb, + .handle_input = gigaset_isoc_input, };/* bas_gigaset_init drivers/isdn/gigaset/ser-gigaset.c +16
-16@@ -445,22 +445,22 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb,/* asyncdata.c */ - gigaset_m10x_input,/* asyncdata.c */ + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb,/* asyncdata.c */ + .handle_input = gigaset_m10x_input,/* asyncdata.c */ };drivers/isdn/gigaset/usb-gigaset.c +16
-16@@ -862,22 +862,22 @@ static int gigaset_pre_reset(struct usb_interface *intf) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb, - gigaset_m10x_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb, + .handle_input = gigaset_m10x_input, };/* drivers/isdn/i4l/isdn_concap.c +3
-3@@ -80,9 +80,9 @@ static int isdn_concap_dl_disconn_req(struct concap_proto *concap) }struct concap_device_ops isdn_concap_reliable_dl_dops = { - &isdn_concap_dl_data_req, - &isdn_concap_dl_connect_req, - &isdn_concap_dl_disconn_req + .data_req = &isdn_concap_dl_data_req, + .connect_req = &isdn_concap_dl_connect_req, + .disconn_req = &isdn_concap_dl_disconn_req };/* The following should better go into a dedicated source file such that drivers/isdn/i4l/isdn_x25iface.c +8
-8@@ -53,14 +53,14 @@ static int isdn_x25iface_disconn_ind(struct concap_proto *);static struct concap_proto_ops ix25_pops = { - &isdn_x25iface_proto_new, - &isdn_x25iface_proto_del, - &isdn_x25iface_proto_restart, - &isdn_x25iface_proto_close, - &isdn_x25iface_xmit, - &isdn_x25iface_receive, - &isdn_x25iface_connect_ind, - &isdn_x25iface_disconn_ind + .proto_new = &isdn_x25iface_proto_new, + .proto_del = &isdn_x25iface_proto_del, + .restart = &isdn_x25iface_proto_restart, + .close = &isdn_x25iface_proto_close, + .encap_and_xmit = &isdn_x25iface_xmit, + .data_ind = &isdn_x25iface_receive, + .connect_ind = &isdn_x25iface_connect_ind, + .disconn_ind = &isdn_x25iface_disconn_ind };/* error message helper function */ drivers/media/pci/solo6x10/solo6x10-g723.c +1
-1@@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)int solo_g723_init (struct solo_dev *solo_dev) { -static struct snd_device_ops ops = {NULL }; +static struct snd_device_ops ops = { };struct snd_card *card;struct snd_kcontrol_new kctl;char name[32 ];drivers/net/ethernet/brocade/bna/bna_enet.c +4
-4@@ -1676,10 +1676,10 @@ bna_cb_ioceth_reset(void *arg) }static struct bfa_ioc_cbfn bna_ioceth_cbfn = { - bna_cb_ioceth_enable, - bna_cb_ioceth_disable, - bna_cb_ioceth_hbfail, - bna_cb_ioceth_reset + .enable_cbfn = bna_cb_ioceth_enable, + .disable_cbfn = bna_cb_ioceth_disable, + .hbfail_cbfn = bna_cb_ioceth_hbfail, + .reset_cbfn = bna_cb_ioceth_reset };static void bna_attr_init (struct bna_ioceth *ioceth)drivers/net/wan/lmc/lmc_media.c +49
-48@@ -95,62 +95,63 @@ static inline void write_av9110_bit (lmc_softc_t *, int);static void write_av9110 (lmc_softc_t *,u32 ,u32 ,u32 ,u32 ,u32 );lmc_media_t lmc_ds3_media = { - lmc_ds3_init,/* special media init stuff */ - lmc_ds3_default,/* reset to default state */ - lmc_ds3_set_status,/* reset status to state provided */ - lmc_dummy_set_1,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_ds3_set_100ft,/* set cable length */ - lmc_ds3_set_scram,/* set scrambler */ - lmc_ds3_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_ds3_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ds3_watchdog + .init = lmc_ds3_init,/* special media init stuff */ + .defaults = lmc_ds3_default,/* reset to default state */ + .set_status = lmc_ds3_set_status,/* reset status to state provided */ + .set_clock_source = lmc_dummy_set_1,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_ds3_set_100ft,/* set cable length */ + .set_scrambler = lmc_ds3_set_scram,/* set scrambler */ + .get_link_status = lmc_ds3_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_ds3_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ds3_watchdog };lmc_media_t lmc_hssi_media = { - lmc_hssi_init,/* special media init stuff */ - lmc_hssi_default,/* reset to default state */ - lmc_hssi_set_status,/* reset status to state provided */ - lmc_hssi_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_hssi_get_link_status,/* get link status */ - lmc_hssi_set_link_status,/* set link status */ - lmc_hssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_hssi_watchdog + .init = lmc_hssi_init,/* special media init stuff */ + .defaults = lmc_hssi_default,/* reset to default state */ + .set_status = lmc_hssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_hssi_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_hssi_get_link_status,/* get link status */ + .set_link_status = lmc_hssi_set_link_status,/* set link status */ + .set_crc_length = lmc_hssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_hssi_watchdog }; -lmc_media_t lmc_ssi_media = { lmc_ssi_init,/* special media init stuff */ - lmc_ssi_default,/* reset to default state */ - lmc_ssi_set_status,/* reset status to state provided */ - lmc_ssi_set_clock,/* set clock source */ - lmc_ssi_set_speed,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_ssi_get_link_status,/* get link status */ - lmc_ssi_set_link_status,/* set link status */ - lmc_ssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ssi_watchdog +lmc_media_t lmc_ssi_media = { + .init = lmc_ssi_init,/* special media init stuff */ + .defaults = lmc_ssi_default,/* reset to default state */ + .set_status = lmc_ssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_ssi_set_clock,/* set clock source */ + .set_speed = lmc_ssi_set_speed,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_ssi_get_link_status,/* get link status */ + .set_link_status = lmc_ssi_set_link_status,/* set link status */ + .set_crc_length = lmc_ssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ssi_watchdog };lmc_media_t lmc_t1_media = { - lmc_t1_init,/* special media init stuff */ - lmc_t1_default,/* reset to default state */ - lmc_t1_set_status,/* reset status to state provided */ - lmc_t1_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_t1_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_t1_set_crc_length,/* set CRC length */ - lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ - lmc_t1_watchdog + .init = lmc_t1_init,/* special media init stuff */ + .defaults = lmc_t1_default,/* reset to default state */ + .set_status = lmc_t1_set_status,/* reset status to state provided */ + .set_clock_source = lmc_t1_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_t1_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_t1_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ + .watchdog = lmc_t1_watchdog }; static voiddrivers/scsi/bfa/bfa_fcs.c +15
-4@@ -39,10 +39,21 @@ struct bfa_fcs_mod_s {#define BFA_FCS_MODULE (_mod) { _mod ## _modinit, _mod ## _modexit }static struct bfa_fcs_mod_s fcs_modules[] = { - { bfa_fcs_port_attach,NULL ,NULL }, - { bfa_fcs_uf_attach,NULL ,NULL }, - { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit, - bfa_fcs_fabric_modexit }, + { + .attach = bfa_fcs_port_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_uf_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_fabric_attach, + .modinit = bfa_fcs_fabric_modinit, + .modexit = bfa_fcs_fabric_modexit + }, };/* drivers/scsi/bfa/bfa_fcs_lport.c +20
-9@@ -90,15 +90,26 @@ static struct {void (*offline) (struct bfa_fcs_lport_s *port); } __port_action[] = { { - bfa_fcs_lport_unknown_init, bfa_fcs_lport_unknown_online, - bfa_fcs_lport_unknown_offline}, { - bfa_fcs_lport_fab_init, bfa_fcs_lport_fab_online, - bfa_fcs_lport_fab_offline}, { - bfa_fcs_lport_n2n_init, bfa_fcs_lport_n2n_online, - bfa_fcs_lport_n2n_offline}, { - bfa_fcs_lport_loop_init, bfa_fcs_lport_loop_online, - bfa_fcs_lport_loop_offline}, - }; + .init = bfa_fcs_lport_unknown_init, + .online = bfa_fcs_lport_unknown_online, + .offline = bfa_fcs_lport_unknown_offline + }, + { + .init = bfa_fcs_lport_fab_init, + .online = bfa_fcs_lport_fab_online, + .offline = bfa_fcs_lport_fab_offline + }, + { + .init = bfa_fcs_lport_n2n_init, + .online = bfa_fcs_lport_n2n_online, + .offline = bfa_fcs_lport_n2n_offline + }, + { + .init = bfa_fcs_lport_loop_init, + .online = bfa_fcs_lport_loop_online, + .offline = bfa_fcs_lport_loop_offline + }, +}; /* * fcs_port_sm FCS logical port state machinedrivers/scsi/bfa/bfa_modules.h +6
-6@@ -79,12 +79,12 @@ enum { \ extern struct bfa_module_s hal_mod_ ## __mod; \ struct bfa_module_s hal_mod_ ## __mod = { \ - bfa_ ## __mod ## _meminfo, \ - bfa_ ## __mod ## _attach, \ - bfa_ ## __mod ## _detach, \ - bfa_ ## __mod ## _start, \ - bfa_ ## __mod ## _stop, \ - bfa_ ## __mod ## _iocdisable, \ + .meminfo = bfa_ ## __mod ## _meminfo, \ + .attach = bfa_ ## __mod ## _attach, \ + .detach = bfa_ ## __mod ## _detach, \ + .start = bfa_ ## __mod ## _start, \ + .stop = bfa_ ## __mod ## _stop, \ + .iocdisable = bfa_ ## __mod ## _iocdisable, \ }#define BFA_CACHELINE_SZ (256)drivers/scsi/hpsa.h +20
-20@@ -577,38 +577,38 @@ static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_ioaccel_mode1_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_ioaccel_mode1_intr_pending, - SA5_ioaccel_mode1_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_ioaccel_mode1_intr_pending, + .command_completed = SA5_ioaccel_mode1_completed, };static struct access_method SA5_ioaccel_mode2_access = { - SA5_submit_command_ioaccel2, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_ioaccel2, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access_no_read = { - SA5_submit_command_no_read, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_no_read, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +1
-1@@ -147,7 +147,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,int added = (mode ==LCK_NL );int overlaps =0 ;int splitted =0 ; -const struct ldlm_callback_suite null_cbs = {NULL }; +const struct ldlm_callback_suite null_cbs = { }; CDEBUG(D_DLMTRACE, "flags %#llx owner %llu pid %u mode %u start %llu end %llu\n",drivers/staging/lustre/lustre/libcfs/module.c +5
-5@@ -322,11 +322,11 @@ out: }struct cfs_psdev_ops libcfs_psdev_ops = { - libcfs_psdev_open, - libcfs_psdev_release, -NULL , -NULL , - libcfs_ioctl + .p_open = libcfs_psdev_open, + .p_close = libcfs_psdev_release, + .p_read =NULL , + .p_write =NULL , + .p_ioctl = libcfs_ioctl }; static int proc_call_handler(void *data, int write, loff_t *ppos,drivers/video/fbdev/matrox/matroxfb_DAC1064.c +8
-2@@ -1088,14 +1088,20 @@ static void MGAG100_restore(struct matrox_fb_info *minfo)#ifdef CONFIG_FB_MATROX_MYSTIQUE struct matrox_switch matrox_mystique = { - MGA1064_preinit, MGA1064_reset, MGA1064_init, MGA1064_restore, + .preinit = MGA1064_preinit, + .reset = MGA1064_reset, + .init = MGA1064_init, + .restore = MGA1064_restore, };EXPORT_SYMBOL (matrox_mystique);#endif #ifdef CONFIG_FB_MATROX_G struct matrox_switch matrox_G100 = { - MGAG100_preinit, MGAG100_reset, MGAG100_init, MGAG100_restore, + .preinit = MGAG100_preinit, + .reset = MGAG100_reset, + .init = MGAG100_init, + .restore = MGAG100_restore, };EXPORT_SYMBOL (matrox_G100);#endif drivers/video/fbdev/matrox/matroxfb_Ti3026.c +4
-1@@ -738,7 +738,10 @@ static int Ti3026_preinit(struct matrox_fb_info *minfo) }struct matrox_switch matrox_millennium = { - Ti3026_preinit, Ti3026_reset, Ti3026_init, Ti3026_restore + .preinit = Ti3026_preinit, + .reset = Ti3026_reset, + .init = Ti3026_init, + .restore = Ti3026_restore };EXPORT_SYMBOL (matrox_millennium);#endif fs/reiserfs/item_ops.c +12
-12@@ -724,18 +724,18 @@ static void errcatch_print_vi(struct virtual_item *vi) }static struct item_operations errcatch_ops = { - errcatch_bytes_number, - errcatch_decrement_key, - errcatch_is_left_mergeable, - errcatch_print_item, - errcatch_check_item, - - errcatch_create_vi, - errcatch_check_left, - errcatch_check_right, - errcatch_part_size, - errcatch_unit_num, - errcatch_print_vi + .bytes_number = errcatch_bytes_number, + .decrement_key = errcatch_decrement_key, + .is_left_mergeable = errcatch_is_left_mergeable, + .print_item = errcatch_print_item, + .check_item = errcatch_check_item, + + .create_vi = errcatch_create_vi, + .check_left = errcatch_check_left, + .check_right = errcatch_check_right, + .part_size = errcatch_part_size, + .unit_num = errcatch_unit_num, + .print_vi = errcatch_print_vi };#if ! (TYPE_STAT_DATA ==0 &&TYPE_INDIRECT ==1 &&TYPE_DIRECT ==2 &&TYPE_DIRENTRY ==3 )include/linux/rbtree_augmented.h +3
-1@@ -90,7 +90,9 @@ rbname ## _rotate(struct rb_node *rb_old, struct rb_node *rb_new) \ old->rbaugmented =rbcompute (old); \ } \ rbstatic const struct rb_augment_callbacks rbname = { \ - rbname ## _propagate, rbname ## _copy, rbname ## _rotate \ + .propagate = rbname ## _propagate, \ + .copy = rbname ## _copy, \ + .rotate = rbname ## _rotate \ };lib/rbtree.c +3
-1@@ -412,7 +412,9 @@ static inline void dummy_copy(struct rb_node *old, struct rb_node *new) {}static inline void dummy_rotate (struct rb_node *old,struct rb_node *new) {}static const struct rb_augment_callbacks dummy_callbacks = { - dummy_propagate, dummy_copy, dummy_rotate + .propagate = dummy_propagate, + .copy = dummy_copy, + .rotate = dummy_rotate };void rb_insert_color (struct rb_node *node,struct rb_root *root)mm/page_alloc.c +1
-1@@ -561,7 +561,7 @@ static inline void clear_page_guard(struct zone *zone, struct page *page,__mod_zone_freepage_state (zone, (1 << order), migratetype); }#else -struct page_ext_operations debug_guardpage_ops = {NULL , }; +struct page_ext_operations debug_guardpage_ops = { .need =NULL , .init =NULL };static inline void set_page_guard (struct zone *zone,struct page *page,unsigned int order,int migratetype) {} static inline void clear_page_guard(struct zone *zone, struct page *page,net/atm/lec.c +3
-3@@ -111,9 +111,9 @@ static inline void lec_arp_put(struct lec_arp_table *entry) }static struct lane2_ops lane2_ops = { - lane2_resolve,/* resolve, spec 3.1.3 */ - lane2_associate_req,/* associate_req, spec 3.1.4 */ -NULL /* associate indicator, spec 3.1.5 */ + .resolve = lane2_resolve, + .associate_req = lane2_associate_req, + .associate_indicator =NULL };static unsigned char bus_mac[ETH_ALEN ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };net/atm/mpoa_caches.c +20
-21@@ -535,30 +535,29 @@ static void eg_destroy_cache(struct mpoa_client *mpc)static const struct in_cache_ops ingress_ops = { - in_cache_add_entry,/* add_entry */ - in_cache_get,/* get */ - in_cache_get_with_mask,/* get_with_mask */ - in_cache_get_by_vcc,/* get_by_vcc */ - in_cache_put,/* put */ - in_cache_remove_entry,/* remove_entry */ - cache_hit,/* cache_hit */ - clear_count_and_expired,/* clear_count */ - check_resolving_entries,/* check_resolving */ - refresh_entries,/* refresh */ - in_destroy_cache/* destroy_cache */ + .add_entry = in_cache_add_entry, + .get = in_cache_get, + .get_with_mask = in_cache_get_with_mask, + .get_by_vcc = in_cache_get_by_vcc, + .put = in_cache_put, + .remove_entry = in_cache_remove_entry, + .cache_hit = cache_hit, + .clear_count = clear_count_and_expired, + .check_resolving = check_resolving_entries, + .refresh = refresh_entries, };static const struct eg_cache_ops egress_ops = { - eg_cache_add_entry,/* add_entry */ - eg_cache_get_by_cache_id,/* get_by_cache_id */ - eg_cache_get_by_tag,/* get_by_tag */ - eg_cache_get_by_vcc,/* get_by_vcc */ - eg_cache_get_by_src_ip,/* get_by_src_ip */ - eg_cache_put,/* put */ - eg_cache_remove_entry,/* remove_entry */ - update_eg_cache_entry,/* update */ - clear_expired,/* clear_expired */ - eg_destroy_cache/* destroy_cache */ + .add_entry = eg_cache_add_entry, + .get_by_cache_id = eg_cache_get_by_cache_id, + .get_by_tag = eg_cache_get_by_tag, + .get_by_vcc = eg_cache_get_by_vcc, + .get_by_src_ip = eg_cache_get_by_src_ip, + .put = eg_cache_put, + .remove_entry = eg_cache_remove_entry, + .update = update_eg_cache_entry, + .clear_expired = clear_expired, + .destroy_cache = eg_destroy_cache };net/vmw_vsock/vmci_transport_notify.c +15
-15@@ -662,19 +662,19 @@ static void vmci_transport_notify_pkt_process_negotiate(struct sock *sk)/* Socket control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };net/vmw_vsock/vmci_transport_notify_qstate.c +15
-15@@ -420,19 +420,19 @@ vmci_transport_notify_pkt_send_pre_enqueue(/* Socket always on control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };sound/synth/emux/emux_seq.c +7
-8@@ -33,13 +33,13 @@ static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *inf* MIDI emulation operators */ static struct snd_midi_op emux_ops = { - snd_emux_note_on, - snd_emux_note_off, - snd_emux_key_press, - snd_emux_terminate_note, - snd_emux_control, - snd_emux_nrpn, - snd_emux_sysex, + .note_on = snd_emux_note_on, + .note_off = snd_emux_note_off, + .key_press = snd_emux_key_press, + .note_terminate = snd_emux_terminate_note, + .control = snd_emux_control, + .nrpn = snd_emux_nrpn, + .sysex = snd_emux_sysex, }; --Quoted 2 lines
1.9.1
--
Kees Cook
Chrome OS & Brillo Security--
Kees Cook
Chrome OS & Brillo Security
Signature · 2 lines
Kees Cook Chrome OS & Brillo Security
[kernel-hardening] Re: [RFC 3/3] Change initialization C99 style; tag no_ramdomize_layout structs
Quoted 38 lines · Kees Cook
Quoted 37 lines · Julia Lawall
Quoted 25 lines · Kees Cook
Quoted 24 lines · Julia Lawall
Quoted 21 lines · Kees Cook
Quoted 9 lines · Michael Leibowitz
Due to randomization of structs, the in order struct intialization style is replaced with explicit field style.
struct
foo_tmy_foo= {
one,
two,
three
};Quoted 7 lines
becomes
struct foo_t my_foo = { .one = one, .two = two, .three = three };Can a coccinelle script be written to do this also? It might be useful to keep that around.
Quoted 6 lines
Quoted 2 lines
Is this needed for all kinds of structure initializations, ie for both local and global variables, or only for global variables?
It's needed for any structure that has been globally defined. As in, any use of a struct must be using C99 since that structure may be randomized (in any context: global, local).
I'm not sure to understand what it means for a structure to be globally defined. If the code is:
Quoted 8 lines
Quoted 6 lines
int f(...) {
struct foo x = { 3, 4, 5, };
...
}is it correct that it does not need to use C99?
As I understand it, your example will need to use C99 initialization.
So it's as long as the type definition is global?
julia
Quoted 1,222 lines
-Kees
Quoted 1,212 lines
thanks,
juliaQuoted 1,208 lines
Michael, what's the state of this series? What're your next steps?
-Kees
Quoted 1,197 lines
thanks,
juliaQuoted 1,193 lines
Quoted 4 lines
Additionally, tag paravirt related structures to explicitly not be randomized, as the structure layout is important.
This might need to be split out? It's logically separate. Also, I think this needs to come before the plugin, since the plugin isn't usable until this patch is in place.
-Kees
Quoted 1,173 lines
This feature is ported over from grsecurity. This is largely unchanged from the Original code written by the PaX Team and Spender.
Signed-off-by Michael Leibowitz <[email protected]>--- arch/x86/include/asm/floppy.h | 20 ++--- arch/x86/include/asm/paravirt_types.h | 18 +++-- drivers/acpi/acpica/hwxfsleep.c | 11 +-- drivers/block/cciss.h | 30 ++++---- drivers/gpu/drm/nouveau/nouveau_ttm.c | 28 +++---- drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 +-- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 10 +-- drivers/infiniband/hw/nes/nes_cm.c | 22 +++--- drivers/isdn/gigaset/bas-gigaset.c | 32 ++++---- drivers/isdn/gigaset/ser-gigaset.c | 32 ++++---- drivers/isdn/gigaset/usb-gigaset.c | 32 ++++---- drivers/isdn/i4l/isdn_concap.c | 6 +- drivers/isdn/i4l/isdn_x25iface.c | 16 ++-- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- drivers/net/ethernet/brocade/bna/bna_enet.c | 8 +- drivers/net/wan/lmc/lmc_media.c | 97 +++++++++++++------------ drivers/scsi/bfa/bfa_fcs.c | 19 ++++- drivers/scsi/bfa/bfa_fcs_lport.c | 29 +++++--- drivers/scsi/bfa/bfa_modules.h | 12 +-- drivers/scsi/hpsa.h | 40 +++++----- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 10 +-- drivers/video/fbdev/matrox/matroxfb_DAC1064.c | 10 ++- drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 5 +- fs/reiserfs/item_ops.c | 24 +++--- include/linux/rbtree_augmented.h | 4 +- lib/rbtree.c | 4 +- mm/page_alloc.c | 2 +- net/atm/lec.c | 6 +- net/atm/mpoa_caches.c | 41 +++++------ net/vmw_vsock/vmci_transport_notify.c | 30 ++++---- net/vmw_vsock/vmci_transport_notify_qstate.c | 30 ++++---- sound/synth/emux/emux_seq.c | 14 ++-- 34 files changed, 352 insertions(+), 314 deletions(-)arch/x86/include/asm/floppy.h +10
-10@@ -229,18 +229,18 @@ static struct fd_routine_l {int (*_dma_setup)(char *addr,unsigned long size,int mode,int io); } fd_routine[] = { { - request_dma, - free_dma, - get_dma_residue, - dma_mem_alloc, - hard_dma_setup + ._request_dma = request_dma, + ._free_dma = free_dma, + ._get_dma_residue = get_dma_residue, + ._dma_mem_alloc = dma_mem_alloc, + ._dma_setup = hard_dma_setup }, { - vdma_request_dma, - vdma_nop, - vdma_get_dma_residue, - vdma_mem_alloc, - vdma_dma_setup + ._request_dma = vdma_request_dma, + ._free_dma = vdma_nop, + ._get_dma_residue = vdma_get_dma_residue, + ._dma_mem_alloc = vdma_mem_alloc, + ._dma_setup = vdma_dma_setup } };arch/x86/include/asm/paravirt_types.h +10
-8@@ -89,7 +89,7 @@ struct pv_init_ops {*/ unsigned (*patch)(u8 type,u16 clobber,void *insnbuf,unsigned long addr,unsigned len); -}; +} __no_randomize_layout;struct pv_lazy_ops {@@ -97,12 +97,12 @@ struct pv_lazy_ops {void (*enter)(void );void (*leave)(void );void (*flush)(void ); -}; +} __no_randomize_layout;struct pv_time_ops {unsigned long long (*sched_clock)(void );unsigned long long (*steal_clock)(int cpu); -}; +} __no_randomize_layout;struct pv_cpu_ops {/* hooks for various privileged instructions */ @@ -178,7 +178,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); -}; +} __no_randomize_layout;struct pv_irq_ops {/* @@ -201,7 +201,7 @@ struct pv_irq_ops {#ifdef CONFIG_X86_64 void (*adjust_exception_frame)(void );#endif -}; +} __no_randomize_layout;struct pv_mmu_ops {unsigned long (*read_cr2)(void );@@ -296,7 +296,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); -}; +} __no_randomize_layout;struct arch_spinlock ;#ifdef CONFIG_SMP @@ -322,7 +322,9 @@ struct pv_lock_ops {/* This contains all the paravirt structures: we get a convenient * number for each function using the offset which we use to indicate -* what to patch. */ +* what to patch. +* shouldn't be randomized due to the "NEAT TRICK" in paravirt.c +*/ struct paravirt_patch_template {struct pv_init_ops pv_init_ops;struct pv_time_ops pv_time_ops;@@ -330,7 +332,7 @@ struct paravirt_patch_template {struct pv_irq_ops pv_irq_ops;struct pv_mmu_ops pv_mmu_ops;struct pv_lock_ops pv_lock_ops; -}; +} __no_randomize_layout;extern struct pv_info pv_info;extern struct pv_init_ops pv_init_ops;drivers/acpi/acpica/hwxfsleep.c +6
-5@@ -70,11 +70,12 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), - acpi_hw_extended_sleep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), - acpi_hw_extended_wake_prep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), acpi_hw_extended_wake} + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), + .extended_function = acpi_hw_extended_sleep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), + .extended_function = acpi_hw_extended_wake_prep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), + .extended_function = acpi_hw_extended_wake} };/* drivers/block/cciss.h +15
-15@@ -402,27 +402,27 @@ static bool SA5_performant_intr_pending(ctlr_info_t *h) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_fifo_full, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5B_access = { - SA5_submit_command, - SA5B_intr_mask, - SA5_fifo_full, - SA5B_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5B_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5B_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_fifo_full, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/gpu/drm/nouveau/nouveau_ttm.c +14
-14@@ -107,10 +107,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func nouveau_vram_manager = { - nouveau_vram_manager_init, - nouveau_vram_manager_fini, - nouveau_vram_manager_new, - nouveau_vram_manager_del, + .init = nouveau_vram_manager_init, + .takedown = nouveau_vram_manager_fini, + .get_node = nouveau_vram_manager_new, + .put_node = nouveau_vram_manager_del, }; static int@@ -183,11 +183,11 @@ nouveau_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nouveau_gart_manager = { - nouveau_gart_manager_init, - nouveau_gart_manager_fini, - nouveau_gart_manager_new, - nouveau_gart_manager_del, - nouveau_gart_manager_debug + .init = nouveau_gart_manager_init, + .takedown = nouveau_gart_manager_fini, + .get_node = nouveau_gart_manager_new, + .put_node = nouveau_gart_manager_del, + .debug = nouveau_gart_manager_debug };/*XXX*/ @@ -256,11 +256,11 @@ nv04_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nv04_gart_manager = { - nv04_gart_manager_init, - nv04_gart_manager_fini, - nv04_gart_manager_new, - nv04_gart_manager_del, - nv04_gart_manager_debug + .init = nv04_gart_manager_init, + .takedown = nv04_gart_manager_fini, + .get_node = nv04_gart_manager_new, + .put_node = nv04_gart_manager_del, + .debug = nv04_gart_manager_debug };int drivers/gpu/drm/ttm/ttm_bo_manager.c +5
-5@@ -148,10 +148,10 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func ttm_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug };EXPORT_SYMBOL (ttm_bo_manager_func);drivers/gpu/drm/virtio/virtgpu_ttm.c +5
-5@@ -198,11 +198,11 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }static const struct ttm_mem_type_manager_func virtio_gpu_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug }; static int virtio_gpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +5
-5@@ -164,9 +164,9 @@ static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func vmw_gmrid_manager_func = { - vmw_gmrid_man_init, - vmw_gmrid_man_takedown, - vmw_gmrid_man_get_node, - vmw_gmrid_man_put_node, - vmw_gmrid_man_debug + .init = vmw_gmrid_man_init, + .takedown = vmw_gmrid_man_takedown, + .get_node = vmw_gmrid_man_get_node, + .put_node = vmw_gmrid_man_put_node, + .debug = vmw_gmrid_man_debug };drivers/infiniband/hw/nes/nes_cm.c +11
-11@@ -135,17 +135,17 @@ static void record_ird_ord(struct nes_cm_node *, u16, u16);/* instance of function pointers for client API */ /* set address of this instance to cm_core->cm_ops at cm_core alloc */ static const struct nes_cm_ops nes_cm_api = { - mini_cm_accelerated, - mini_cm_listen, - mini_cm_del_listen, - mini_cm_connect, - mini_cm_close, - mini_cm_accept, - mini_cm_reject, - mini_cm_recv_pkt, - mini_cm_dealloc_core, - mini_cm_get, - mini_cm_set + .accelerated = mini_cm_accelerated, + .listen = mini_cm_listen, + .stop_listener = mini_cm_del_listen, + .connect = mini_cm_connect, + .close = mini_cm_close, + .accept = mini_cm_accept, + .reject = mini_cm_reject, + .recv_pkt = mini_cm_recv_pkt, + .destroy_cm_core = mini_cm_dealloc_core, + .get = mini_cm_get, + .set = mini_cm_set };static struct nes_cm_core *g_cm_core;drivers/isdn/gigaset/bas-gigaset.c +16
-16@@ -2565,22 +2565,22 @@ static int gigaset_post_reset(struct usb_interface *intf)static const struct gigaset_ops gigops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_isoc_send_skb, - gigaset_isoc_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_isoc_send_skb, + .handle_input = gigaset_isoc_input, };/* bas_gigaset_init drivers/isdn/gigaset/ser-gigaset.c +16
-16@@ -445,22 +445,22 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb,/* asyncdata.c */ - gigaset_m10x_input,/* asyncdata.c */ + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb,/* asyncdata.c */ + .handle_input = gigaset_m10x_input,/* asyncdata.c */ };drivers/isdn/gigaset/usb-gigaset.c +16
-16@@ -862,22 +862,22 @@ static int gigaset_pre_reset(struct usb_interface *intf) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb, - gigaset_m10x_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb, + .handle_input = gigaset_m10x_input, };/* drivers/isdn/i4l/isdn_concap.c +3
-3@@ -80,9 +80,9 @@ static int isdn_concap_dl_disconn_req(struct concap_proto *concap) }struct concap_device_ops isdn_concap_reliable_dl_dops = { - &isdn_concap_dl_data_req, - &isdn_concap_dl_connect_req, - &isdn_concap_dl_disconn_req + .data_req = &isdn_concap_dl_data_req, + .connect_req = &isdn_concap_dl_connect_req, + .disconn_req = &isdn_concap_dl_disconn_req };/* The following should better go into a dedicated source file such that drivers/isdn/i4l/isdn_x25iface.c +8
-8@@ -53,14 +53,14 @@ static int isdn_x25iface_disconn_ind(struct concap_proto *);static struct concap_proto_ops ix25_pops = { - &isdn_x25iface_proto_new, - &isdn_x25iface_proto_del, - &isdn_x25iface_proto_restart, - &isdn_x25iface_proto_close, - &isdn_x25iface_xmit, - &isdn_x25iface_receive, - &isdn_x25iface_connect_ind, - &isdn_x25iface_disconn_ind + .proto_new = &isdn_x25iface_proto_new, + .proto_del = &isdn_x25iface_proto_del, + .restart = &isdn_x25iface_proto_restart, + .close = &isdn_x25iface_proto_close, + .encap_and_xmit = &isdn_x25iface_xmit, + .data_ind = &isdn_x25iface_receive, + .connect_ind = &isdn_x25iface_connect_ind, + .disconn_ind = &isdn_x25iface_disconn_ind };/* error message helper function */ drivers/media/pci/solo6x10/solo6x10-g723.c +1
-1@@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)int solo_g723_init (struct solo_dev *solo_dev) { -static struct snd_device_ops ops = {NULL }; +static struct snd_device_ops ops = { };struct snd_card *card;struct snd_kcontrol_new kctl;char name[32 ];drivers/net/ethernet/brocade/bna/bna_enet.c +4
-4@@ -1676,10 +1676,10 @@ bna_cb_ioceth_reset(void *arg) }static struct bfa_ioc_cbfn bna_ioceth_cbfn = { - bna_cb_ioceth_enable, - bna_cb_ioceth_disable, - bna_cb_ioceth_hbfail, - bna_cb_ioceth_reset + .enable_cbfn = bna_cb_ioceth_enable, + .disable_cbfn = bna_cb_ioceth_disable, + .hbfail_cbfn = bna_cb_ioceth_hbfail, + .reset_cbfn = bna_cb_ioceth_reset };static void bna_attr_init (struct bna_ioceth *ioceth)drivers/net/wan/lmc/lmc_media.c +49
-48@@ -95,62 +95,63 @@ static inline void write_av9110_bit (lmc_softc_t *, int);static void write_av9110 (lmc_softc_t *,u32 ,u32 ,u32 ,u32 ,u32 );lmc_media_t lmc_ds3_media = { - lmc_ds3_init,/* special media init stuff */ - lmc_ds3_default,/* reset to default state */ - lmc_ds3_set_status,/* reset status to state provided */ - lmc_dummy_set_1,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_ds3_set_100ft,/* set cable length */ - lmc_ds3_set_scram,/* set scrambler */ - lmc_ds3_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_ds3_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ds3_watchdog + .init = lmc_ds3_init,/* special media init stuff */ + .defaults = lmc_ds3_default,/* reset to default state */ + .set_status = lmc_ds3_set_status,/* reset status to state provided */ + .set_clock_source = lmc_dummy_set_1,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_ds3_set_100ft,/* set cable length */ + .set_scrambler = lmc_ds3_set_scram,/* set scrambler */ + .get_link_status = lmc_ds3_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_ds3_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ds3_watchdog };lmc_media_t lmc_hssi_media = { - lmc_hssi_init,/* special media init stuff */ - lmc_hssi_default,/* reset to default state */ - lmc_hssi_set_status,/* reset status to state provided */ - lmc_hssi_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_hssi_get_link_status,/* get link status */ - lmc_hssi_set_link_status,/* set link status */ - lmc_hssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_hssi_watchdog + .init = lmc_hssi_init,/* special media init stuff */ + .defaults = lmc_hssi_default,/* reset to default state */ + .set_status = lmc_hssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_hssi_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_hssi_get_link_status,/* get link status */ + .set_link_status = lmc_hssi_set_link_status,/* set link status */ + .set_crc_length = lmc_hssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_hssi_watchdog }; -lmc_media_t lmc_ssi_media = { lmc_ssi_init,/* special media init stuff */ - lmc_ssi_default,/* reset to default state */ - lmc_ssi_set_status,/* reset status to state provided */ - lmc_ssi_set_clock,/* set clock source */ - lmc_ssi_set_speed,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_ssi_get_link_status,/* get link status */ - lmc_ssi_set_link_status,/* set link status */ - lmc_ssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ssi_watchdog +lmc_media_t lmc_ssi_media = { + .init = lmc_ssi_init,/* special media init stuff */ + .defaults = lmc_ssi_default,/* reset to default state */ + .set_status = lmc_ssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_ssi_set_clock,/* set clock source */ + .set_speed = lmc_ssi_set_speed,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_ssi_get_link_status,/* get link status */ + .set_link_status = lmc_ssi_set_link_status,/* set link status */ + .set_crc_length = lmc_ssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ssi_watchdog };lmc_media_t lmc_t1_media = { - lmc_t1_init,/* special media init stuff */ - lmc_t1_default,/* reset to default state */ - lmc_t1_set_status,/* reset status to state provided */ - lmc_t1_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_t1_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_t1_set_crc_length,/* set CRC length */ - lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ - lmc_t1_watchdog + .init = lmc_t1_init,/* special media init stuff */ + .defaults = lmc_t1_default,/* reset to default state */ + .set_status = lmc_t1_set_status,/* reset status to state provided */ + .set_clock_source = lmc_t1_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_t1_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_t1_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ + .watchdog = lmc_t1_watchdog }; static voiddrivers/scsi/bfa/bfa_fcs.c +15
-4@@ -39,10 +39,21 @@ struct bfa_fcs_mod_s {#define BFA_FCS_MODULE (_mod) { _mod ## _modinit, _mod ## _modexit }static struct bfa_fcs_mod_s fcs_modules[] = { - { bfa_fcs_port_attach,NULL ,NULL }, - { bfa_fcs_uf_attach,NULL ,NULL }, - { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit, - bfa_fcs_fabric_modexit }, + { + .attach = bfa_fcs_port_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_uf_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_fabric_attach, + .modinit = bfa_fcs_fabric_modinit, + .modexit = bfa_fcs_fabric_modexit + }, };/* drivers/scsi/bfa/bfa_fcs_lport.c +20
-9@@ -90,15 +90,26 @@ static struct {void (*offline) (struct bfa_fcs_lport_s *port); } __port_action[] = { { - bfa_fcs_lport_unknown_init, bfa_fcs_lport_unknown_online, - bfa_fcs_lport_unknown_offline}, { - bfa_fcs_lport_fab_init, bfa_fcs_lport_fab_online, - bfa_fcs_lport_fab_offline}, { - bfa_fcs_lport_n2n_init, bfa_fcs_lport_n2n_online, - bfa_fcs_lport_n2n_offline}, { - bfa_fcs_lport_loop_init, bfa_fcs_lport_loop_online, - bfa_fcs_lport_loop_offline}, - }; + .init = bfa_fcs_lport_unknown_init, + .online = bfa_fcs_lport_unknown_online, + .offline = bfa_fcs_lport_unknown_offline + }, + { + .init = bfa_fcs_lport_fab_init, + .online = bfa_fcs_lport_fab_online, + .offline = bfa_fcs_lport_fab_offline + }, + { + .init = bfa_fcs_lport_n2n_init, + .online = bfa_fcs_lport_n2n_online, + .offline = bfa_fcs_lport_n2n_offline + }, + { + .init = bfa_fcs_lport_loop_init, + .online = bfa_fcs_lport_loop_online, + .offline = bfa_fcs_lport_loop_offline + }, +}; /* * fcs_port_sm FCS logical port state machinedrivers/scsi/bfa/bfa_modules.h +6
-6@@ -79,12 +79,12 @@ enum { \ extern struct bfa_module_s hal_mod_ ## __mod; \ struct bfa_module_s hal_mod_ ## __mod = { \ - bfa_ ## __mod ## _meminfo, \ - bfa_ ## __mod ## _attach, \ - bfa_ ## __mod ## _detach, \ - bfa_ ## __mod ## _start, \ - bfa_ ## __mod ## _stop, \ - bfa_ ## __mod ## _iocdisable, \ + .meminfo = bfa_ ## __mod ## _meminfo, \ + .attach = bfa_ ## __mod ## _attach, \ + .detach = bfa_ ## __mod ## _detach, \ + .start = bfa_ ## __mod ## _start, \ + .stop = bfa_ ## __mod ## _stop, \ + .iocdisable = bfa_ ## __mod ## _iocdisable, \ }#define BFA_CACHELINE_SZ (256)drivers/scsi/hpsa.h +20
-20@@ -577,38 +577,38 @@ static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_ioaccel_mode1_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_ioaccel_mode1_intr_pending, - SA5_ioaccel_mode1_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_ioaccel_mode1_intr_pending, + .command_completed = SA5_ioaccel_mode1_completed, };static struct access_method SA5_ioaccel_mode2_access = { - SA5_submit_command_ioaccel2, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_ioaccel2, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access_no_read = { - SA5_submit_command_no_read, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_no_read, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +1
-1@@ -147,7 +147,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,int added = (mode ==LCK_NL );int overlaps =0 ;int splitted =0 ; -const struct ldlm_callback_suite null_cbs = {NULL }; +const struct ldlm_callback_suite null_cbs = { }; CDEBUG(D_DLMTRACE, "flags %#llx owner %llu pid %u mode %u start %llu end %llu\n",drivers/staging/lustre/lustre/libcfs/module.c +5
-5@@ -322,11 +322,11 @@ out: }struct cfs_psdev_ops libcfs_psdev_ops = { - libcfs_psdev_open, - libcfs_psdev_release, -NULL , -NULL , - libcfs_ioctl + .p_open = libcfs_psdev_open, + .p_close = libcfs_psdev_release, + .p_read =NULL , + .p_write =NULL , + .p_ioctl = libcfs_ioctl }; static int proc_call_handler(void *data, int write, loff_t *ppos,drivers/video/fbdev/matrox/matroxfb_DAC1064.c +8
-2@@ -1088,14 +1088,20 @@ static void MGAG100_restore(struct matrox_fb_info *minfo)#ifdef CONFIG_FB_MATROX_MYSTIQUE struct matrox_switch matrox_mystique = { - MGA1064_preinit, MGA1064_reset, MGA1064_init, MGA1064_restore, + .preinit = MGA1064_preinit, + .reset = MGA1064_reset, + .init = MGA1064_init, + .restore = MGA1064_restore, };EXPORT_SYMBOL (matrox_mystique);#endif #ifdef CONFIG_FB_MATROX_G struct matrox_switch matrox_G100 = { - MGAG100_preinit, MGAG100_reset, MGAG100_init, MGAG100_restore, + .preinit = MGAG100_preinit, + .reset = MGAG100_reset, + .init = MGAG100_init, + .restore = MGAG100_restore, };EXPORT_SYMBOL (matrox_G100);#endif drivers/video/fbdev/matrox/matroxfb_Ti3026.c +4
-1@@ -738,7 +738,10 @@ static int Ti3026_preinit(struct matrox_fb_info *minfo) }struct matrox_switch matrox_millennium = { - Ti3026_preinit, Ti3026_reset, Ti3026_init, Ti3026_restore + .preinit = Ti3026_preinit, + .reset = Ti3026_reset, + .init = Ti3026_init, + .restore = Ti3026_restore };EXPORT_SYMBOL (matrox_millennium);#endif fs/reiserfs/item_ops.c +12
-12@@ -724,18 +724,18 @@ static void errcatch_print_vi(struct virtual_item *vi) }static struct item_operations errcatch_ops = { - errcatch_bytes_number, - errcatch_decrement_key, - errcatch_is_left_mergeable, - errcatch_print_item, - errcatch_check_item, - - errcatch_create_vi, - errcatch_check_left, - errcatch_check_right, - errcatch_part_size, - errcatch_unit_num, - errcatch_print_vi + .bytes_number = errcatch_bytes_number, + .decrement_key = errcatch_decrement_key, + .is_left_mergeable = errcatch_is_left_mergeable, + .print_item = errcatch_print_item, + .check_item = errcatch_check_item, + + .create_vi = errcatch_create_vi, + .check_left = errcatch_check_left, + .check_right = errcatch_check_right, + .part_size = errcatch_part_size, + .unit_num = errcatch_unit_num, + .print_vi = errcatch_print_vi };#if ! (TYPE_STAT_DATA ==0 &&TYPE_INDIRECT ==1 &&TYPE_DIRECT ==2 &&TYPE_DIRENTRY ==3 )include/linux/rbtree_augmented.h +3
-1@@ -90,7 +90,9 @@ rbname ## _rotate(struct rb_node *rb_old, struct rb_node *rb_new) \ old->rbaugmented =rbcompute (old); \ } \ rbstatic const struct rb_augment_callbacks rbname = { \ - rbname ## _propagate, rbname ## _copy, rbname ## _rotate \ + .propagate = rbname ## _propagate, \ + .copy = rbname ## _copy, \ + .rotate = rbname ## _rotate \ };lib/rbtree.c +3
-1@@ -412,7 +412,9 @@ static inline void dummy_copy(struct rb_node *old, struct rb_node *new) {}static inline void dummy_rotate (struct rb_node *old,struct rb_node *new) {}static const struct rb_augment_callbacks dummy_callbacks = { - dummy_propagate, dummy_copy, dummy_rotate + .propagate = dummy_propagate, + .copy = dummy_copy, + .rotate = dummy_rotate };void rb_insert_color (struct rb_node *node,struct rb_root *root)mm/page_alloc.c +1
-1@@ -561,7 +561,7 @@ static inline void clear_page_guard(struct zone *zone, struct page *page,__mod_zone_freepage_state (zone, (1 << order), migratetype); }#else -struct page_ext_operations debug_guardpage_ops = {NULL , }; +struct page_ext_operations debug_guardpage_ops = { .need =NULL , .init =NULL };static inline void set_page_guard (struct zone *zone,struct page *page,unsigned int order,int migratetype) {} static inline void clear_page_guard(struct zone *zone, struct page *page,net/atm/lec.c +3
-3@@ -111,9 +111,9 @@ static inline void lec_arp_put(struct lec_arp_table *entry) }static struct lane2_ops lane2_ops = { - lane2_resolve,/* resolve, spec 3.1.3 */ - lane2_associate_req,/* associate_req, spec 3.1.4 */ -NULL /* associate indicator, spec 3.1.5 */ + .resolve = lane2_resolve, + .associate_req = lane2_associate_req, + .associate_indicator =NULL };static unsigned char bus_mac[ETH_ALEN ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };net/atm/mpoa_caches.c +20
-21@@ -535,30 +535,29 @@ static void eg_destroy_cache(struct mpoa_client *mpc)static const struct in_cache_ops ingress_ops = { - in_cache_add_entry,/* add_entry */ - in_cache_get,/* get */ - in_cache_get_with_mask,/* get_with_mask */ - in_cache_get_by_vcc,/* get_by_vcc */ - in_cache_put,/* put */ - in_cache_remove_entry,/* remove_entry */ - cache_hit,/* cache_hit */ - clear_count_and_expired,/* clear_count */ - check_resolving_entries,/* check_resolving */ - refresh_entries,/* refresh */ - in_destroy_cache/* destroy_cache */ + .add_entry = in_cache_add_entry, + .get = in_cache_get, + .get_with_mask = in_cache_get_with_mask, + .get_by_vcc = in_cache_get_by_vcc, + .put = in_cache_put, + .remove_entry = in_cache_remove_entry, + .cache_hit = cache_hit, + .clear_count = clear_count_and_expired, + .check_resolving = check_resolving_entries, + .refresh = refresh_entries, };static const struct eg_cache_ops egress_ops = { - eg_cache_add_entry,/* add_entry */ - eg_cache_get_by_cache_id,/* get_by_cache_id */ - eg_cache_get_by_tag,/* get_by_tag */ - eg_cache_get_by_vcc,/* get_by_vcc */ - eg_cache_get_by_src_ip,/* get_by_src_ip */ - eg_cache_put,/* put */ - eg_cache_remove_entry,/* remove_entry */ - update_eg_cache_entry,/* update */ - clear_expired,/* clear_expired */ - eg_destroy_cache/* destroy_cache */ + .add_entry = eg_cache_add_entry, + .get_by_cache_id = eg_cache_get_by_cache_id, + .get_by_tag = eg_cache_get_by_tag, + .get_by_vcc = eg_cache_get_by_vcc, + .get_by_src_ip = eg_cache_get_by_src_ip, + .put = eg_cache_put, + .remove_entry = eg_cache_remove_entry, + .update = update_eg_cache_entry, + .clear_expired = clear_expired, + .destroy_cache = eg_destroy_cache };net/vmw_vsock/vmci_transport_notify.c +15
-15@@ -662,19 +662,19 @@ static void vmci_transport_notify_pkt_process_negotiate(struct sock *sk)/* Socket control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };net/vmw_vsock/vmci_transport_notify_qstate.c +15
-15@@ -420,19 +420,19 @@ vmci_transport_notify_pkt_send_pre_enqueue(/* Socket always on control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };sound/synth/emux/emux_seq.c +7
-8@@ -33,13 +33,13 @@ static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *inf* MIDI emulation operators */ static struct snd_midi_op emux_ops = { - snd_emux_note_on, - snd_emux_note_off, - snd_emux_key_press, - snd_emux_terminate_note, - snd_emux_control, - snd_emux_nrpn, - snd_emux_sysex, + .note_on = snd_emux_note_on, + .note_off = snd_emux_note_off, + .key_press = snd_emux_key_press, + .note_terminate = snd_emux_terminate_note, + .control = snd_emux_control, + .nrpn = snd_emux_nrpn, + .sysex = snd_emux_sysex, }; --Quoted 2 lines
1.9.1
--
Kees Cook
Chrome OS & Brillo Security--
Kees Cook
Chrome OS & Brillo SecuritySignature · 2 lines
Kees Cook Chrome OS & Brillo Security
[kernel-hardening] Re: [RFC 3/3] Change initialization C99 style; tag no_ramdomize_layout structs
Quoted 47 lines · Julia Lawall
Quoted 43 lines · Kees Cook
Quoted 42 lines · Julia Lawall
Quoted 25 lines · Kees Cook
Quoted 24 lines · Julia Lawall
Quoted 21 lines · Kees Cook
Quoted 9 lines · Michael Leibowitz
Due to randomization of structs, the in order struct intialization style is replaced with explicit field style.
struct
foo_tmy_foo= {
one,
two,
three
};Quoted 7 lines
becomes
struct foo_t my_foo = { .one = one, .two = two, .three = three };Can a coccinelle script be written to do this also? It might be useful to keep that around.
Quoted 6 lines
Quoted 2 lines
Is this needed for all kinds of structure initializations, ie for both local and global variables, or only for global variables?
It's needed for any structure that has been globally defined. As in, any use of a struct must be using C99 since that structure may be randomized (in any context: global, local).
I'm not sure to understand what it means for a structure to be globally defined. If the code is:
int f(...) {
struct foo x = { 3, 4, 5, };
...
}
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
is it correct that it does not need to use C99?
As I understand it, your example will need to use C99 initialization.
So it's as long as the type definition is global?
That's my understanding, but I haven't tested it under the plugin. It should be easy enough to report the offsetof of a local type across multiple builds under the plugin, though.
-Kees
Quoted 1,225 lines
julia
Quoted 1,222 lines
-Kees
Quoted 1,212 lines
thanks,
juliaQuoted 1,208 lines
Michael, what's the state of this series? What're your next steps?
-Kees
Quoted 1,197 lines
thanks,
juliaQuoted 1,193 lines
Quoted 4 lines
Additionally, tag paravirt related structures to explicitly not be randomized, as the structure layout is important.
This might need to be split out? It's logically separate. Also, I think this needs to come before the plugin, since the plugin isn't usable until this patch is in place.
-Kees
Quoted 1,173 lines
This feature is ported over from grsecurity. This is largely unchanged from the Original code written by the PaX Team and Spender.
Signed-off-by Michael Leibowitz <[email protected]>--- arch/x86/include/asm/floppy.h | 20 ++--- arch/x86/include/asm/paravirt_types.h | 18 +++-- drivers/acpi/acpica/hwxfsleep.c | 11 +-- drivers/block/cciss.h | 30 ++++---- drivers/gpu/drm/nouveau/nouveau_ttm.c | 28 +++---- drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 +-- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 10 +-- drivers/infiniband/hw/nes/nes_cm.c | 22 +++--- drivers/isdn/gigaset/bas-gigaset.c | 32 ++++---- drivers/isdn/gigaset/ser-gigaset.c | 32 ++++---- drivers/isdn/gigaset/usb-gigaset.c | 32 ++++---- drivers/isdn/i4l/isdn_concap.c | 6 +- drivers/isdn/i4l/isdn_x25iface.c | 16 ++-- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- drivers/net/ethernet/brocade/bna/bna_enet.c | 8 +- drivers/net/wan/lmc/lmc_media.c | 97 +++++++++++++------------ drivers/scsi/bfa/bfa_fcs.c | 19 ++++- drivers/scsi/bfa/bfa_fcs_lport.c | 29 +++++--- drivers/scsi/bfa/bfa_modules.h | 12 +-- drivers/scsi/hpsa.h | 40 +++++----- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 10 +-- drivers/video/fbdev/matrox/matroxfb_DAC1064.c | 10 ++- drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 5 +- fs/reiserfs/item_ops.c | 24 +++--- include/linux/rbtree_augmented.h | 4 +- lib/rbtree.c | 4 +- mm/page_alloc.c | 2 +- net/atm/lec.c | 6 +- net/atm/mpoa_caches.c | 41 +++++------ net/vmw_vsock/vmci_transport_notify.c | 30 ++++---- net/vmw_vsock/vmci_transport_notify_qstate.c | 30 ++++---- sound/synth/emux/emux_seq.c | 14 ++-- 34 files changed, 352 insertions(+), 314 deletions(-)arch/x86/include/asm/floppy.h +10
-10@@ -229,18 +229,18 @@ static struct fd_routine_l {int (*_dma_setup)(char *addr,unsigned long size,int mode,int io); } fd_routine[] = { { - request_dma, - free_dma, - get_dma_residue, - dma_mem_alloc, - hard_dma_setup + ._request_dma = request_dma, + ._free_dma = free_dma, + ._get_dma_residue = get_dma_residue, + ._dma_mem_alloc = dma_mem_alloc, + ._dma_setup = hard_dma_setup }, { - vdma_request_dma, - vdma_nop, - vdma_get_dma_residue, - vdma_mem_alloc, - vdma_dma_setup + ._request_dma = vdma_request_dma, + ._free_dma = vdma_nop, + ._get_dma_residue = vdma_get_dma_residue, + ._dma_mem_alloc = vdma_mem_alloc, + ._dma_setup = vdma_dma_setup } };arch/x86/include/asm/paravirt_types.h +10
-8@@ -89,7 +89,7 @@ struct pv_init_ops {*/ unsigned (*patch)(u8 type,u16 clobber,void *insnbuf,unsigned long addr,unsigned len); -}; +} __no_randomize_layout;struct pv_lazy_ops {@@ -97,12 +97,12 @@ struct pv_lazy_ops {void (*enter)(void );void (*leave)(void );void (*flush)(void ); -}; +} __no_randomize_layout;struct pv_time_ops {unsigned long long (*sched_clock)(void );unsigned long long (*steal_clock)(int cpu); -}; +} __no_randomize_layout;struct pv_cpu_ops {/* hooks for various privileged instructions */ @@ -178,7 +178,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); -}; +} __no_randomize_layout;struct pv_irq_ops {/* @@ -201,7 +201,7 @@ struct pv_irq_ops {#ifdef CONFIG_X86_64 void (*adjust_exception_frame)(void );#endif -}; +} __no_randomize_layout;struct pv_mmu_ops {unsigned long (*read_cr2)(void );@@ -296,7 +296,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); -}; +} __no_randomize_layout;struct arch_spinlock ;#ifdef CONFIG_SMP @@ -322,7 +322,9 @@ struct pv_lock_ops {/* This contains all the paravirt structures: we get a convenient * number for each function using the offset which we use to indicate -* what to patch. */ +* what to patch. +* shouldn't be randomized due to the "NEAT TRICK" in paravirt.c +*/ struct paravirt_patch_template {struct pv_init_ops pv_init_ops;struct pv_time_ops pv_time_ops;@@ -330,7 +332,7 @@ struct paravirt_patch_template {struct pv_irq_ops pv_irq_ops;struct pv_mmu_ops pv_mmu_ops;struct pv_lock_ops pv_lock_ops; -}; +} __no_randomize_layout;extern struct pv_info pv_info;extern struct pv_init_ops pv_init_ops;drivers/acpi/acpica/hwxfsleep.c +6
-5@@ -70,11 +70,12 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), - acpi_hw_extended_sleep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), - acpi_hw_extended_wake_prep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), acpi_hw_extended_wake} + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), + .extended_function = acpi_hw_extended_sleep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), + .extended_function = acpi_hw_extended_wake_prep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), + .extended_function = acpi_hw_extended_wake} };/* drivers/block/cciss.h +15
-15@@ -402,27 +402,27 @@ static bool SA5_performant_intr_pending(ctlr_info_t *h) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_fifo_full, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5B_access = { - SA5_submit_command, - SA5B_intr_mask, - SA5_fifo_full, - SA5B_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5B_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5B_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_fifo_full, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/gpu/drm/nouveau/nouveau_ttm.c +14
-14@@ -107,10 +107,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func nouveau_vram_manager = { - nouveau_vram_manager_init, - nouveau_vram_manager_fini, - nouveau_vram_manager_new, - nouveau_vram_manager_del, + .init = nouveau_vram_manager_init, + .takedown = nouveau_vram_manager_fini, + .get_node = nouveau_vram_manager_new, + .put_node = nouveau_vram_manager_del, }; static int@@ -183,11 +183,11 @@ nouveau_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nouveau_gart_manager = { - nouveau_gart_manager_init, - nouveau_gart_manager_fini, - nouveau_gart_manager_new, - nouveau_gart_manager_del, - nouveau_gart_manager_debug + .init = nouveau_gart_manager_init, + .takedown = nouveau_gart_manager_fini, + .get_node = nouveau_gart_manager_new, + .put_node = nouveau_gart_manager_del, + .debug = nouveau_gart_manager_debug };/*XXX*/ @@ -256,11 +256,11 @@ nv04_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nv04_gart_manager = { - nv04_gart_manager_init, - nv04_gart_manager_fini, - nv04_gart_manager_new, - nv04_gart_manager_del, - nv04_gart_manager_debug + .init = nv04_gart_manager_init, + .takedown = nv04_gart_manager_fini, + .get_node = nv04_gart_manager_new, + .put_node = nv04_gart_manager_del, + .debug = nv04_gart_manager_debug };int drivers/gpu/drm/ttm/ttm_bo_manager.c +5
-5@@ -148,10 +148,10 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func ttm_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug };EXPORT_SYMBOL (ttm_bo_manager_func);drivers/gpu/drm/virtio/virtgpu_ttm.c +5
-5@@ -198,11 +198,11 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }static const struct ttm_mem_type_manager_func virtio_gpu_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug }; static int virtio_gpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +5
-5@@ -164,9 +164,9 @@ static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func vmw_gmrid_manager_func = { - vmw_gmrid_man_init, - vmw_gmrid_man_takedown, - vmw_gmrid_man_get_node, - vmw_gmrid_man_put_node, - vmw_gmrid_man_debug + .init = vmw_gmrid_man_init, + .takedown = vmw_gmrid_man_takedown, + .get_node = vmw_gmrid_man_get_node, + .put_node = vmw_gmrid_man_put_node, + .debug = vmw_gmrid_man_debug };drivers/infiniband/hw/nes/nes_cm.c +11
-11@@ -135,17 +135,17 @@ static void record_ird_ord(struct nes_cm_node *, u16, u16);/* instance of function pointers for client API */ /* set address of this instance to cm_core->cm_ops at cm_core alloc */ static const struct nes_cm_ops nes_cm_api = { - mini_cm_accelerated, - mini_cm_listen, - mini_cm_del_listen, - mini_cm_connect, - mini_cm_close, - mini_cm_accept, - mini_cm_reject, - mini_cm_recv_pkt, - mini_cm_dealloc_core, - mini_cm_get, - mini_cm_set + .accelerated = mini_cm_accelerated, + .listen = mini_cm_listen, + .stop_listener = mini_cm_del_listen, + .connect = mini_cm_connect, + .close = mini_cm_close, + .accept = mini_cm_accept, + .reject = mini_cm_reject, + .recv_pkt = mini_cm_recv_pkt, + .destroy_cm_core = mini_cm_dealloc_core, + .get = mini_cm_get, + .set = mini_cm_set };static struct nes_cm_core *g_cm_core;drivers/isdn/gigaset/bas-gigaset.c +16
-16@@ -2565,22 +2565,22 @@ static int gigaset_post_reset(struct usb_interface *intf)static const struct gigaset_ops gigops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_isoc_send_skb, - gigaset_isoc_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_isoc_send_skb, + .handle_input = gigaset_isoc_input, };/* bas_gigaset_init drivers/isdn/gigaset/ser-gigaset.c +16
-16@@ -445,22 +445,22 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb,/* asyncdata.c */ - gigaset_m10x_input,/* asyncdata.c */ + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb,/* asyncdata.c */ + .handle_input = gigaset_m10x_input,/* asyncdata.c */ };drivers/isdn/gigaset/usb-gigaset.c +16
-16@@ -862,22 +862,22 @@ static int gigaset_pre_reset(struct usb_interface *intf) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb, - gigaset_m10x_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb, + .handle_input = gigaset_m10x_input, };/* drivers/isdn/i4l/isdn_concap.c +3
-3@@ -80,9 +80,9 @@ static int isdn_concap_dl_disconn_req(struct concap_proto *concap) }struct concap_device_ops isdn_concap_reliable_dl_dops = { - &isdn_concap_dl_data_req, - &isdn_concap_dl_connect_req, - &isdn_concap_dl_disconn_req + .data_req = &isdn_concap_dl_data_req, + .connect_req = &isdn_concap_dl_connect_req, + .disconn_req = &isdn_concap_dl_disconn_req };/* The following should better go into a dedicated source file such that drivers/isdn/i4l/isdn_x25iface.c +8
-8@@ -53,14 +53,14 @@ static int isdn_x25iface_disconn_ind(struct concap_proto *);static struct concap_proto_ops ix25_pops = { - &isdn_x25iface_proto_new, - &isdn_x25iface_proto_del, - &isdn_x25iface_proto_restart, - &isdn_x25iface_proto_close, - &isdn_x25iface_xmit, - &isdn_x25iface_receive, - &isdn_x25iface_connect_ind, - &isdn_x25iface_disconn_ind + .proto_new = &isdn_x25iface_proto_new, + .proto_del = &isdn_x25iface_proto_del, + .restart = &isdn_x25iface_proto_restart, + .close = &isdn_x25iface_proto_close, + .encap_and_xmit = &isdn_x25iface_xmit, + .data_ind = &isdn_x25iface_receive, + .connect_ind = &isdn_x25iface_connect_ind, + .disconn_ind = &isdn_x25iface_disconn_ind };/* error message helper function */ drivers/media/pci/solo6x10/solo6x10-g723.c +1
-1@@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)int solo_g723_init (struct solo_dev *solo_dev) { -static struct snd_device_ops ops = {NULL }; +static struct snd_device_ops ops = { };struct snd_card *card;struct snd_kcontrol_new kctl;char name[32 ];drivers/net/ethernet/brocade/bna/bna_enet.c +4
-4@@ -1676,10 +1676,10 @@ bna_cb_ioceth_reset(void *arg) }static struct bfa_ioc_cbfn bna_ioceth_cbfn = { - bna_cb_ioceth_enable, - bna_cb_ioceth_disable, - bna_cb_ioceth_hbfail, - bna_cb_ioceth_reset + .enable_cbfn = bna_cb_ioceth_enable, + .disable_cbfn = bna_cb_ioceth_disable, + .hbfail_cbfn = bna_cb_ioceth_hbfail, + .reset_cbfn = bna_cb_ioceth_reset };static void bna_attr_init (struct bna_ioceth *ioceth)drivers/net/wan/lmc/lmc_media.c +49
-48@@ -95,62 +95,63 @@ static inline void write_av9110_bit (lmc_softc_t *, int);static void write_av9110 (lmc_softc_t *,u32 ,u32 ,u32 ,u32 ,u32 );lmc_media_t lmc_ds3_media = { - lmc_ds3_init,/* special media init stuff */ - lmc_ds3_default,/* reset to default state */ - lmc_ds3_set_status,/* reset status to state provided */ - lmc_dummy_set_1,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_ds3_set_100ft,/* set cable length */ - lmc_ds3_set_scram,/* set scrambler */ - lmc_ds3_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_ds3_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ds3_watchdog + .init = lmc_ds3_init,/* special media init stuff */ + .defaults = lmc_ds3_default,/* reset to default state */ + .set_status = lmc_ds3_set_status,/* reset status to state provided */ + .set_clock_source = lmc_dummy_set_1,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_ds3_set_100ft,/* set cable length */ + .set_scrambler = lmc_ds3_set_scram,/* set scrambler */ + .get_link_status = lmc_ds3_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_ds3_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ds3_watchdog };lmc_media_t lmc_hssi_media = { - lmc_hssi_init,/* special media init stuff */ - lmc_hssi_default,/* reset to default state */ - lmc_hssi_set_status,/* reset status to state provided */ - lmc_hssi_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_hssi_get_link_status,/* get link status */ - lmc_hssi_set_link_status,/* set link status */ - lmc_hssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_hssi_watchdog + .init = lmc_hssi_init,/* special media init stuff */ + .defaults = lmc_hssi_default,/* reset to default state */ + .set_status = lmc_hssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_hssi_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_hssi_get_link_status,/* get link status */ + .set_link_status = lmc_hssi_set_link_status,/* set link status */ + .set_crc_length = lmc_hssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_hssi_watchdog }; -lmc_media_t lmc_ssi_media = { lmc_ssi_init,/* special media init stuff */ - lmc_ssi_default,/* reset to default state */ - lmc_ssi_set_status,/* reset status to state provided */ - lmc_ssi_set_clock,/* set clock source */ - lmc_ssi_set_speed,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_ssi_get_link_status,/* get link status */ - lmc_ssi_set_link_status,/* set link status */ - lmc_ssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ssi_watchdog +lmc_media_t lmc_ssi_media = { + .init = lmc_ssi_init,/* special media init stuff */ + .defaults = lmc_ssi_default,/* reset to default state */ + .set_status = lmc_ssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_ssi_set_clock,/* set clock source */ + .set_speed = lmc_ssi_set_speed,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_ssi_get_link_status,/* get link status */ + .set_link_status = lmc_ssi_set_link_status,/* set link status */ + .set_crc_length = lmc_ssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ssi_watchdog };lmc_media_t lmc_t1_media = { - lmc_t1_init,/* special media init stuff */ - lmc_t1_default,/* reset to default state */ - lmc_t1_set_status,/* reset status to state provided */ - lmc_t1_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_t1_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_t1_set_crc_length,/* set CRC length */ - lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ - lmc_t1_watchdog + .init = lmc_t1_init,/* special media init stuff */ + .defaults = lmc_t1_default,/* reset to default state */ + .set_status = lmc_t1_set_status,/* reset status to state provided */ + .set_clock_source = lmc_t1_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_t1_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_t1_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ + .watchdog = lmc_t1_watchdog }; static voiddrivers/scsi/bfa/bfa_fcs.c +15
-4@@ -39,10 +39,21 @@ struct bfa_fcs_mod_s {#define BFA_FCS_MODULE (_mod) { _mod ## _modinit, _mod ## _modexit }static struct bfa_fcs_mod_s fcs_modules[] = { - { bfa_fcs_port_attach,NULL ,NULL }, - { bfa_fcs_uf_attach,NULL ,NULL }, - { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit, - bfa_fcs_fabric_modexit }, + { + .attach = bfa_fcs_port_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_uf_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_fabric_attach, + .modinit = bfa_fcs_fabric_modinit, + .modexit = bfa_fcs_fabric_modexit + }, };/* drivers/scsi/bfa/bfa_fcs_lport.c +20
-9@@ -90,15 +90,26 @@ static struct {void (*offline) (struct bfa_fcs_lport_s *port); } __port_action[] = { { - bfa_fcs_lport_unknown_init, bfa_fcs_lport_unknown_online, - bfa_fcs_lport_unknown_offline}, { - bfa_fcs_lport_fab_init, bfa_fcs_lport_fab_online, - bfa_fcs_lport_fab_offline}, { - bfa_fcs_lport_n2n_init, bfa_fcs_lport_n2n_online, - bfa_fcs_lport_n2n_offline}, { - bfa_fcs_lport_loop_init, bfa_fcs_lport_loop_online, - bfa_fcs_lport_loop_offline}, - }; + .init = bfa_fcs_lport_unknown_init, + .online = bfa_fcs_lport_unknown_online, + .offline = bfa_fcs_lport_unknown_offline + }, + { + .init = bfa_fcs_lport_fab_init, + .online = bfa_fcs_lport_fab_online, + .offline = bfa_fcs_lport_fab_offline + }, + { + .init = bfa_fcs_lport_n2n_init, + .online = bfa_fcs_lport_n2n_online, + .offline = bfa_fcs_lport_n2n_offline + }, + { + .init = bfa_fcs_lport_loop_init, + .online = bfa_fcs_lport_loop_online, + .offline = bfa_fcs_lport_loop_offline + }, +}; /* * fcs_port_sm FCS logical port state machinedrivers/scsi/bfa/bfa_modules.h +6
-6@@ -79,12 +79,12 @@ enum { \ extern struct bfa_module_s hal_mod_ ## __mod; \ struct bfa_module_s hal_mod_ ## __mod = { \ - bfa_ ## __mod ## _meminfo, \ - bfa_ ## __mod ## _attach, \ - bfa_ ## __mod ## _detach, \ - bfa_ ## __mod ## _start, \ - bfa_ ## __mod ## _stop, \ - bfa_ ## __mod ## _iocdisable, \ + .meminfo = bfa_ ## __mod ## _meminfo, \ + .attach = bfa_ ## __mod ## _attach, \ + .detach = bfa_ ## __mod ## _detach, \ + .start = bfa_ ## __mod ## _start, \ + .stop = bfa_ ## __mod ## _stop, \ + .iocdisable = bfa_ ## __mod ## _iocdisable, \ }#define BFA_CACHELINE_SZ (256)drivers/scsi/hpsa.h +20
-20@@ -577,38 +577,38 @@ static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_ioaccel_mode1_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_ioaccel_mode1_intr_pending, - SA5_ioaccel_mode1_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_ioaccel_mode1_intr_pending, + .command_completed = SA5_ioaccel_mode1_completed, };static struct access_method SA5_ioaccel_mode2_access = { - SA5_submit_command_ioaccel2, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_ioaccel2, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access_no_read = { - SA5_submit_command_no_read, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_no_read, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +1
-1@@ -147,7 +147,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,int added = (mode ==LCK_NL );int overlaps =0 ;int splitted =0 ; -const struct ldlm_callback_suite null_cbs = {NULL }; +const struct ldlm_callback_suite null_cbs = { }; CDEBUG(D_DLMTRACE, "flags %#llx owner %llu pid %u mode %u start %llu end %llu\n",drivers/staging/lustre/lustre/libcfs/module.c +5
-5@@ -322,11 +322,11 @@ out: }struct cfs_psdev_ops libcfs_psdev_ops = { - libcfs_psdev_open, - libcfs_psdev_release, -NULL , -NULL , - libcfs_ioctl + .p_open = libcfs_psdev_open, + .p_close = libcfs_psdev_release, + .p_read =NULL , + .p_write =NULL , + .p_ioctl = libcfs_ioctl }; static int proc_call_handler(void *data, int write, loff_t *ppos,drivers/video/fbdev/matrox/matroxfb_DAC1064.c +8
-2@@ -1088,14 +1088,20 @@ static void MGAG100_restore(struct matrox_fb_info *minfo)#ifdef CONFIG_FB_MATROX_MYSTIQUE struct matrox_switch matrox_mystique = { - MGA1064_preinit, MGA1064_reset, MGA1064_init, MGA1064_restore, + .preinit = MGA1064_preinit, + .reset = MGA1064_reset, + .init = MGA1064_init, + .restore = MGA1064_restore, };EXPORT_SYMBOL (matrox_mystique);#endif #ifdef CONFIG_FB_MATROX_G struct matrox_switch matrox_G100 = { - MGAG100_preinit, MGAG100_reset, MGAG100_init, MGAG100_restore, + .preinit = MGAG100_preinit, + .reset = MGAG100_reset, + .init = MGAG100_init, + .restore = MGAG100_restore, };EXPORT_SYMBOL (matrox_G100);#endif drivers/video/fbdev/matrox/matroxfb_Ti3026.c +4
-1@@ -738,7 +738,10 @@ static int Ti3026_preinit(struct matrox_fb_info *minfo) }struct matrox_switch matrox_millennium = { - Ti3026_preinit, Ti3026_reset, Ti3026_init, Ti3026_restore + .preinit = Ti3026_preinit, + .reset = Ti3026_reset, + .init = Ti3026_init, + .restore = Ti3026_restore };EXPORT_SYMBOL (matrox_millennium);#endif fs/reiserfs/item_ops.c +12
-12@@ -724,18 +724,18 @@ static void errcatch_print_vi(struct virtual_item *vi) }static struct item_operations errcatch_ops = { - errcatch_bytes_number, - errcatch_decrement_key, - errcatch_is_left_mergeable, - errcatch_print_item, - errcatch_check_item, - - errcatch_create_vi, - errcatch_check_left, - errcatch_check_right, - errcatch_part_size, - errcatch_unit_num, - errcatch_print_vi + .bytes_number = errcatch_bytes_number, + .decrement_key = errcatch_decrement_key, + .is_left_mergeable = errcatch_is_left_mergeable, + .print_item = errcatch_print_item, + .check_item = errcatch_check_item, + + .create_vi = errcatch_create_vi, + .check_left = errcatch_check_left, + .check_right = errcatch_check_right, + .part_size = errcatch_part_size, + .unit_num = errcatch_unit_num, + .print_vi = errcatch_print_vi };#if ! (TYPE_STAT_DATA ==0 &&TYPE_INDIRECT ==1 &&TYPE_DIRECT ==2 &&TYPE_DIRENTRY ==3 )include/linux/rbtree_augmented.h +3
-1@@ -90,7 +90,9 @@ rbname ## _rotate(struct rb_node *rb_old, struct rb_node *rb_new) \ old->rbaugmented =rbcompute (old); \ } \ rbstatic const struct rb_augment_callbacks rbname = { \ - rbname ## _propagate, rbname ## _copy, rbname ## _rotate \ + .propagate = rbname ## _propagate, \ + .copy = rbname ## _copy, \ + .rotate = rbname ## _rotate \ };lib/rbtree.c +3
-1@@ -412,7 +412,9 @@ static inline void dummy_copy(struct rb_node *old, struct rb_node *new) {}static inline void dummy_rotate (struct rb_node *old,struct rb_node *new) {}static const struct rb_augment_callbacks dummy_callbacks = { - dummy_propagate, dummy_copy, dummy_rotate + .propagate = dummy_propagate, + .copy = dummy_copy, + .rotate = dummy_rotate };void rb_insert_color (struct rb_node *node,struct rb_root *root)mm/page_alloc.c +1
-1@@ -561,7 +561,7 @@ static inline void clear_page_guard(struct zone *zone, struct page *page,__mod_zone_freepage_state (zone, (1 << order), migratetype); }#else -struct page_ext_operations debug_guardpage_ops = {NULL , }; +struct page_ext_operations debug_guardpage_ops = { .need =NULL , .init =NULL };static inline void set_page_guard (struct zone *zone,struct page *page,unsigned int order,int migratetype) {} static inline void clear_page_guard(struct zone *zone, struct page *page,net/atm/lec.c +3
-3@@ -111,9 +111,9 @@ static inline void lec_arp_put(struct lec_arp_table *entry) }static struct lane2_ops lane2_ops = { - lane2_resolve,/* resolve, spec 3.1.3 */ - lane2_associate_req,/* associate_req, spec 3.1.4 */ -NULL /* associate indicator, spec 3.1.5 */ + .resolve = lane2_resolve, + .associate_req = lane2_associate_req, + .associate_indicator =NULL };static unsigned char bus_mac[ETH_ALEN ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };net/atm/mpoa_caches.c +20
-21@@ -535,30 +535,29 @@ static void eg_destroy_cache(struct mpoa_client *mpc)static const struct in_cache_ops ingress_ops = { - in_cache_add_entry,/* add_entry */ - in_cache_get,/* get */ - in_cache_get_with_mask,/* get_with_mask */ - in_cache_get_by_vcc,/* get_by_vcc */ - in_cache_put,/* put */ - in_cache_remove_entry,/* remove_entry */ - cache_hit,/* cache_hit */ - clear_count_and_expired,/* clear_count */ - check_resolving_entries,/* check_resolving */ - refresh_entries,/* refresh */ - in_destroy_cache/* destroy_cache */ + .add_entry = in_cache_add_entry, + .get = in_cache_get, + .get_with_mask = in_cache_get_with_mask, + .get_by_vcc = in_cache_get_by_vcc, + .put = in_cache_put, + .remove_entry = in_cache_remove_entry, + .cache_hit = cache_hit, + .clear_count = clear_count_and_expired, + .check_resolving = check_resolving_entries, + .refresh = refresh_entries, };static const struct eg_cache_ops egress_ops = { - eg_cache_add_entry,/* add_entry */ - eg_cache_get_by_cache_id,/* get_by_cache_id */ - eg_cache_get_by_tag,/* get_by_tag */ - eg_cache_get_by_vcc,/* get_by_vcc */ - eg_cache_get_by_src_ip,/* get_by_src_ip */ - eg_cache_put,/* put */ - eg_cache_remove_entry,/* remove_entry */ - update_eg_cache_entry,/* update */ - clear_expired,/* clear_expired */ - eg_destroy_cache/* destroy_cache */ + .add_entry = eg_cache_add_entry, + .get_by_cache_id = eg_cache_get_by_cache_id, + .get_by_tag = eg_cache_get_by_tag, + .get_by_vcc = eg_cache_get_by_vcc, + .get_by_src_ip = eg_cache_get_by_src_ip, + .put = eg_cache_put, + .remove_entry = eg_cache_remove_entry, + .update = update_eg_cache_entry, + .clear_expired = clear_expired, + .destroy_cache = eg_destroy_cache };net/vmw_vsock/vmci_transport_notify.c +15
-15@@ -662,19 +662,19 @@ static void vmci_transport_notify_pkt_process_negotiate(struct sock *sk)/* Socket control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };net/vmw_vsock/vmci_transport_notify_qstate.c +15
-15@@ -420,19 +420,19 @@ vmci_transport_notify_pkt_send_pre_enqueue(/* Socket always on control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };sound/synth/emux/emux_seq.c +7
-8@@ -33,13 +33,13 @@ static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *inf* MIDI emulation operators */ static struct snd_midi_op emux_ops = { - snd_emux_note_on, - snd_emux_note_off, - snd_emux_key_press, - snd_emux_terminate_note, - snd_emux_control, - snd_emux_nrpn, - snd_emux_sysex, + .note_on = snd_emux_note_on, + .note_off = snd_emux_note_off, + .key_press = snd_emux_key_press, + .note_terminate = snd_emux_terminate_note, + .control = snd_emux_control, + .nrpn = snd_emux_nrpn, + .sysex = snd_emux_sysex, }; --Quoted 2 lines
1.9.1
--
Kees Cook
Chrome OS & Brillo Security--
Kees Cook
Chrome OS & Brillo Security--
Kees Cook
Chrome OS & Brillo Security
Signature · 2 lines
Kees Cook Chrome OS & Brillo Security
[kernel-hardening] Re: [RFC 3/3] Change initialization C99 style; tag no_ramdomize_layout structs
In reply to Kees CookQuoted 25 lines · Kees Cook
Quoted 24 lines · Julia Lawall
Quoted 21 lines · Kees Cook
Quoted 9 lines · Michael Leibowitz
Due to randomization of structs, the in order struct intialization style is replaced with explicit field style.
struct
foo_tmy_foo= {
one,
two,
three
};Quoted 7 lines
becomes
struct foo_t my_foo = { .one = one, .two = two, .three = three };Can a coccinelle script be written to do this also? It might be useful to keep that around.
Quoted 8 lines
Quoted 2 lines
Is this needed for all kinds of structure initializations, ie for both local and global variables, or only for global variables?
It's needed for any structure that has been globally defined. As in, any use of a struct must be using C99 since that structure may be randomized (in any context: global, local).
Michael, what's the state of this series? What're your next steps?
I expect to have a new patch set addressing comments shortly.
Cheers
Quoted 1,206 lines
-Kees
Quoted 1,197 lines
thanks,
juliaQuoted 1,193 lines
Quoted 4 lines
Additionally, tag paravirt related structures to explicitly not be randomized, as the structure layout is important.
This might need to be split out? It's logically separate. Also, I think this needs to come before the plugin, since the plugin isn't usable until this patch is in place.
-Kees
Quoted 1,173 lines
This feature is ported over from grsecurity. This is largely unchanged from the Original code written by the PaX Team and Spender.
Signed-off-by Michael Leibowitz <[email protected]>--- arch/x86/include/asm/floppy.h | 20 ++--- arch/x86/include/asm/paravirt_types.h | 18 +++-- drivers/acpi/acpica/hwxfsleep.c | 11 +-- drivers/block/cciss.h | 30 ++++---- drivers/gpu/drm/nouveau/nouveau_ttm.c | 28 +++---- drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 +-- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 10 +-- drivers/infiniband/hw/nes/nes_cm.c | 22 +++--- drivers/isdn/gigaset/bas-gigaset.c | 32 ++++---- drivers/isdn/gigaset/ser-gigaset.c | 32 ++++---- drivers/isdn/gigaset/usb-gigaset.c | 32 ++++---- drivers/isdn/i4l/isdn_concap.c | 6 +- drivers/isdn/i4l/isdn_x25iface.c | 16 ++-- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- drivers/net/ethernet/brocade/bna/bna_enet.c | 8 +- drivers/net/wan/lmc/lmc_media.c | 97 +++++++++++++------------ drivers/scsi/bfa/bfa_fcs.c | 19 ++++- drivers/scsi/bfa/bfa_fcs_lport.c | 29 +++++--- drivers/scsi/bfa/bfa_modules.h | 12 +-- drivers/scsi/hpsa.h | 40 +++++----- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 10 +-- drivers/video/fbdev/matrox/matroxfb_DAC1064.c | 10 ++- drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 5 +- fs/reiserfs/item_ops.c | 24 +++--- include/linux/rbtree_augmented.h | 4 +- lib/rbtree.c | 4 +- mm/page_alloc.c | 2 +- net/atm/lec.c | 6 +- net/atm/mpoa_caches.c | 41 +++++------ net/vmw_vsock/vmci_transport_notify.c | 30 ++++---- net/vmw_vsock/vmci_transport_notify_qstate.c | 30 ++++---- sound/synth/emux/emux_seq.c | 14 ++-- 34 files changed, 352 insertions(+), 314 deletions(-)arch/x86/include/asm/floppy.h +10
-10@@ -229,18 +229,18 @@ static struct fd_routine_l {int (*_dma_setup)(char *addr,unsigned long size,int mode,int io); } fd_routine[] = { { - request_dma, - free_dma, - get_dma_residue, - dma_mem_alloc, - hard_dma_setup + ._request_dma = request_dma, + ._free_dma = free_dma, + ._get_dma_residue = get_dma_residue, + ._dma_mem_alloc = dma_mem_alloc, + ._dma_setup = hard_dma_setup }, { - vdma_request_dma, - vdma_nop, - vdma_get_dma_residue, - vdma_mem_alloc, - vdma_dma_setup + ._request_dma = vdma_request_dma, + ._free_dma = vdma_nop, + ._get_dma_residue = vdma_get_dma_residue, + ._dma_mem_alloc = vdma_mem_alloc, + ._dma_setup = vdma_dma_setup } };arch/x86/include/asm/paravirt_types.h +10
-8@@ -89,7 +89,7 @@ struct pv_init_ops {*/ unsigned (*patch)(u8 type,u16 clobber,void *insnbuf,unsigned long addr,unsigned len); -}; +} __no_randomize_layout;struct pv_lazy_ops {@@ -97,12 +97,12 @@ struct pv_lazy_ops {void (*enter)(void );void (*leave)(void );void (*flush)(void ); -}; +} __no_randomize_layout;struct pv_time_ops {unsigned long long (*sched_clock)(void );unsigned long long (*steal_clock)(int cpu); -}; +} __no_randomize_layout;struct pv_cpu_ops {/* hooks for various privileged instructions */ @@ -178,7 +178,7 @@ struct pv_cpu_ops {void (*start_context_switch)(struct task_struct *prev);void (*end_context_switch)(struct task_struct *next); -}; +} __no_randomize_layout;struct pv_irq_ops {/* @@ -201,7 +201,7 @@ struct pv_irq_ops {#ifdef CONFIG_X86_64 void (*adjust_exception_frame)(void );#endif -}; +} __no_randomize_layout;struct pv_mmu_ops {unsigned long (*read_cr2)(void );@@ -296,7 +296,7 @@ struct pv_mmu_ops {an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags); -}; +} __no_randomize_layout;struct arch_spinlock ;#ifdef CONFIG_SMP @@ -322,7 +322,9 @@ struct pv_lock_ops {/* This contains all the paravirt structures: we get a convenient * number for each function using the offset which we use to indicate -* what to patch. */ +* what to patch. +* shouldn't be randomized due to the "NEAT TRICK" in paravirt.c +*/ struct paravirt_patch_template {struct pv_init_ops pv_init_ops;struct pv_time_ops pv_time_ops;@@ -330,7 +332,7 @@ struct paravirt_patch_template {struct pv_irq_ops pv_irq_ops;struct pv_mmu_ops pv_mmu_ops;struct pv_lock_ops pv_lock_ops; -}; +} __no_randomize_layout;extern struct pv_info pv_info;extern struct pv_init_ops pv_init_ops;drivers/acpi/acpica/hwxfsleep.c +6
-5@@ -70,11 +70,12 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), - acpi_hw_extended_sleep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), - acpi_hw_extended_wake_prep}, - {ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), acpi_hw_extended_wake} + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_sleep), + .extended_function = acpi_hw_extended_sleep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake_prep), + .extended_function = acpi_hw_extended_wake_prep}, + {.legacy_function =ACPI_HW_OPTIONAL_FUNCTION (acpi_hw_legacy_wake), + .extended_function = acpi_hw_extended_wake} };/* drivers/block/cciss.h +15
-15@@ -402,27 +402,27 @@ static bool SA5_performant_intr_pending(ctlr_info_t *h) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_fifo_full, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5B_access = { - SA5_submit_command, - SA5B_intr_mask, - SA5_fifo_full, - SA5B_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5B_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5B_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_fifo_full, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .fifo_full = SA5_fifo_full, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/gpu/drm/nouveau/nouveau_ttm.c +14
-14@@ -107,10 +107,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func nouveau_vram_manager = { - nouveau_vram_manager_init, - nouveau_vram_manager_fini, - nouveau_vram_manager_new, - nouveau_vram_manager_del, + .init = nouveau_vram_manager_init, + .takedown = nouveau_vram_manager_fini, + .get_node = nouveau_vram_manager_new, + .put_node = nouveau_vram_manager_del, }; static int@@ -183,11 +183,11 @@ nouveau_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nouveau_gart_manager = { - nouveau_gart_manager_init, - nouveau_gart_manager_fini, - nouveau_gart_manager_new, - nouveau_gart_manager_del, - nouveau_gart_manager_debug + .init = nouveau_gart_manager_init, + .takedown = nouveau_gart_manager_fini, + .get_node = nouveau_gart_manager_new, + .put_node = nouveau_gart_manager_del, + .debug = nouveau_gart_manager_debug };/*XXX*/ @@ -256,11 +256,11 @@ nv04_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) }const struct ttm_mem_type_manager_func nv04_gart_manager = { - nv04_gart_manager_init, - nv04_gart_manager_fini, - nv04_gart_manager_new, - nv04_gart_manager_del, - nv04_gart_manager_debug + .init = nv04_gart_manager_init, + .takedown = nv04_gart_manager_fini, + .get_node = nv04_gart_manager_new, + .put_node = nv04_gart_manager_del, + .debug = nv04_gart_manager_debug };int drivers/gpu/drm/ttm/ttm_bo_manager.c +5
-5@@ -148,10 +148,10 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func ttm_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug };EXPORT_SYMBOL (ttm_bo_manager_func);drivers/gpu/drm/virtio/virtgpu_ttm.c +5
-5@@ -198,11 +198,11 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, }static const struct ttm_mem_type_manager_func virtio_gpu_bo_manager_func = { - ttm_bo_man_init, - ttm_bo_man_takedown, - ttm_bo_man_get_node, - ttm_bo_man_put_node, - ttm_bo_man_debug + .init = ttm_bo_man_init, + .takedown = ttm_bo_man_takedown, + .get_node = ttm_bo_man_get_node, + .put_node = ttm_bo_man_put_node, + .debug = ttm_bo_man_debug }; static int virtio_gpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +5
-5@@ -164,9 +164,9 @@ static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man, }const struct ttm_mem_type_manager_func vmw_gmrid_manager_func = { - vmw_gmrid_man_init, - vmw_gmrid_man_takedown, - vmw_gmrid_man_get_node, - vmw_gmrid_man_put_node, - vmw_gmrid_man_debug + .init = vmw_gmrid_man_init, + .takedown = vmw_gmrid_man_takedown, + .get_node = vmw_gmrid_man_get_node, + .put_node = vmw_gmrid_man_put_node, + .debug = vmw_gmrid_man_debug };drivers/infiniband/hw/nes/nes_cm.c +11
-11@@ -135,17 +135,17 @@ static void record_ird_ord(struct nes_cm_node *, u16, u16);/* instance of function pointers for client API */ /* set address of this instance to cm_core->cm_ops at cm_core alloc */ static const struct nes_cm_ops nes_cm_api = { - mini_cm_accelerated, - mini_cm_listen, - mini_cm_del_listen, - mini_cm_connect, - mini_cm_close, - mini_cm_accept, - mini_cm_reject, - mini_cm_recv_pkt, - mini_cm_dealloc_core, - mini_cm_get, - mini_cm_set + .accelerated = mini_cm_accelerated, + .listen = mini_cm_listen, + .stop_listener = mini_cm_del_listen, + .connect = mini_cm_connect, + .close = mini_cm_close, + .accept = mini_cm_accept, + .reject = mini_cm_reject, + .recv_pkt = mini_cm_recv_pkt, + .destroy_cm_core = mini_cm_dealloc_core, + .get = mini_cm_get, + .set = mini_cm_set };static struct nes_cm_core *g_cm_core;drivers/isdn/gigaset/bas-gigaset.c +16
-16@@ -2565,22 +2565,22 @@ static int gigaset_post_reset(struct usb_interface *intf)static const struct gigaset_ops gigops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_isoc_send_skb, - gigaset_isoc_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_isoc_send_skb, + .handle_input = gigaset_isoc_input, };/* bas_gigaset_init drivers/isdn/gigaset/ser-gigaset.c +16
-16@@ -445,22 +445,22 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb,/* asyncdata.c */ - gigaset_m10x_input,/* asyncdata.c */ + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb,/* asyncdata.c */ + .handle_input = gigaset_m10x_input,/* asyncdata.c */ };drivers/isdn/gigaset/usb-gigaset.c +16
-16@@ -862,22 +862,22 @@ static int gigaset_pre_reset(struct usb_interface *intf) }static const struct gigaset_ops ops = { - gigaset_write_cmd, - gigaset_write_room, - gigaset_chars_in_buffer, - gigaset_brkchars, - gigaset_init_bchannel, - gigaset_close_bchannel, - gigaset_initbcshw, - gigaset_freebcshw, - gigaset_reinitbcshw, - gigaset_initcshw, - gigaset_freecshw, - gigaset_set_modem_ctrl, - gigaset_baud_rate, - gigaset_set_line_ctrl, - gigaset_m10x_send_skb, - gigaset_m10x_input, + .write_cmd = gigaset_write_cmd, + .write_room = gigaset_write_room, + .chars_in_buffer = gigaset_chars_in_buffer, + .brkchars = gigaset_brkchars, + .init_bchannel = gigaset_init_bchannel, + .close_bchannel = gigaset_close_bchannel, + .initbcshw = gigaset_initbcshw, + .freebcshw = gigaset_freebcshw, + .reinitbcshw = gigaset_reinitbcshw, + .initcshw = gigaset_initcshw, + .freecshw = gigaset_freecshw, + .set_modem_ctrl = gigaset_set_modem_ctrl, + .baud_rate = gigaset_baud_rate, + .set_line_ctrl = gigaset_set_line_ctrl, + .send_skb = gigaset_m10x_send_skb, + .handle_input = gigaset_m10x_input, };/* drivers/isdn/i4l/isdn_concap.c +3
-3@@ -80,9 +80,9 @@ static int isdn_concap_dl_disconn_req(struct concap_proto *concap) }struct concap_device_ops isdn_concap_reliable_dl_dops = { - &isdn_concap_dl_data_req, - &isdn_concap_dl_connect_req, - &isdn_concap_dl_disconn_req + .data_req = &isdn_concap_dl_data_req, + .connect_req = &isdn_concap_dl_connect_req, + .disconn_req = &isdn_concap_dl_disconn_req };/* The following should better go into a dedicated source file such that drivers/isdn/i4l/isdn_x25iface.c +8
-8@@ -53,14 +53,14 @@ static int isdn_x25iface_disconn_ind(struct concap_proto *);static struct concap_proto_ops ix25_pops = { - &isdn_x25iface_proto_new, - &isdn_x25iface_proto_del, - &isdn_x25iface_proto_restart, - &isdn_x25iface_proto_close, - &isdn_x25iface_xmit, - &isdn_x25iface_receive, - &isdn_x25iface_connect_ind, - &isdn_x25iface_disconn_ind + .proto_new = &isdn_x25iface_proto_new, + .proto_del = &isdn_x25iface_proto_del, + .restart = &isdn_x25iface_proto_restart, + .close = &isdn_x25iface_proto_close, + .encap_and_xmit = &isdn_x25iface_xmit, + .data_ind = &isdn_x25iface_receive, + .connect_ind = &isdn_x25iface_connect_ind, + .disconn_ind = &isdn_x25iface_disconn_ind };/* error message helper function */ drivers/media/pci/solo6x10/solo6x10-g723.c +1
-1@@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)int solo_g723_init (struct solo_dev *solo_dev) { -static struct snd_device_ops ops = {NULL }; +static struct snd_device_ops ops = { };struct snd_card *card;struct snd_kcontrol_new kctl;char name[32 ];drivers/net/ethernet/brocade/bna/bna_enet.c +4
-4@@ -1676,10 +1676,10 @@ bna_cb_ioceth_reset(void *arg) }static struct bfa_ioc_cbfn bna_ioceth_cbfn = { - bna_cb_ioceth_enable, - bna_cb_ioceth_disable, - bna_cb_ioceth_hbfail, - bna_cb_ioceth_reset + .enable_cbfn = bna_cb_ioceth_enable, + .disable_cbfn = bna_cb_ioceth_disable, + .hbfail_cbfn = bna_cb_ioceth_hbfail, + .reset_cbfn = bna_cb_ioceth_reset };static void bna_attr_init (struct bna_ioceth *ioceth)drivers/net/wan/lmc/lmc_media.c +49
-48@@ -95,62 +95,63 @@ static inline void write_av9110_bit (lmc_softc_t *, int);static void write_av9110 (lmc_softc_t *,u32 ,u32 ,u32 ,u32 ,u32 );lmc_media_t lmc_ds3_media = { - lmc_ds3_init,/* special media init stuff */ - lmc_ds3_default,/* reset to default state */ - lmc_ds3_set_status,/* reset status to state provided */ - lmc_dummy_set_1,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_ds3_set_100ft,/* set cable length */ - lmc_ds3_set_scram,/* set scrambler */ - lmc_ds3_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_ds3_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ds3_watchdog + .init = lmc_ds3_init,/* special media init stuff */ + .defaults = lmc_ds3_default,/* reset to default state */ + .set_status = lmc_ds3_set_status,/* reset status to state provided */ + .set_clock_source = lmc_dummy_set_1,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_ds3_set_100ft,/* set cable length */ + .set_scrambler = lmc_ds3_set_scram,/* set scrambler */ + .get_link_status = lmc_ds3_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_ds3_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ds3_watchdog };lmc_media_t lmc_hssi_media = { - lmc_hssi_init,/* special media init stuff */ - lmc_hssi_default,/* reset to default state */ - lmc_hssi_set_status,/* reset status to state provided */ - lmc_hssi_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_hssi_get_link_status,/* get link status */ - lmc_hssi_set_link_status,/* set link status */ - lmc_hssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_hssi_watchdog + .init = lmc_hssi_init,/* special media init stuff */ + .defaults = lmc_hssi_default,/* reset to default state */ + .set_status = lmc_hssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_hssi_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_hssi_get_link_status,/* get link status */ + .set_link_status = lmc_hssi_set_link_status,/* set link status */ + .set_crc_length = lmc_hssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_hssi_watchdog }; -lmc_media_t lmc_ssi_media = { lmc_ssi_init,/* special media init stuff */ - lmc_ssi_default,/* reset to default state */ - lmc_ssi_set_status,/* reset status to state provided */ - lmc_ssi_set_clock,/* set clock source */ - lmc_ssi_set_speed,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_ssi_get_link_status,/* get link status */ - lmc_ssi_set_link_status,/* set link status */ - lmc_ssi_set_crc_length,/* set CRC length */ - lmc_dummy_set_1,/* set T1 or E1 circuit type */ - lmc_ssi_watchdog +lmc_media_t lmc_ssi_media = { + .init = lmc_ssi_init,/* special media init stuff */ + .defaults = lmc_ssi_default,/* reset to default state */ + .set_status = lmc_ssi_set_status,/* reset status to state provided */ + .set_clock_source = lmc_ssi_set_clock,/* set clock source */ + .set_speed = lmc_ssi_set_speed,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_ssi_get_link_status,/* get link status */ + .set_link_status = lmc_ssi_set_link_status,/* set link status */ + .set_crc_length = lmc_ssi_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_dummy_set_1,/* set T1 or E1 circuit type */ + .watchdog = lmc_ssi_watchdog };lmc_media_t lmc_t1_media = { - lmc_t1_init,/* special media init stuff */ - lmc_t1_default,/* reset to default state */ - lmc_t1_set_status,/* reset status to state provided */ - lmc_t1_set_clock,/* set clock source */ - lmc_dummy_set2_1,/* set line speed */ - lmc_dummy_set_1,/* set cable length */ - lmc_dummy_set_1,/* set scrambler */ - lmc_t1_get_link_status,/* get link status */ - lmc_dummy_set_1,/* set link status */ - lmc_t1_set_crc_length,/* set CRC length */ - lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ - lmc_t1_watchdog + .init = lmc_t1_init,/* special media init stuff */ + .defaults = lmc_t1_default,/* reset to default state */ + .set_status = lmc_t1_set_status,/* reset status to state provided */ + .set_clock_source = lmc_t1_set_clock,/* set clock source */ + .set_speed = lmc_dummy_set2_1,/* set line speed */ + .set_cable_length = lmc_dummy_set_1,/* set cable length */ + .set_scrambler = lmc_dummy_set_1,/* set scrambler */ + .get_link_status = lmc_t1_get_link_status,/* get link status */ + .set_link_status = lmc_dummy_set_1,/* set link status */ + .set_crc_length = lmc_t1_set_crc_length,/* set CRC length */ + .set_circuit_type = lmc_t1_set_circuit_type,/* set T1 or E1 circuit type */ + .watchdog = lmc_t1_watchdog }; static voiddrivers/scsi/bfa/bfa_fcs.c +15
-4@@ -39,10 +39,21 @@ struct bfa_fcs_mod_s {#define BFA_FCS_MODULE (_mod) { _mod ## _modinit, _mod ## _modexit }static struct bfa_fcs_mod_s fcs_modules[] = { - { bfa_fcs_port_attach,NULL ,NULL }, - { bfa_fcs_uf_attach,NULL ,NULL }, - { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit, - bfa_fcs_fabric_modexit }, + { + .attach = bfa_fcs_port_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_uf_attach, + .modinit =NULL , + .modexit =NULL + }, + { + .attach = bfa_fcs_fabric_attach, + .modinit = bfa_fcs_fabric_modinit, + .modexit = bfa_fcs_fabric_modexit + }, };/* drivers/scsi/bfa/bfa_fcs_lport.c +20
-9@@ -90,15 +90,26 @@ static struct {void (*offline) (struct bfa_fcs_lport_s *port); } __port_action[] = { { - bfa_fcs_lport_unknown_init, bfa_fcs_lport_unknown_online, - bfa_fcs_lport_unknown_offline}, { - bfa_fcs_lport_fab_init, bfa_fcs_lport_fab_online, - bfa_fcs_lport_fab_offline}, { - bfa_fcs_lport_n2n_init, bfa_fcs_lport_n2n_online, - bfa_fcs_lport_n2n_offline}, { - bfa_fcs_lport_loop_init, bfa_fcs_lport_loop_online, - bfa_fcs_lport_loop_offline}, - }; + .init = bfa_fcs_lport_unknown_init, + .online = bfa_fcs_lport_unknown_online, + .offline = bfa_fcs_lport_unknown_offline + }, + { + .init = bfa_fcs_lport_fab_init, + .online = bfa_fcs_lport_fab_online, + .offline = bfa_fcs_lport_fab_offline + }, + { + .init = bfa_fcs_lport_n2n_init, + .online = bfa_fcs_lport_n2n_online, + .offline = bfa_fcs_lport_n2n_offline + }, + { + .init = bfa_fcs_lport_loop_init, + .online = bfa_fcs_lport_loop_online, + .offline = bfa_fcs_lport_loop_offline + }, +}; /* * fcs_port_sm FCS logical port state machinedrivers/scsi/bfa/bfa_modules.h +6
-6@@ -79,12 +79,12 @@ enum { \ extern struct bfa_module_s hal_mod_ ## __mod; \ struct bfa_module_s hal_mod_ ## __mod = { \ - bfa_ ## __mod ## _meminfo, \ - bfa_ ## __mod ## _attach, \ - bfa_ ## __mod ## _detach, \ - bfa_ ## __mod ## _start, \ - bfa_ ## __mod ## _stop, \ - bfa_ ## __mod ## _iocdisable, \ + .meminfo = bfa_ ## __mod ## _meminfo, \ + .attach = bfa_ ## __mod ## _attach, \ + .detach = bfa_ ## __mod ## _detach, \ + .start = bfa_ ## __mod ## _start, \ + .stop = bfa_ ## __mod ## _stop, \ + .iocdisable = bfa_ ## __mod ## _iocdisable, \ }#define BFA_CACHELINE_SZ (256)drivers/scsi/hpsa.h +20
-20@@ -577,38 +577,38 @@ static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q) }static struct access_method SA5_access = { - SA5_submit_command, - SA5_intr_mask, - SA5_intr_pending, - SA5_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_intr_mask, + .intr_pending = SA5_intr_pending, + .command_completed = SA5_completed, };static struct access_method SA5_ioaccel_mode1_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_ioaccel_mode1_intr_pending, - SA5_ioaccel_mode1_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_ioaccel_mode1_intr_pending, + .command_completed = SA5_ioaccel_mode1_completed, };static struct access_method SA5_ioaccel_mode2_access = { - SA5_submit_command_ioaccel2, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_ioaccel2, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access = { - SA5_submit_command, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };static struct access_method SA5_performant_access_no_read = { - SA5_submit_command_no_read, - SA5_performant_intr_mask, - SA5_performant_intr_pending, - SA5_performant_completed, + .submit_command = SA5_submit_command_no_read, + .set_intr_mask = SA5_performant_intr_mask, + .intr_pending = SA5_performant_intr_pending, + .command_completed = SA5_performant_completed, };struct board_type {drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +1
-1@@ -147,7 +147,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,int added = (mode ==LCK_NL );int overlaps =0 ;int splitted =0 ; -const struct ldlm_callback_suite null_cbs = {NULL }; +const struct ldlm_callback_suite null_cbs = { }; CDEBUG(D_DLMTRACE, "flags %#llx owner %llu pid %u mode %u start %llu end %llu\n",drivers/staging/lustre/lustre/libcfs/module.c +5
-5@@ -322,11 +322,11 @@ out: }struct cfs_psdev_ops libcfs_psdev_ops = { - libcfs_psdev_open, - libcfs_psdev_release, -NULL , -NULL , - libcfs_ioctl + .p_open = libcfs_psdev_open, + .p_close = libcfs_psdev_release, + .p_read =NULL , + .p_write =NULL , + .p_ioctl = libcfs_ioctl }; static int proc_call_handler(void *data, int write, loff_t *ppos,drivers/video/fbdev/matrox/matroxfb_DAC1064.c +8
-2@@ -1088,14 +1088,20 @@ static void MGAG100_restore(struct matrox_fb_info *minfo)#ifdef CONFIG_FB_MATROX_MYSTIQUE struct matrox_switch matrox_mystique = { - MGA1064_preinit, MGA1064_reset, MGA1064_init, MGA1064_restore, + .preinit = MGA1064_preinit, + .reset = MGA1064_reset, + .init = MGA1064_init, + .restore = MGA1064_restore, };EXPORT_SYMBOL (matrox_mystique);#endif #ifdef CONFIG_FB_MATROX_G struct matrox_switch matrox_G100 = { - MGAG100_preinit, MGAG100_reset, MGAG100_init, MGAG100_restore, + .preinit = MGAG100_preinit, + .reset = MGAG100_reset, + .init = MGAG100_init, + .restore = MGAG100_restore, };EXPORT_SYMBOL (matrox_G100);#endif drivers/video/fbdev/matrox/matroxfb_Ti3026.c +4
-1@@ -738,7 +738,10 @@ static int Ti3026_preinit(struct matrox_fb_info *minfo) }struct matrox_switch matrox_millennium = { - Ti3026_preinit, Ti3026_reset, Ti3026_init, Ti3026_restore + .preinit = Ti3026_preinit, + .reset = Ti3026_reset, + .init = Ti3026_init, + .restore = Ti3026_restore };EXPORT_SYMBOL (matrox_millennium);#endif fs/reiserfs/item_ops.c +12
-12@@ -724,18 +724,18 @@ static void errcatch_print_vi(struct virtual_item *vi) }static struct item_operations errcatch_ops = { - errcatch_bytes_number, - errcatch_decrement_key, - errcatch_is_left_mergeable, - errcatch_print_item, - errcatch_check_item, - - errcatch_create_vi, - errcatch_check_left, - errcatch_check_right, - errcatch_part_size, - errcatch_unit_num, - errcatch_print_vi + .bytes_number = errcatch_bytes_number, + .decrement_key = errcatch_decrement_key, + .is_left_mergeable = errcatch_is_left_mergeable, + .print_item = errcatch_print_item, + .check_item = errcatch_check_item, + + .create_vi = errcatch_create_vi, + .check_left = errcatch_check_left, + .check_right = errcatch_check_right, + .part_size = errcatch_part_size, + .unit_num = errcatch_unit_num, + .print_vi = errcatch_print_vi };#if ! (TYPE_STAT_DATA ==0 &&TYPE_INDIRECT ==1 &&TYPE_DIRECT ==2 &&TYPE_DIRENTRY ==3 )include/linux/rbtree_augmented.h +3
-1@@ -90,7 +90,9 @@ rbname ## _rotate(struct rb_node *rb_old, struct rb_node *rb_new) \ old->rbaugmented =rbcompute (old); \ } \ rbstatic const struct rb_augment_callbacks rbname = { \ - rbname ## _propagate, rbname ## _copy, rbname ## _rotate \ + .propagate = rbname ## _propagate, \ + .copy = rbname ## _copy, \ + .rotate = rbname ## _rotate \ };lib/rbtree.c +3
-1@@ -412,7 +412,9 @@ static inline void dummy_copy(struct rb_node *old, struct rb_node *new) {}static inline void dummy_rotate (struct rb_node *old,struct rb_node *new) {}static const struct rb_augment_callbacks dummy_callbacks = { - dummy_propagate, dummy_copy, dummy_rotate + .propagate = dummy_propagate, + .copy = dummy_copy, + .rotate = dummy_rotate };void rb_insert_color (struct rb_node *node,struct rb_root *root)mm/page_alloc.c +1
-1@@ -561,7 +561,7 @@ static inline void clear_page_guard(struct zone *zone, struct page *page,__mod_zone_freepage_state (zone, (1 << order), migratetype); }#else -struct page_ext_operations debug_guardpage_ops = {NULL , }; +struct page_ext_operations debug_guardpage_ops = { .need =NULL , .init =NULL };static inline void set_page_guard (struct zone *zone,struct page *page,unsigned int order,int migratetype) {} static inline void clear_page_guard(struct zone *zone, struct page *page,net/atm/lec.c +3
-3@@ -111,9 +111,9 @@ static inline void lec_arp_put(struct lec_arp_table *entry) }static struct lane2_ops lane2_ops = { - lane2_resolve,/* resolve, spec 3.1.3 */ - lane2_associate_req,/* associate_req, spec 3.1.4 */ -NULL /* associate indicator, spec 3.1.5 */ + .resolve = lane2_resolve, + .associate_req = lane2_associate_req, + .associate_indicator =NULL };static unsigned char bus_mac[ETH_ALEN ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };net/atm/mpoa_caches.c +20
-21@@ -535,30 +535,29 @@ static void eg_destroy_cache(struct mpoa_client *mpc)static const struct in_cache_ops ingress_ops = { - in_cache_add_entry,/* add_entry */ - in_cache_get,/* get */ - in_cache_get_with_mask,/* get_with_mask */ - in_cache_get_by_vcc,/* get_by_vcc */ - in_cache_put,/* put */ - in_cache_remove_entry,/* remove_entry */ - cache_hit,/* cache_hit */ - clear_count_and_expired,/* clear_count */ - check_resolving_entries,/* check_resolving */ - refresh_entries,/* refresh */ - in_destroy_cache/* destroy_cache */ + .add_entry = in_cache_add_entry, + .get = in_cache_get, + .get_with_mask = in_cache_get_with_mask, + .get_by_vcc = in_cache_get_by_vcc, + .put = in_cache_put, + .remove_entry = in_cache_remove_entry, + .cache_hit = cache_hit, + .clear_count = clear_count_and_expired, + .check_resolving = check_resolving_entries, + .refresh = refresh_entries, };static const struct eg_cache_ops egress_ops = { - eg_cache_add_entry,/* add_entry */ - eg_cache_get_by_cache_id,/* get_by_cache_id */ - eg_cache_get_by_tag,/* get_by_tag */ - eg_cache_get_by_vcc,/* get_by_vcc */ - eg_cache_get_by_src_ip,/* get_by_src_ip */ - eg_cache_put,/* put */ - eg_cache_remove_entry,/* remove_entry */ - update_eg_cache_entry,/* update */ - clear_expired,/* clear_expired */ - eg_destroy_cache/* destroy_cache */ + .add_entry = eg_cache_add_entry, + .get_by_cache_id = eg_cache_get_by_cache_id, + .get_by_tag = eg_cache_get_by_tag, + .get_by_vcc = eg_cache_get_by_vcc, + .get_by_src_ip = eg_cache_get_by_src_ip, + .put = eg_cache_put, + .remove_entry = eg_cache_remove_entry, + .update = update_eg_cache_entry, + .clear_expired = clear_expired, + .destroy_cache = eg_destroy_cache };net/vmw_vsock/vmci_transport_notify.c +15
-15@@ -662,19 +662,19 @@ static void vmci_transport_notify_pkt_process_negotiate(struct sock *sk)/* Socket control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };net/vmw_vsock/vmci_transport_notify_qstate.c +15
-15@@ -420,19 +420,19 @@ vmci_transport_notify_pkt_send_pre_enqueue(/* Socket always on control packet based operations. */ const struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops = { - vmci_transport_notify_pkt_socket_init, - vmci_transport_notify_pkt_socket_destruct, - vmci_transport_notify_pkt_poll_in, - vmci_transport_notify_pkt_poll_out, - vmci_transport_notify_pkt_handle_pkt, - vmci_transport_notify_pkt_recv_init, - vmci_transport_notify_pkt_recv_pre_block, - vmci_transport_notify_pkt_recv_pre_dequeue, - vmci_transport_notify_pkt_recv_post_dequeue, - vmci_transport_notify_pkt_send_init, - vmci_transport_notify_pkt_send_pre_block, - vmci_transport_notify_pkt_send_pre_enqueue, - vmci_transport_notify_pkt_send_post_enqueue, - vmci_transport_notify_pkt_process_request, - vmci_transport_notify_pkt_process_negotiate, + .socket_init = vmci_transport_notify_pkt_socket_init, + .socket_destruct = vmci_transport_notify_pkt_socket_destruct, + .poll_in = vmci_transport_notify_pkt_poll_in, + .poll_out = vmci_transport_notify_pkt_poll_out, + .handle_notify_pkt = vmci_transport_notify_pkt_handle_pkt, + .recv_init = vmci_transport_notify_pkt_recv_init, + .recv_pre_block = vmci_transport_notify_pkt_recv_pre_block, + .recv_pre_dequeue = vmci_transport_notify_pkt_recv_pre_dequeue, + .recv_post_dequeue = vmci_transport_notify_pkt_recv_post_dequeue, + .send_init = vmci_transport_notify_pkt_send_init, + .send_pre_block = vmci_transport_notify_pkt_send_pre_block, + .send_pre_enqueue = vmci_transport_notify_pkt_send_pre_enqueue, + .send_post_enqueue = vmci_transport_notify_pkt_send_post_enqueue, + .process_request = vmci_transport_notify_pkt_process_request, + .process_negotiate = vmci_transport_notify_pkt_process_negotiate, };sound/synth/emux/emux_seq.c +7
-8@@ -33,13 +33,13 @@ static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *inf* MIDI emulation operators */ static struct snd_midi_op emux_ops = { - snd_emux_note_on, - snd_emux_note_off, - snd_emux_key_press, - snd_emux_terminate_note, - snd_emux_control, - snd_emux_nrpn, - snd_emux_sysex, + .note_on = snd_emux_note_on, + .note_off = snd_emux_note_off, + .key_press = snd_emux_key_press, + .note_terminate = snd_emux_terminate_note, + .control = snd_emux_control, + .nrpn = snd_emux_nrpn, + .sysex = snd_emux_sysex, }; --Quoted 2 lines
1.9.1
--
Kees Cook
Chrome OS & Brillo Security--
Kees Cook
Chrome OS & Brillo Security
Signature · 1 line
Michael Leibowitz
Quoted 4 lines · Michael Leibowitz
This patch set ports over grsecurity's structure randomization feature. The plugin is largely unchanged from grsecurity, with some porting to go over Emese Revfy's v7 patch set for gcc plugin infrastructure. This is an RFC.
Very cool, thanks for sending this out!
Quoted 6 lines
Although this set of changes does not directly make exploitation harder, when a number of structures are randomized, it will make it difficult to splat many relevant structures without knowing the exact build of the kernel the target is using. While for one structure, there are limited number of guesses required, in aggregate, this can be a large obstacle for exploitation.
Yeah, this is very powerful for people that build their own kernels (it's a blinding defense that requires many more leaks before most write attacks can happen). This is handy for distro kernels too, since it forces attackers to handle all the built versions of a released kernels.
To that end, if the kernel version changes, it seems like it would make sense to invalidate the rand seed. It doesn't look like that's happening, but I might be missing something in the modversioning.
Quoted 3 lines
Patch 3 is a grab bag that probably needs to be broken up, although I'm not sure of the best way to do so. Breaking by subsystem would seem to make an unwieldy patch set.
I'm hoping Julia will have some ideas about this. I think it makes sense to get this fixed on its own, regardless of this feature.
Quoted 2 lines
Known TODO that is not addressed as part of this patch set:
* tag security relevant structures for randomization
Does the plugin detect which structures it can randomize, or does it require this hinting?
Quoted 1 line
* add checkpatch checking for non-C99 initialization
Yeah, this would be very nice.
Quoted 1 line
* automated testing of randomization
What do you have in mind for this?
Quoted 2 lines
* better description and examples of exploits effectively mitigated by this feature
Basically everything that uses manual cred writing would be rendered more difficult by this.
I'd also be curious to see some benchmark examples to identify the true effect of enabling this and comparing it to the cacheline aware option, etc.
Quoted 2 lines
Tagging of structures to be randomized will come in subsequent series of patches.
Thanks!
-Kees
Quoted 49 lines
--
arch/Kconfig | 35 + arch/x86/include/asm/floppy.h | 20 +- arch/x86/include/asm/paravirt_types.h | 18 +- drivers/acpi/acpica/hwxfsleep.c | 11 +- drivers/block/cciss.h | 30 +- drivers/gpu/drm/nouveau/nouveau_ttm.c | 28 +- drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 +- drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 10 +- drivers/infiniband/hw/nes/nes_cm.c | 22 +- drivers/isdn/gigaset/bas-gigaset.c | 32 +- drivers/isdn/gigaset/ser-gigaset.c | 32 +- drivers/isdn/gigaset/usb-gigaset.c | 32 +- drivers/isdn/i4l/isdn_concap.c | 6 +- drivers/isdn/i4l/isdn_x25iface.c | 16 +- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- drivers/net/ethernet/brocade/bna/bna_enet.c | 8 +- drivers/net/wan/lmc/lmc_media.c | 97 +-- drivers/scsi/bfa/bfa_fcs.c | 19 +- drivers/scsi/bfa/bfa_fcs_lport.c | 29 +- drivers/scsi/bfa/bfa_modules.h | 12 +- drivers/scsi/hpsa.h | 40 +- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 10 +- drivers/video/fbdev/matrox/matroxfb_DAC1064.c | 10 +- drivers/video/fbdev/matrox/matroxfb_Ti3026.c | 5 +- fs/reiserfs/item_ops.c | 24 +- include/linux/compiler-gcc.h | 5 + include/linux/compiler.h | 9 + include/linux/rbtree_augmented.h | 4 +- include/linux/vermagic.h | 9 +- kernel/module.c | 27 + lib/rbtree.c | 4 +- mm/page_alloc.c | 2 +- net/atm/lec.c | 6 +- net/atm/mpoa_caches.c | 41 +- net/vmw_vsock/vmci_transport_notify.c | 30 +- net/vmw_vsock/vmci_transport_notify_qstate.c | 30 +- scripts/Makefile.gcc-plugins | 11 +- scripts/gcc-plugins/.gitignore | 1 + scripts/gcc-plugins/Makefile | 12 + scripts/gcc-plugins/gen-random-seed.sh | 8 + scripts/gcc-plugins/randomize_layout_plugin.c | 935 ++++++++++++++++++++++++ sound/synth/emux/emux_seq.c | 14 +- 44 files changed, 1402 insertions(+), 316 deletions(-)
Signature · 2 lines
Kees Cook Chrome OS & Brillo Security
Hi,
Quoted 23 lines · Michael Leibowitz
This patch set ports over grsecurity's structure randomization feature. The plugin is largely unchanged from grsecurity, with some porting to go over Emese Revfy's v7 patch set for gcc plugin infrastructure. This is an RFC.
Although this set of changes does not directly make exploitation harder, when a number of structures are randomized, it will make it difficult to splat many relevant structures without knowing the exact build of the kernel the target is using. While for one structure, there are limited number of guesses required, in aggregate, this can be a large obstacle for exploitation.
Patch 3 is a grab bag that probably needs to be broken up, although I'm not sure of the best way to do so. Breaking by subsystem would seem to make an unwieldy patch set.
Known TODO that is not addressed as part of this patch set:
* tag security relevant structures for randomization
* add checkpatch checking for non-C99 initialization
* automated testing of randomization
* better description and examples of exploits effectively mitigated by this feature
Quoted 2 lines
Tagging of structures to be randomized will come in subsequent series of patches.
may I ask what's the status of this patchset? As 4.8 now contains the plugin infrastructure, which I really like to see happening, we could add the remaining plugins. I'm specifically interested in the struct layout randomization.
In your initial RFC, the patch 3/3 touches a lot of subsystems, which means potentially dealing with many maintainers. As the patch is a prerequsite for unmodified randstrcut plugin, I think this would stall the inclusion for a long time.
The plugin detects "structs with function pointers only" and automatically adds the randomization. I suggest to start without this particular feature, and avoid dependency on patch 3/3.
Only the explicit randomize_layout attributes would actually do something. That way the patches could be submitted separately, with it's own reasoning. See the grsecruity patch for examples.
This is not perfect compared to the full featured plugin but I think the proposed way is better than waiting until all issues from patch 3/3 are fixed.
I'm willing to help and push things forward, but as you've submitted the patches I'm asking first.
Quoted 26 lines · David Sterba
Hi,
Quoted 23 lines · Michael Leibowitz
This patch set ports over grsecurity's structure randomization feature. The plugin is largely unchanged from grsecurity, with some porting to go over Emese Revfy's v7 patch set for gcc plugin infrastructure. This is an RFC.
Although this set of changes does not directly make exploitation harder, when a number of structures are randomized, it will make it difficult to splat many relevant structures without knowing the exact build of the kernel the target is using. While for one structure, there are limited number of guesses required, in aggregate, this can be a large obstacle for exploitation.
Patch 3 is a grab bag that probably needs to be broken up, although I'm not sure of the best way to do so. Breaking by subsystem would seem to make an unwieldy patch set.
Known TODO that is not addressed as part of this patch set:
* tag security relevant structures for randomization
* add checkpatch checking for non-C99 initialization
* automated testing of randomization
* better description and examples of exploits effectively mitigated by this feature
Quoted 7 lines
Quoted 2 lines
Tagging of structures to be randomized will come in subsequent series of patches.
may I ask what's the status of this patchset? As 4.8 now contains the plugin infrastructure, which I really like to see happening, we could add the remaining plugins. I'm specifically interested in the struct layout randomization.
I'm afraid to say that it got stalled as life moved on. I saw the 4.8 merge and I have renewed ambition.
Quoted 5 lines
In your initial RFC, the patch 3/3 touches a lot of subsystems, which means potentially dealing with many maintainers. As the patch is a prerequsite for unmodified randstrcut plugin, I think this would stall the inclusion for a long time.
Quoted 7 lines
The plugin detects "structs with function pointers only" and automatically adds the randomization. I suggest to start without this particular feature, and avoid dependency on patch 3/3.
Only the explicit
randomize_layoutattributes would actually do something. That way the patches could be submitted separately, with it's own reasoning. See the grsecruity patch for examples.
This is an excellent idea. I'm trying that out right now.
Quoted 6 lines
This is not perfect compared to the full featured plugin but I think the proposed way is better than waiting until all issues from patch 3/3 are fixed.
I'm willing to help and push things forward, but as you've submitted the patches I'm asking first.
Thanks for the push. I'll give it another try and see if I can a patch set out. If I get diverted, though, I'll give you a holler.
Cheers
Signature · 1 line
Michael Leibowitz
Quoted 47 lines · Michael
Quoted 26 lines · David Sterba
Hi,
Quoted 23 lines · Michael Leibowitz
This patch set ports over grsecurity's structure randomization feature. The plugin is largely unchanged from grsecurity, with some porting to go over Emese Revfy's v7 patch set for gcc plugin infrastructure. This is an RFC.
Although this set of changes does not directly make exploitation harder, when a number of structures are randomized, it will make it difficult to splat many relevant structures without knowing the exact build of the kernel the target is using. While for one structure, there are limited number of guesses required, in aggregate, this can be a large obstacle for exploitation.
Patch 3 is a grab bag that probably needs to be broken up, although I'm not sure of the best way to do so. Breaking by subsystem would seem to make an unwieldy patch set.
Known TODO that is not addressed as part of this patch set:
* tag security relevant structures for randomization
* add checkpatch checking for non-C99 initialization
* automated testing of randomization
* better description and examples of exploits effectively mitigated by this featureQuoted 7 lines
Quoted 2 lines
Tagging of structures to be randomized will come in subsequent series of patches.
may I ask what's the status of this patchset? As 4.8 now contains the plugin infrastructure, which I really like to see happening, we could add the remaining plugins. I'm specifically interested in the struct layout randomization.
I'm afraid to say that it got stalled as life moved on. I saw the 4.8 merge and I have renewed ambition.
Quoted 9 lines
In your initial RFC, the patch 3/3 touches a lot of subsystems, which means potentially dealing with many maintainers. As the patch is a prerequsite for unmodified randstrcut plugin, I think this would stall the inclusion for a long time.
The plugin detects "structs with function pointers only" and automatically adds the randomization. I suggest to start without this particular feature, and avoid dependency on patch 3/3.
Quoted 5 lines
Quoted 3 lines
Only the explicit
randomize_layoutattributes would actually do something. That way the patches could be submitted separately, with it's own reasoning. See the grsecruity patch for examples.This is an excellent idea. I'm trying that out right now.
Another approach would be to retain the feature, but make it a separate patch from the main plugin patch. In other words, have the series as:
- plugin itself (minus all-function-pointers)
- opt-in markings
- C99 changes
- out-out markings
- all-function-pointers plugin logic
Quoted 10 lines
Quoted 7 lines
This is not perfect compared to the full featured plugin but I think the proposed way is better than waiting until all issues from patch 3/3 are fixed.
I'm willing to help and push things forward, but as you've submitted the patches I'm asking first.
Thanks for the push. I'll give it another try and see if I can a patch set out. If I get diverted, though, I'll give you a holler.
Excellent. If you get stalled out, I nominate David to continue the push. :)
Thanks!
-Kees
Signature · 2 lines
Kees Cook Nexus Security