From patchwork Mon Dec 11 12:50:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinbum Park X-Patchwork-Id: 10104923 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 B88A5602B3 for ; Mon, 11 Dec 2017 12:51:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EFB229583 for ; Mon, 11 Dec 2017 12:51:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83F5D29584; Mon, 11 Dec 2017 12:51:05 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_MED 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 BDA3A29586 for ; Mon, 11 Dec 2017 12:51:04 +0000 (UTC) Received: (qmail 13768 invoked by uid 550); 11 Dec 2017 12:51:02 -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 13728 invoked from network); 11 Dec 2017 12:51:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=Clz2gtLaDffMUntEbU+sl6q6LniIZ1I3udhPnwLPB9M=; b=bq6Ri9mPWGgK31PyXEWYCWTAnKQiTZgYqoqLjoWAqGMitJlwga9x7NDRDjrlq3RriC 6pENb4nvBx8OL31vQQvTKu2RD7MjTvuHz50dbtdfmWClKYSIQPEdWRjFnZZ65P8gmTto dgGIJpUsIwz7nkgpF8Xe8Mtd7D2OwUjLCMQ0Ttj8w18aUenGW3yUOxZejWzNmqAI/yYc aadstTTNaWUn6/Uz/Gq56TL4SfO6pdxGwuWqOE6frS7zTi/fW3jFqKYFo2JrQ9tapov9 epPS/28ntnKlyGchLYBJ246ityW9OSvilF/UiWkUfhFfqMO9G35Firsg+aHpyZM8lVEK 5kZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=Clz2gtLaDffMUntEbU+sl6q6LniIZ1I3udhPnwLPB9M=; b=Id58bP3wBWIc8zgcJmdr6tIJ3er9CSpYvO7jyYw+i9B3zNMGlNhjVT8ZHxk0CAGEPE xiN+iHDhA/gEAsnc1wPo4tOiLrOjMyvBvN8JgZhbXeXThmDg1s+mu+PH3I2LMbBbU4RI keqRCTv1IpDFyVrIExwDIo6t2UzQlKt7TrfgIFzVz+3EyH+MIH66ktYWxhVA7Pmas1VT JtNpqsGoheznwy/tiPJIDtX5x9owA9LWIAgwjR5553SzJHLtCUMUhBdXWF2e9FXQ7f7F m/TCtlLg9o5ZfGQl11N/ocG0RxRaRD9r2aE3OZBDPh3QGzzPtKYlNgmWrs51bXTxqiCH Dvsw== X-Gm-Message-State: AKGB3mJaED/2MRG2V3+0WTlp6i8Ca/VumcJRB7uH+TDReoR+gZQAwe4z +VFOaRyOsrEX70CVH/ygma8= X-Google-Smtp-Source: ACJfBosOnj8dV8CFYWhfFpELnD1NIefE81MlEKS8s4r72h6qd5773oBxvHJPEPA5cNf5kaZOsjGLbw== X-Received: by 10.98.185.8 with SMTP id z8mr287943pfe.166.1512996649981; Mon, 11 Dec 2017 04:50:49 -0800 (PST) Date: Mon, 11 Dec 2017 21:50:43 +0900 From: Jinbum Park To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Cc: will.deacon@arm.com, mark.rutland@arm.com, linux@armlinux.org.uk, keescook@chromium.org Message-ID: <20171211125043.GA17299@pjb1027-Latitude-E5410> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Subject: [kernel-hardening][PATCH] arm: hw_breakpoint: Mark variables as __ro_after_init X-Virus-Scanned: ClamAV using ClamSMTP core_num_brps, core_num_wrps, debug_arch, has_ossr, max_watchpoint_len are setup once while init stage, and never changed after that. so it is good candidate for __ro_after_init. Signed-off-by: Jinbum Park Reviewed-by: Kees Cook --- arch/arm/kernel/hw_breakpoint.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c index af2a7f1..629e251 100644 --- a/arch/arm/kernel/hw_breakpoint.c +++ b/arch/arm/kernel/hw_breakpoint.c @@ -44,17 +44,17 @@ static DEFINE_PER_CPU(struct perf_event *, wp_on_reg[ARM_MAX_WRP]); /* Number of BRP/WRP registers on this CPU. */ -static int core_num_brps; -static int core_num_wrps; +static int core_num_brps __ro_after_init; +static int core_num_wrps __ro_after_init; /* Debug architecture version. */ -static u8 debug_arch; +static u8 debug_arch __ro_after_init; /* Does debug architecture support OS Save and Restore? */ -static bool has_ossr; +static bool has_ossr __ro_after_init; /* Maximum supported watchpoint length. */ -static u8 max_watchpoint_len; +static u8 max_watchpoint_len __ro_after_init; #define READ_WB_REG_CASE(OP2, M, VAL) \ case ((OP2 << 4) + M): \