All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/i40iw: use designated initializers
@ 2016-12-17  1:05 Kees Cook
       [not found] ` <9DD61F30A802C4429A01CA4200E302A7301B89C9@fmsmsx116.amr.corp.intel.com>
  2017-01-12 17:07 ` Doug Ledford
  0 siblings, 2 replies; 4+ messages in thread
From: Kees Cook @ 2016-12-17  1:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Faisal Latif, Shiraz Saleem, Doug Ledford, Sean Hefty,
	Hal Rosenstock, linux-rdma

Prepare to mark sensitive kernel structures for randomization by making
sure they're using designated initializers. These were identified during
allyesconfig builds of x86, arm, and arm64, with most initializer fixes
extracted from grsecurity.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 128 +++++++++++++++----------------
 drivers/infiniband/hw/i40iw/i40iw_uk.c   |  34 ++++----
 2 files changed, 80 insertions(+), 82 deletions(-)

diff --git a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
index 392f78384a60..797f745a9a5b 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
@@ -4836,46 +4836,46 @@ void i40iw_vsi_stats_free(struct i40iw_sc_vsi *vsi)
 }
 
 static struct i40iw_cqp_ops iw_cqp_ops = {
-	i40iw_sc_cqp_init,
-	i40iw_sc_cqp_create,
-	i40iw_sc_cqp_post_sq,
-	i40iw_sc_cqp_get_next_send_wqe,
-	i40iw_sc_cqp_destroy,
-	i40iw_sc_poll_for_cqp_op_done
+	.cqp_init = i40iw_sc_cqp_init,
+	.cqp_create = i40iw_sc_cqp_create,
+	.cqp_post_sq = i40iw_sc_cqp_post_sq,
+	.cqp_get_next_send_wqe = i40iw_sc_cqp_get_next_send_wqe,
+	.cqp_destroy = i40iw_sc_cqp_destroy,
+	.poll_for_cqp_op_done = i40iw_sc_poll_for_cqp_op_done
 };
 
 static struct i40iw_ccq_ops iw_ccq_ops = {
-	i40iw_sc_ccq_init,
-	i40iw_sc_ccq_create,
-	i40iw_sc_ccq_destroy,
-	i40iw_sc_ccq_create_done,
-	i40iw_sc_ccq_get_cqe_info,
-	i40iw_sc_ccq_arm
+	.ccq_init = i40iw_sc_ccq_init,
+	.ccq_create = i40iw_sc_ccq_create,
+	.ccq_destroy = i40iw_sc_ccq_destroy,
+	.ccq_create_done = i40iw_sc_ccq_create_done,
+	.ccq_get_cqe_info = i40iw_sc_ccq_get_cqe_info,
+	.ccq_arm = i40iw_sc_ccq_arm
 };
 
 static struct i40iw_ceq_ops iw_ceq_ops = {
-	i40iw_sc_ceq_init,
-	i40iw_sc_ceq_create,
-	i40iw_sc_cceq_create_done,
-	i40iw_sc_cceq_destroy_done,
-	i40iw_sc_cceq_create,
-	i40iw_sc_ceq_destroy,
-	i40iw_sc_process_ceq
+	.ceq_init = i40iw_sc_ceq_init,
+	.ceq_create = i40iw_sc_ceq_create,
+	.cceq_create_done = i40iw_sc_cceq_create_done,
+	.cceq_destroy_done = i40iw_sc_cceq_destroy_done,
+	.cceq_create = i40iw_sc_cceq_create,
+	.ceq_destroy = i40iw_sc_ceq_destroy,
+	.process_ceq = i40iw_sc_process_ceq
 };
 
 static struct i40iw_aeq_ops iw_aeq_ops = {
-	i40iw_sc_aeq_init,
-	i40iw_sc_aeq_create,
-	i40iw_sc_aeq_destroy,
-	i40iw_sc_get_next_aeqe,
-	i40iw_sc_repost_aeq_entries,
-	i40iw_sc_aeq_create_done,
-	i40iw_sc_aeq_destroy_done
+	.aeq_init = i40iw_sc_aeq_init,
+	.aeq_create = i40iw_sc_aeq_create,
+	.aeq_destroy = i40iw_sc_aeq_destroy,
+	.get_next_aeqe = i40iw_sc_get_next_aeqe,
+	.repost_aeq_entries = i40iw_sc_repost_aeq_entries,
+	.aeq_create_done = i40iw_sc_aeq_create_done,
+	.aeq_destroy_done = i40iw_sc_aeq_destroy_done
 };
 
 /* iwarp pd ops */
 static struct i40iw_pd_ops iw_pd_ops = {
-	i40iw_sc_pd_init,
+	.pd_init = i40iw_sc_pd_init,
 };
 
 static struct i40iw_priv_qp_ops iw_priv_qp_ops = {
@@ -4894,53 +4894,51 @@ static struct i40iw_priv_qp_ops iw_priv_qp_ops = {
 };
 
 static struct i40iw_priv_cq_ops iw_priv_cq_ops = {
-	i40iw_sc_cq_init,
-	i40iw_sc_cq_create,
-	i40iw_sc_cq_destroy,
-	i40iw_sc_cq_modify,
+	.cq_init = i40iw_sc_cq_init,
+	.cq_create = i40iw_sc_cq_create,
+	.cq_destroy = i40iw_sc_cq_destroy,
+	.cq_modify = i40iw_sc_cq_modify,
 };
 
 static struct i40iw_mr_ops iw_mr_ops = {
-	i40iw_sc_alloc_stag,
-	i40iw_sc_mr_reg_non_shared,
-	i40iw_sc_mr_reg_shared,
-	i40iw_sc_dealloc_stag,
-	i40iw_sc_query_stag,
-	i40iw_sc_mw_alloc
+	.alloc_stag = i40iw_sc_alloc_stag,
+	.mr_reg_non_shared = i40iw_sc_mr_reg_non_shared,
+	.mr_reg_shared = i40iw_sc_mr_reg_shared,
+	.dealloc_stag = i40iw_sc_dealloc_stag,
+	.query_stag = i40iw_sc_query_stag,
+	.mw_alloc = i40iw_sc_mw_alloc
 };
 
 static struct i40iw_cqp_misc_ops iw_cqp_misc_ops = {
-	i40iw_sc_manage_push_page,
-	i40iw_sc_manage_hmc_pm_func_table,
-	i40iw_sc_set_hmc_resource_profile,
-	i40iw_sc_commit_fpm_values,
-	i40iw_sc_query_fpm_values,
-	i40iw_sc_static_hmc_pages_allocated,
-	i40iw_sc_add_arp_cache_entry,
-	i40iw_sc_del_arp_cache_entry,
-	i40iw_sc_query_arp_cache_entry,
-	i40iw_sc_manage_apbvt_entry,
-	i40iw_sc_manage_qhash_table_entry,
-	i40iw_sc_alloc_local_mac_ipaddr_entry,
-	i40iw_sc_add_local_mac_ipaddr_entry,
-	i40iw_sc_del_local_mac_ipaddr_entry,
-	i40iw_sc_cqp_nop,
-	i40iw_sc_commit_fpm_values_done,
-	i40iw_sc_query_fpm_values_done,
-	i40iw_sc_manage_hmc_pm_func_table_done,
-	i40iw_sc_suspend_qp,
-	i40iw_sc_resume_qp
+	.manage_push_page = i40iw_sc_manage_push_page,
+	.manage_hmc_pm_func_table = i40iw_sc_manage_hmc_pm_func_table,
+	.set_hmc_resource_profile = i40iw_sc_set_hmc_resource_profile,
+	.commit_fpm_values = i40iw_sc_commit_fpm_values,
+	.query_fpm_values = i40iw_sc_query_fpm_values,
+	.static_hmc_pages_allocated = i40iw_sc_static_hmc_pages_allocated,
+	.add_arp_cache_entry = i40iw_sc_add_arp_cache_entry,
+	.del_arp_cache_entry = i40iw_sc_del_arp_cache_entry,
+	.query_arp_cache_entry = i40iw_sc_query_arp_cache_entry,
+	.manage_apbvt_entry = i40iw_sc_manage_apbvt_entry,
+	.manage_qhash_table_entry = i40iw_sc_manage_qhash_table_entry,
+	.alloc_local_mac_ipaddr_table_entry = i40iw_sc_alloc_local_mac_ipaddr_entry,
+	.add_local_mac_ipaddr_entry = i40iw_sc_add_local_mac_ipaddr_entry,
+	.del_local_mac_ipaddr_entry = i40iw_sc_del_local_mac_ipaddr_entry,
+	.cqp_nop = i40iw_sc_cqp_nop,
+	.commit_fpm_values_done = i40iw_sc_commit_fpm_values_done,
+	.query_fpm_values_done = i40iw_sc_query_fpm_values_done,
+	.manage_hmc_pm_func_table_done = i40iw_sc_manage_hmc_pm_func_table_done,
+	.update_suspend_qp = i40iw_sc_suspend_qp,
+	.update_resume_qp = i40iw_sc_resume_qp
 };
 
 static struct i40iw_hmc_ops iw_hmc_ops = {
-	i40iw_sc_init_iw_hmc,
-	i40iw_sc_parse_fpm_query_buf,
-	i40iw_sc_configure_iw_fpm,
-	i40iw_sc_parse_fpm_commit_buf,
-	i40iw_sc_create_hmc_obj,
-	i40iw_sc_del_hmc_obj,
-	NULL,
-	NULL
+	.init_iw_hmc = i40iw_sc_init_iw_hmc,
+	.parse_fpm_query_buf = i40iw_sc_parse_fpm_query_buf,
+	.configure_iw_fpm = i40iw_sc_configure_iw_fpm,
+	.parse_fpm_commit_buf = i40iw_sc_parse_fpm_commit_buf,
+	.create_hmc_object = i40iw_sc_create_hmc_obj,
+	.del_hmc_object = i40iw_sc_del_hmc_obj
 };
 
 /**
diff --git a/drivers/infiniband/hw/i40iw/i40iw_uk.c b/drivers/infiniband/hw/i40iw/i40iw_uk.c
index 4376cd628774..aa86627bb817 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_uk.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_uk.c
@@ -913,29 +913,29 @@ enum i40iw_status_code i40iw_get_wqe_shift(u32 wqdepth, u32 sge, u32 inline_data
 }
 
 static struct i40iw_qp_uk_ops iw_qp_uk_ops = {
-	i40iw_qp_post_wr,
-	i40iw_qp_ring_push_db,
-	i40iw_rdma_write,
-	i40iw_rdma_read,
-	i40iw_send,
-	i40iw_inline_rdma_write,
-	i40iw_inline_send,
-	i40iw_stag_local_invalidate,
-	i40iw_mw_bind,
-	i40iw_post_receive,
-	i40iw_nop
+	.iw_qp_post_wr = i40iw_qp_post_wr,
+	.iw_qp_ring_push_db = i40iw_qp_ring_push_db,
+	.iw_rdma_write = i40iw_rdma_write,
+	.iw_rdma_read = i40iw_rdma_read,
+	.iw_send = i40iw_send,
+	.iw_inline_rdma_write = i40iw_inline_rdma_write,
+	.iw_inline_send = i40iw_inline_send,
+	.iw_stag_local_invalidate = i40iw_stag_local_invalidate,
+	.iw_mw_bind = i40iw_mw_bind,
+	.iw_post_receive = i40iw_post_receive,
+	.iw_post_nop = i40iw_nop
 };
 
 static struct i40iw_cq_ops iw_cq_ops = {
-	i40iw_cq_request_notification,
-	i40iw_cq_poll_completion,
-	i40iw_cq_post_entries,
-	i40iw_clean_cq
+	.iw_cq_request_notification = i40iw_cq_request_notification,
+	.iw_cq_poll_completion = i40iw_cq_poll_completion,
+	.iw_cq_post_entries = i40iw_cq_post_entries,
+	.iw_cq_clean = i40iw_clean_cq
 };
 
 static struct i40iw_device_uk_ops iw_device_uk_ops = {
-	i40iw_cq_uk_init,
-	i40iw_qp_uk_init,
+	.iwarp_cq_uk_init = i40iw_cq_uk_init,
+	.iwarp_qp_uk_init = i40iw_qp_uk_init,
 };
 
 /**
-- 
2.7.4


-- 
Kees Cook
Nexus Security

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] RDMA/i40iw: use designated initializers
       [not found]   ` <9DD61F30A802C4429A01CA4200E302A7301B89C9-5FK+k9557ZBZtRGVdHMbwrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2016-12-20 20:04     ` Kees Cook
       [not found]       ` <CAGXu5j+Jj_yuNotEwLb-DjW3Pg--4EeZkthnd47PR-=KycxC_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2016-12-20 20:04 UTC (permalink / raw)
  To: Saleem, Shiraz
  Cc: Faisal Latif, Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Mon, Dec 19, 2016 at 12:40 PM, Saleem, Shiraz
<shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> I see how this patch improves readability but not sure why it throws a compiler error/warning?

This doesn't cause a compiler warning without the gcc plugin
"randstruct" (which is coming soon). Under randstruct, structure
layouts can be randomized, so "ordered" initializers (as they are
currently) cannot be used. Instead, "designated" initializers are
needed, which is what this patch adds. There is no actual difference
in the resulting output; it just allows for the randstruct plugin to
operate correctly.

-Kees

>
> Shiraz
>
>> Subject: RE: [PATCH] RDMA/i40iw: use designated initializers
>>
>> Hi Kees - Can you send the associated compiler warning?
>>
>> Shiraz
>>
>>
>> > Subject: [PATCH] RDMA/i40iw: use designated initializers
>> >
>> > Prepare to mark sensitive kernel structures for randomization by
>> > making sure they're using designated initializers. These were
>> > identified during allyesconfig builds of x86, arm, and arm64, with most initializer
>> fixes extracted from grsecurity.
>> >
>> > Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
>> > ---
>> >  drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 128 +++++++++++++++----------------
>> >  drivers/infiniband/hw/i40iw/i40iw_uk.c   |  34 ++++----
>> >  2 files changed, 80 insertions(+), 82 deletions(-)
>> >
>> > diff --git a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
>> > b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
>> > index 392f78384a60..797f745a9a5b 100644
>> > --- a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
>> > +++ b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
>> > @@ -4836,46 +4836,46 @@ void i40iw_vsi_stats_free(struct i40iw_sc_vsi
>> > *vsi)  }
>> >
>> >  static struct i40iw_cqp_ops iw_cqp_ops = {
>> > -   i40iw_sc_cqp_init,
>> > -   i40iw_sc_cqp_create,
>> > -   i40iw_sc_cqp_post_sq,
>> > -   i40iw_sc_cqp_get_next_send_wqe,
>> > -   i40iw_sc_cqp_destroy,
>> > -   i40iw_sc_poll_for_cqp_op_done
>> > +   .cqp_init = i40iw_sc_cqp_init,
>> > +   .cqp_create = i40iw_sc_cqp_create,
>> > +   .cqp_post_sq = i40iw_sc_cqp_post_sq,
>> > +   .cqp_get_next_send_wqe = i40iw_sc_cqp_get_next_send_wqe,
>> > +   .cqp_destroy = i40iw_sc_cqp_destroy,
>> > +   .poll_for_cqp_op_done = i40iw_sc_poll_for_cqp_op_done
>> >  };
>> >
>> >  static struct i40iw_ccq_ops iw_ccq_ops = {
>> > -   i40iw_sc_ccq_init,
>> > -   i40iw_sc_ccq_create,
>> > -   i40iw_sc_ccq_destroy,
>> > -   i40iw_sc_ccq_create_done,
>> > -   i40iw_sc_ccq_get_cqe_info,
>> > -   i40iw_sc_ccq_arm
>> > +   .ccq_init = i40iw_sc_ccq_init,
>> > +   .ccq_create = i40iw_sc_ccq_create,
>> > +   .ccq_destroy = i40iw_sc_ccq_destroy,
>> > +   .ccq_create_done = i40iw_sc_ccq_create_done,
>> > +   .ccq_get_cqe_info = i40iw_sc_ccq_get_cqe_info,
>> > +   .ccq_arm = i40iw_sc_ccq_arm
>> >  };
>> >
>> >  static struct i40iw_ceq_ops iw_ceq_ops = {
>> > -   i40iw_sc_ceq_init,
>> > -   i40iw_sc_ceq_create,
>> > -   i40iw_sc_cceq_create_done,
>> > -   i40iw_sc_cceq_destroy_done,
>> > -   i40iw_sc_cceq_create,
>> > -   i40iw_sc_ceq_destroy,
>> > -   i40iw_sc_process_ceq
>> > +   .ceq_init = i40iw_sc_ceq_init,
>> > +   .ceq_create = i40iw_sc_ceq_create,
>> > +   .cceq_create_done = i40iw_sc_cceq_create_done,
>> > +   .cceq_destroy_done = i40iw_sc_cceq_destroy_done,
>> > +   .cceq_create = i40iw_sc_cceq_create,
>> > +   .ceq_destroy = i40iw_sc_ceq_destroy,
>> > +   .process_ceq = i40iw_sc_process_ceq
>> >  };
>> >
>> >  static struct i40iw_aeq_ops iw_aeq_ops = {
>> > -   i40iw_sc_aeq_init,
>> > -   i40iw_sc_aeq_create,
>> > -   i40iw_sc_aeq_destroy,
>> > -   i40iw_sc_get_next_aeqe,
>> > -   i40iw_sc_repost_aeq_entries,
>> > -   i40iw_sc_aeq_create_done,
>> > -   i40iw_sc_aeq_destroy_done
>> > +   .aeq_init = i40iw_sc_aeq_init,
>> > +   .aeq_create = i40iw_sc_aeq_create,
>> > +   .aeq_destroy = i40iw_sc_aeq_destroy,
>> > +   .get_next_aeqe = i40iw_sc_get_next_aeqe,
>> > +   .repost_aeq_entries = i40iw_sc_repost_aeq_entries,
>> > +   .aeq_create_done = i40iw_sc_aeq_create_done,
>> > +   .aeq_destroy_done = i40iw_sc_aeq_destroy_done
>> >  };
>> >
>> >  /* iwarp pd ops */
>> >  static struct i40iw_pd_ops iw_pd_ops = {
>> > -   i40iw_sc_pd_init,
>> > +   .pd_init = i40iw_sc_pd_init,
>> >  };
>> >
>> >  static struct i40iw_priv_qp_ops iw_priv_qp_ops = { @@ -4894,53
>> > +4894,51 @@ static struct i40iw_priv_qp_ops iw_priv_qp_ops = {  };
>> >
>> >  static struct i40iw_priv_cq_ops iw_priv_cq_ops = {
>> > -   i40iw_sc_cq_init,
>> > -   i40iw_sc_cq_create,
>> > -   i40iw_sc_cq_destroy,
>> > -   i40iw_sc_cq_modify,
>> > +   .cq_init = i40iw_sc_cq_init,
>> > +   .cq_create = i40iw_sc_cq_create,
>> > +   .cq_destroy = i40iw_sc_cq_destroy,
>> > +   .cq_modify = i40iw_sc_cq_modify,
>> >  };
>> >
>> >  static struct i40iw_mr_ops iw_mr_ops = {
>> > -   i40iw_sc_alloc_stag,
>> > -   i40iw_sc_mr_reg_non_shared,
>> > -   i40iw_sc_mr_reg_shared,
>> > -   i40iw_sc_dealloc_stag,
>> > -   i40iw_sc_query_stag,
>> > -   i40iw_sc_mw_alloc
>> > +   .alloc_stag = i40iw_sc_alloc_stag,
>> > +   .mr_reg_non_shared = i40iw_sc_mr_reg_non_shared,
>> > +   .mr_reg_shared = i40iw_sc_mr_reg_shared,
>> > +   .dealloc_stag = i40iw_sc_dealloc_stag,
>> > +   .query_stag = i40iw_sc_query_stag,
>> > +   .mw_alloc = i40iw_sc_mw_alloc
>> >  };
>> >
>> >  static struct i40iw_cqp_misc_ops iw_cqp_misc_ops = {
>> > -   i40iw_sc_manage_push_page,
>> > -   i40iw_sc_manage_hmc_pm_func_table,
>> > -   i40iw_sc_set_hmc_resource_profile,
>> > -   i40iw_sc_commit_fpm_values,
>> > -   i40iw_sc_query_fpm_values,
>> > -   i40iw_sc_static_hmc_pages_allocated,
>> > -   i40iw_sc_add_arp_cache_entry,
>> > -   i40iw_sc_del_arp_cache_entry,
>> > -   i40iw_sc_query_arp_cache_entry,
>> > -   i40iw_sc_manage_apbvt_entry,
>> > -   i40iw_sc_manage_qhash_table_entry,
>> > -   i40iw_sc_alloc_local_mac_ipaddr_entry,
>> > -   i40iw_sc_add_local_mac_ipaddr_entry,
>> > -   i40iw_sc_del_local_mac_ipaddr_entry,
>> > -   i40iw_sc_cqp_nop,
>> > -   i40iw_sc_commit_fpm_values_done,
>> > -   i40iw_sc_query_fpm_values_done,
>> > -   i40iw_sc_manage_hmc_pm_func_table_done,
>> > -   i40iw_sc_suspend_qp,
>> > -   i40iw_sc_resume_qp
>> > +   .manage_push_page = i40iw_sc_manage_push_page,
>> > +   .manage_hmc_pm_func_table = i40iw_sc_manage_hmc_pm_func_table,
>> > +   .set_hmc_resource_profile = i40iw_sc_set_hmc_resource_profile,
>> > +   .commit_fpm_values = i40iw_sc_commit_fpm_values,
>> > +   .query_fpm_values = i40iw_sc_query_fpm_values,
>> > +   .static_hmc_pages_allocated = i40iw_sc_static_hmc_pages_allocated,
>> > +   .add_arp_cache_entry = i40iw_sc_add_arp_cache_entry,
>> > +   .del_arp_cache_entry = i40iw_sc_del_arp_cache_entry,
>> > +   .query_arp_cache_entry = i40iw_sc_query_arp_cache_entry,
>> > +   .manage_apbvt_entry = i40iw_sc_manage_apbvt_entry,
>> > +   .manage_qhash_table_entry = i40iw_sc_manage_qhash_table_entry,
>> > +   .alloc_local_mac_ipaddr_table_entry =
>> > i40iw_sc_alloc_local_mac_ipaddr_entry,
>> > +   .add_local_mac_ipaddr_entry = i40iw_sc_add_local_mac_ipaddr_entry,
>> > +   .del_local_mac_ipaddr_entry = i40iw_sc_del_local_mac_ipaddr_entry,
>> > +   .cqp_nop = i40iw_sc_cqp_nop,
>> > +   .commit_fpm_values_done = i40iw_sc_commit_fpm_values_done,
>> > +   .query_fpm_values_done = i40iw_sc_query_fpm_values_done,
>> > +   .manage_hmc_pm_func_table_done =
>> > i40iw_sc_manage_hmc_pm_func_table_done,
>> > +   .update_suspend_qp = i40iw_sc_suspend_qp,
>> > +   .update_resume_qp = i40iw_sc_resume_qp
>> >  };
>> >
>> >  static struct i40iw_hmc_ops iw_hmc_ops = {
>> > -   i40iw_sc_init_iw_hmc,
>> > -   i40iw_sc_parse_fpm_query_buf,
>> > -   i40iw_sc_configure_iw_fpm,
>> > -   i40iw_sc_parse_fpm_commit_buf,
>> > -   i40iw_sc_create_hmc_obj,
>> > -   i40iw_sc_del_hmc_obj,
>> > -   NULL,
>> > -   NULL
>> > +   .init_iw_hmc = i40iw_sc_init_iw_hmc,
>> > +   .parse_fpm_query_buf = i40iw_sc_parse_fpm_query_buf,
>> > +   .configure_iw_fpm = i40iw_sc_configure_iw_fpm,
>> > +   .parse_fpm_commit_buf = i40iw_sc_parse_fpm_commit_buf,
>> > +   .create_hmc_object = i40iw_sc_create_hmc_obj,
>> > +   .del_hmc_object = i40iw_sc_del_hmc_obj
>> >  };
>> >
>> >  /**
>> > diff --git a/drivers/infiniband/hw/i40iw/i40iw_uk.c
>> > b/drivers/infiniband/hw/i40iw/i40iw_uk.c
>> > index 4376cd628774..aa86627bb817 100644
>> > --- a/drivers/infiniband/hw/i40iw/i40iw_uk.c
>> > +++ b/drivers/infiniband/hw/i40iw/i40iw_uk.c
>> > @@ -913,29 +913,29 @@ enum i40iw_status_code i40iw_get_wqe_shift(u32
>> > wqdepth, u32 sge, u32 inline_data  }
>> >
>> >  static struct i40iw_qp_uk_ops iw_qp_uk_ops = {
>> > -   i40iw_qp_post_wr,
>> > -   i40iw_qp_ring_push_db,
>> > -   i40iw_rdma_write,
>> > -   i40iw_rdma_read,
>> > -   i40iw_send,
>> > -   i40iw_inline_rdma_write,
>> > -   i40iw_inline_send,
>> > -   i40iw_stag_local_invalidate,
>> > -   i40iw_mw_bind,
>> > -   i40iw_post_receive,
>> > -   i40iw_nop
>> > +   .iw_qp_post_wr = i40iw_qp_post_wr,
>> > +   .iw_qp_ring_push_db = i40iw_qp_ring_push_db,
>> > +   .iw_rdma_write = i40iw_rdma_write,
>> > +   .iw_rdma_read = i40iw_rdma_read,
>> > +   .iw_send = i40iw_send,
>> > +   .iw_inline_rdma_write = i40iw_inline_rdma_write,
>> > +   .iw_inline_send = i40iw_inline_send,
>> > +   .iw_stag_local_invalidate = i40iw_stag_local_invalidate,
>> > +   .iw_mw_bind = i40iw_mw_bind,
>> > +   .iw_post_receive = i40iw_post_receive,
>> > +   .iw_post_nop = i40iw_nop
>> >  };
>> >
>> >  static struct i40iw_cq_ops iw_cq_ops = {
>> > -   i40iw_cq_request_notification,
>> > -   i40iw_cq_poll_completion,
>> > -   i40iw_cq_post_entries,
>> > -   i40iw_clean_cq
>> > +   .iw_cq_request_notification = i40iw_cq_request_notification,
>> > +   .iw_cq_poll_completion = i40iw_cq_poll_completion,
>> > +   .iw_cq_post_entries = i40iw_cq_post_entries,
>> > +   .iw_cq_clean = i40iw_clean_cq
>> >  };
>> >
>> >  static struct i40iw_device_uk_ops iw_device_uk_ops = {
>> > -   i40iw_cq_uk_init,
>> > -   i40iw_qp_uk_init,
>> > +   .iwarp_cq_uk_init = i40iw_cq_uk_init,
>> > +   .iwarp_qp_uk_init = i40iw_qp_uk_init,
>> >  };
>> >
>> >  /**
>> > --
>> > 2.7.4
>> >
>> >
>> > --
>> > Kees Cook
>> > Nexus Security



-- 
Kees Cook
Nexus Security
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] RDMA/i40iw: use designated initializers
       [not found]       ` <CAGXu5j+Jj_yuNotEwLb-DjW3Pg--4EeZkthnd47PR-=KycxC_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-12-21 14:24         ` Shiraz Saleem
  0 siblings, 0 replies; 4+ messages in thread
From: Shiraz Saleem @ 2016-12-21 14:24 UTC (permalink / raw)
  To: Kees Cook
  Cc: Faisal Latif, Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Tue, Dec 20, 2016 at 12:04:52PM -0800, Kees Cook wrote:
> On Mon, Dec 19, 2016 at 12:40 PM, Saleem, Shiraz
> <shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> > I see how this patch improves readability but not sure why it throws a compiler error/warning?
> 
> This doesn't cause a compiler warning without the gcc plugin
> "randstruct" (which is coming soon). Under randstruct, structure
> layouts can be randomized, so "ordered" initializers (as they are
> currently) cannot be used. Instead, "designated" initializers are
> needed, which is what this patch adds. There is no actual difference
> in the resulting output; it just allows for the randstruct plugin to
> operate correctly.
> 
> -Kees
> 
> >
> > Shiraz
> >
> >> Subject: RE: [PATCH] RDMA/i40iw: use designated initializers
> >>
> >> Hi Kees - Can you send the associated compiler warning?
> >>
> >> Shiraz
> >>
> >>
> >> > Subject: [PATCH] RDMA/i40iw: use designated initializers
> >> >
> >> > Prepare to mark sensitive kernel structures for randomization by
> >> > making sure they're using designated initializers. These were
> >> > identified during allyesconfig builds of x86, arm, and arm64, with most initializer
> >> fixes extracted from grsecurity.
> >> >
> >> > Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Thank you for the patch.

Acked-by: Shiraz Saleem <shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] RDMA/i40iw: use designated initializers
  2016-12-17  1:05 [PATCH] RDMA/i40iw: use designated initializers Kees Cook
       [not found] ` <9DD61F30A802C4429A01CA4200E302A7301B89C9@fmsmsx116.amr.corp.intel.com>
@ 2017-01-12 17:07 ` Doug Ledford
  1 sibling, 0 replies; 4+ messages in thread
From: Doug Ledford @ 2017-01-12 17:07 UTC (permalink / raw)
  To: Kees Cook, linux-kernel
  Cc: Faisal Latif, Shiraz Saleem, Sean Hefty, Hal Rosenstock, linux-rdma

[-- Attachment #1: Type: text/plain, Size: 550 bytes --]

On Fri, 2016-12-16 at 17:05 -0800, Kees Cook wrote:
> Prepare to mark sensitive kernel structures for randomization by
> making
> sure they're using designated initializers. These were identified
> during
> allyesconfig builds of x86, arm, and arm64, with most initializer
> fixes
> extracted from grsecurity.
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>

Thanks, applied.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-12 17:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-17  1:05 [PATCH] RDMA/i40iw: use designated initializers Kees Cook
     [not found] ` <9DD61F30A802C4429A01CA4200E302A7301B89C9@fmsmsx116.amr.corp.intel.com>
     [not found]   ` <9DD61F30A802C4429A01CA4200E302A7301B89C9-5FK+k9557ZBZtRGVdHMbwrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-12-20 20:04     ` Kees Cook
     [not found]       ` <CAGXu5j+Jj_yuNotEwLb-DjW3Pg--4EeZkthnd47PR-=KycxC_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-12-21 14:24         ` Shiraz Saleem
2017-01-12 17:07 ` Doug Ledford

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.