From patchwork Sat Feb 11 01:37:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jess Frazelle X-Patchwork-Id: 9567695 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 6AED860573 for ; Sat, 11 Feb 2017 01:38:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5978D285C1 for ; Sat, 11 Feb 2017 01:38:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C520285DA; Sat, 11 Feb 2017 01:38:33 +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 863B0285C1 for ; Sat, 11 Feb 2017 01:38:32 +0000 (UTC) Received: (qmail 23938 invoked by uid 550); 11 Feb 2017 01:38: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 23914 invoked from network); 11 Feb 2017 01:38:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jessfraz.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yRqp1yD/OLGXFTRdRkuohM/kD3jzZFS1W32cRyep4kQ=; b=ZlQuVN/xQpzCOvj+uMv9MWaqHIExjN0vovsJQXb8iXNUafitNyLHe5sUXJ4gqsZe4x AihXe/bF4BUDlVqQ2v54OdNny+Uj0UKxF90EATXX5sc5IUVQy3Cm/B05QPD2MrhhPOcP Xntkw6UrH3QRVtyyPCiM4yOd8BDcvZWfcdzyU= 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=yRqp1yD/OLGXFTRdRkuohM/kD3jzZFS1W32cRyep4kQ=; b=JsU6tgWeRqFe+9Gjz72EwQ3PHzPRKKEXsGXtsfXez8+yzvl74ALivGNnGK4jN/hrSN dT3DP6nO1gL93YXSDA3EP05M9cNpvNbdKpQ3+pz89j36ajM8YlTEyT6fnxyMlcYAorjo grXvV7Sdsh3LJHmRLyWNoeFlIX/4g1nyRrj3RUikWF+XUVl35yTLgHeSa9QQgPC5YxTd MbTJ9QFw0LZ2pIcl7UV88grKFF7XyqUx5P/Z8wT09Opg4GA56OwsFOUaOA8PZ2gXezOF 0OytyhrLU6lsnEWgNy1vD0BkmDq+dBZiZTKPmEYtcJzZWNhfT/fP/LbTzv0hwUUrCX/d XX8w== X-Gm-Message-State: AMke39mNZ8+3NFcThOS/rC3DdHZfXAqB88daTjIAM6H+0dPzepD9NrjRjX2WQ6WIEBnn2wIw X-Received: by 10.98.133.202 with SMTP id m71mr13899952pfk.102.1486777098640; Fri, 10 Feb 2017 17:38:18 -0800 (PST) From: Jess Frazelle To: John Stultz , Thomas Gleixner , Jess Frazelle , Rik van Riel , linux-kernel@vger.kernel.org (open list) Cc: kernel-hardening@lists.openwall.com Date: Fri, 10 Feb 2017 17:37:55 -0800 Message-Id: <20170211013758.3288-2-me@jessfraz.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170211013758.3288-1-me@jessfraz.com> References: <20170211013758.3288-1-me@jessfraz.com> Subject: [kernel-hardening] [PATCH v2 2/5] time: mark syscore_ops as __ro_after_init X-Virus-Scanned: ClamAV using ClamSMTP Marked syscore_ops structs as __ro_after_init when register_syscore_ops was called only during init. Most of the caller functions were already annotated as __init. unregister_syscore_ops() was never called on these ops. This protects the data structure from accidental corruption. Suggested-by: Kees Cook Signed-off-by: Jess Frazelle Acked-by: Rik van Riel --- kernel/time/sched_clock.c | 2 +- kernel/time/timekeeping.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index a26036d37a38..5df2fc07300b 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -289,7 +289,7 @@ static void sched_clock_resume(void) rd->read_sched_clock = cd.actual_read_sched_clock; } -static struct syscore_ops sched_clock_ops = { +static struct syscore_ops sched_clock_ops __ro_after_init = { .suspend = sched_clock_suspend, .resume = sched_clock_resume, }; diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index db087d7e106d..467e3021723a 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1756,7 +1756,7 @@ int timekeeping_suspend(void) } /* sysfs resume/suspend bits for timekeeping */ -static struct syscore_ops timekeeping_syscore_ops = { +static struct syscore_ops timekeeping_syscore_ops __ro_after_init = { .resume = timekeeping_resume, .suspend = timekeeping_suspend, };