Merge tag 'gcc-plugins-v4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Sep 2017 03:30:19 +0000 (20:30 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Sep 2017 03:30:19 +0000 (20:30 -0700)
Pull gcc plugins update from Kees Cook:
 "This finishes the porting work on randstruct, and introduces a new
  option to structleak, both noted below:

   - For the randstruct plugin, enable automatic randomization of
     structures that are entirely function pointers (along with a couple
     designated initializer fixes).

   - For the structleak plugin, provide an option to perform zeroing
     initialization of all otherwise uninitialized stack variables that
     are passed by reference (Ard Biesheuvel)"

* tag 'gcc-plugins-v4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  gcc-plugins: structleak: add option to init all vars used as byref args
  randstruct: Enable function pointer struct detection
  drivers/net/wan/z85230.c: Use designated initializers
  drm/amd/powerplay: rv: Use designated initializers

1  2 
arch/Kconfig
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c

diff --combined arch/Kconfig
@@@ -458,6 -458,13 +458,13 @@@ config GCC_PLUGIN_STRUCTLEA
           * https://grsecurity.net/
           * https://pax.grsecurity.net/
  
+ config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL
+       bool "Force initialize all struct type variables passed by reference"
+       depends on GCC_PLUGIN_STRUCTLEAK
+       help
+         Zero initialize any struct type local variable that may be passed by
+         reference without having been initialized.
  config GCC_PLUGIN_STRUCTLEAK_VERBOSE
        bool "Report forcefully initialized variables"
        depends on GCC_PLUGIN_STRUCTLEAK
@@@ -473,11 -480,13 +480,13 @@@ config GCC_PLUGIN_RANDSTRUC
        depends on GCC_PLUGINS
        select MODVERSIONS if MODULES
        help
-         If you say Y here, the layouts of structures explicitly
-         marked by __randomize_layout will be randomized at
-         compile-time.  This can introduce the requirement of an
-         additional information exposure vulnerability for exploits
-         targeting these structure types.
+         If you say Y here, the layouts of structures that are entirely
+         function pointers (and have not been manually annotated with
+         __no_randomize_layout), or structures that have been explicitly
+         marked with __randomize_layout, will be randomized at compile-time.
+         This can introduce the requirement of an additional information
+         exposure vulnerability for exploits targeting these structure
+         types.
  
          Enabling this feature will introduce some performance impact,
          slightly increase memory usage, and prevent the use of forensic
@@@ -931,18 -940,6 +940,18 @@@ config STRICT_MODULE_RW
  config ARCH_WANT_RELAX_ORDER
        bool
  
 +config ARCH_HAS_REFCOUNT
 +      bool
 +      help
 +        An architecture selects this when it has implemented refcount_t
 +        using open coded assembly primitives that provide an optimized
 +        refcount_t implementation, possibly at the expense of some full
 +        refcount state checks of CONFIG_REFCOUNT_FULL=y.
 +
 +        The refcount overflow check behavior, however, must be retained.
 +        Catching overflows is the primary security concern for protecting
 +        against bugs in reference counts.
 +
  config REFCOUNT_FULL
        bool "Perform full reference count validation at the expense of speed"
        help
@@@ -265,15 -265,6 +265,15 @@@ static int rv_tf_set_clock_limit(struc
                }
        } */
  
 +      if (((hwmgr->uvd_arbiter.vclk_soft_min / 100) != rv_data->vclk_soft_min) ||
 +          ((hwmgr->uvd_arbiter.dclk_soft_min / 100) != rv_data->dclk_soft_min)) {
 +              rv_data->vclk_soft_min = hwmgr->uvd_arbiter.vclk_soft_min / 100;
 +              rv_data->dclk_soft_min = hwmgr->uvd_arbiter.dclk_soft_min / 100;
 +              smum_send_msg_to_smc_with_parameter(hwmgr->smumgr,
 +                      PPSMC_MSG_SetSoftMinVcn,
 +                      (rv_data->vclk_soft_min << 16) | rv_data->vclk_soft_min);
 +      }
 +
        if((hwmgr->gfx_arbiter.sclk_hard_min != 0) &&
                ((hwmgr->gfx_arbiter.sclk_hard_min / 100) != rv_data->soc_actual_hard_min_freq)) {
                smum_send_msg_to_smc_with_parameter(hwmgr->smumgr,
@@@ -317,8 -308,8 +317,8 @@@ static int rv_tf_set_num_active_display
  }
  
  static const struct phm_master_table_item rv_set_power_state_list[] = {
-       { NULL, rv_tf_set_clock_limit },
-       { NULL, rv_tf_set_num_active_display },
+       { .tableFunction = rv_tf_set_clock_limit },
+       { .tableFunction = rv_tf_set_num_active_display },
        { }
  };
  
@@@ -391,7 -382,7 +391,7 @@@ static int rv_tf_disable_gfx_off(struc
  }
  
  static const struct phm_master_table_item rv_disable_dpm_list[] = {
-       {NULL, rv_tf_disable_gfx_off},
+       { .tableFunction = rv_tf_disable_gfx_off },
        { },
  };
  
@@@ -416,7 -407,7 +416,7 @@@ static int rv_tf_enable_gfx_off(struct 
  }
  
  static const struct phm_master_table_item rv_enable_dpm_list[] = {
-       {NULL, rv_tf_enable_gfx_off},
+       { .tableFunction = rv_tf_enable_gfx_off },
        { },
  };