From patchwork Thu Apr 6 21:18:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9668453 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ECA7D602B3 for ; Thu, 6 Apr 2017 21:20:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33D63285A1 for ; Thu, 6 Apr 2017 21:20:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 288C5285E7; Thu, 6 Apr 2017 21:20:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 44161285A1 for ; Thu, 6 Apr 2017 21:20:16 +0000 (UTC) Received: (qmail 30460 invoked by uid 550); 6 Apr 2017 21:19:31 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 29730 invoked from network); 6 Apr 2017 21:19:19 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iHxtWo8vvUzx+N6+zv/17AiX/lvk1bHSOeWwInIeqeI=; b=FrA+afxCD5+rgFEGmAcK0yPKpTGd/YFWIy/jphAUq+6HAUbc1jF2fDd2DDi86A1B8i 63PxrLHlVThxyxSefi+wpcrS+nl6ZDIpU//B/s8u9lunvJQJ2hFaASfheBLib2xQ4fnZ +N3vGPdObnzJwvvGwvPKJzOGMdIqc8+AXBt6k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iHxtWo8vvUzx+N6+zv/17AiX/lvk1bHSOeWwInIeqeI=; b=qFZY000sWY3kJAPOkTcC673SQ7dsItIDpXQOlZViKlm21vbBwpA36B/BkMiH14k2/P D82jSavhW2OeAfzutmvSkd/RHJYMdJlZ9cOC1BuvO66ROtK+EZ7E8UDzww0o22Octmrt qLMIC7ayI/ALPiDlyKU5CcVa4L4KwuDi6HSwJJ3XOsyy0BruIqjyysSiA1cnW564uWVB KWKesBh9rGwFogxapg3j80FSJl3aHfwi3MJ1tGXcBV4dTBEUjbATZHke3WBBN/f8mYN6 mUz77w+kkA+9yab0FsWNw7SOd0o5/L9QKjjMN7+AMqYljvs3qE5BpLI914uX4xcsaZTW sm4w== X-Gm-Message-State: AFeK/H01tvrFvNVJ7jZ6Dd4QIEfRkieiuRiJ4kYxxd6wHk6t5rtU2qqOrD5rwLMmybghUIPQ X-Received: by 10.99.39.70 with SMTP id n67mr38546233pgn.132.1491513547545; Thu, 06 Apr 2017 14:19:07 -0700 (PDT) From: Kees Cook To: kernel-hardening@lists.openwall.com Cc: Kees Cook , Michael Leibowitz Date: Thu, 6 Apr 2017 14:18:25 -0700 Message-Id: <1491513513-84351-11-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491513513-84351-1-git-send-email-keescook@chromium.org> References: <1491513513-84351-1-git-send-email-keescook@chromium.org> Subject: [kernel-hardening] [PATCH 10/18] scsi/bfa: use designated initializers X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/scsi/bfa/bfa_fcs_lport.c | 29 ++++++++++++++++++++--------- drivers/scsi/bfa/bfa_modules.h | 12 ++++++------ 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index 4ddda72f60e6..64860c730ec9 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c @@ -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 diff --git a/drivers/scsi/bfa/bfa_modules.h b/drivers/scsi/bfa/bfa_modules.h index 53135f21fa0e..640621b4c3da 100644 --- a/drivers/scsi/bfa/bfa_modules.h +++ b/drivers/scsi/bfa/bfa_modules.h @@ -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)