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: 10104927 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 5C1D3602B3 for ; Mon, 11 Dec 2017 12:51:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 305F929583 for ; Mon, 11 Dec 2017 12:51:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2512129585; Mon, 11 Dec 2017 12:51:25 +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.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B203C29583 for ; Mon, 11 Dec 2017 12:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=58ZF99Xgb+axFgz8pmc5GS4evuKfLEJgvUr0d+dunf0=; b=Yn7Zhhf4HLCZvM me4fcTgx+21pVGqW2JMExjoGVRZr7vfi5Bt5WrJZ2hh6H99thvFiZ/ntL1EVayk6Vs6c8wz66cDaA O4HkRIdRC8lOgLJSVi6x4c54Xjdu+WcBgo2PpRnExUn0IBpHI/0jeH6mqXKe/pOJwH8wQLDtJxAYc MHdgZZ9ik9Y2SNcI5N+l1nriohG8QxgrwH81bI9Qz175PU3k9THBRWQ7vbFkHDegEFJd///fcaRug b104qSiWBLzgOX0e7NUEMJNnrdfaO3qAGXcxKc9nsEQmQ2nyq8fmF9HYuH2F8le93xdNjwjTEwrWa SQz3glmoAN2fz1TDCSuQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eONYK-0007et-3o; Mon, 11 Dec 2017 12:51:24 +0000 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eONY7-0007MJ-Ph for linux-arm-kernel@lists.infradead.org; Mon, 11 Dec 2017 12:51:18 +0000 Received: by mail-pg0-x241.google.com with SMTP id k134so10862859pga.3 for ; Mon, 11 Dec 2017 04:50:50 -0800 (PST) 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=FikjuwLXsI1+kFEUMqzVK65sKec00T9z90Ovh8i+/tCho3fuR4thK5wcQV+AXRCgk4 IxwhyMvcK7o7OJ2xHdOypXlviIb5nX53MsB4zIZwTunFvQ+ZPP6rbUOfrtOeZMhn/Eop eTCalMJCu1HOcxaXRCAHAx/PB+z6s/dbxuqkSZ37qY3ar9ZQZO2bv6WgJD1PNIkYdms8 7cLueJUyp/tsLm1i/e2gd6FPeQKjLj3GSHK8nMKpeQesUEYdCVxMh6zpNJPwdkFAGliT nS5sBujvgyPz6OC/nkc4sIzgxAqCTykvdY8zzaZlOBwxSvqm5a9wlcuj7iNL5EOhdqOL 6XZQ== X-Gm-Message-State: AKGB3mKZPiUOJics8zZILP6zGcHLnIP5qdM0cz8YKLOf4aVpqUzbfLr9 OfCfiI5U1Av9wVU9r9QkRrKekg== 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) Received: from pjb1027-Latitude-E5410 ([58.227.15.43]) by smtp.gmail.com with ESMTPSA id p13sm24344256pgn.32.2017.12.11.04.50.47 (version=TLS1_2 cipher=AES128-SHA bits=128/128); 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 Subject: [kernel-hardening][PATCH] arm: hw_breakpoint: Mark variables as __ro_after_init Message-ID: <20171211125043.GA17299@pjb1027-Latitude-E5410> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171211_045112_438914_4FAA3CAB X-CRM114-Status: UNSURE ( 9.61 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, will.deacon@arm.com, linux@armlinux.org.uk, keescook@chromium.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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): \