Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1104585imm; Fri, 29 Jun 2018 11:26:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLeO/2WZBEJma9SNFUaMm6tvs4i0jWX2jBRngSl80qleDUlSEKUEWPdrpcTtqwtN48vB9WI X-Received: by 2002:a65:5106:: with SMTP id f6-v6mr13370525pgq.72.1530296787193; Fri, 29 Jun 2018 11:26:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530296787; cv=none; d=google.com; s=arc-20160816; b=hnxXcw676HMrkiRpi2jKW3UNDiEFsamnoLwuqRFbj9i3DXBXYompVK3t2VjiGwa0hY 71PqSWKeWP9zEjA6dWuFCcaahhZZKF9bMRznh+OyaUJvWnPRTMjnpc6/NQC664BtQKA1 DVYpPOc2RlqDtkQop4Tr4dwveSokk4THvWsParKUZlq7VaM8z4QIPTCBTFj4hcSgK+jo hoOzZnom/g1+cA8tdnpFo7Sl4/ZHzc0re/5WXrGEsnN2k3GRqS48xLwgvlzK16IcW0Yo X+7rC1EF7NsbEK4I6U6Iwb01FOhoIqYRoELgWJARHh6Uj/E2wgtP43ysV6PV6jCWfXjt i6qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=uPtsqgB16Suc7JhAg/Ncp/E0hjyRP0ecqd7idgAdBo8=; b=wiJNfpyrxt9e6i8nnttJ33ui0XIoreBPhJChhLEPAjGcCR33KAhoiZrV4zEdh1pTB0 yECoAOKvc/4BkxF6SYTVrKc6ditaT1now/PCgMbB+xB0Car/5Z9dYYqucefgj0Ac4nY6 6YNWN6xyc1IMlYUFDQTkyApD70lAkPkskEVmacr5XKzCVmoKg0odXJwMxaeOREJEz2QQ YR94PZHU1gz9A6L8bW9vgTjHTbR4Cz4VB9o6fn1HkYfTre/g5aR98kmRu7LqJC0eMKFf PJfZlb3P5Ri8ZUJosMg9lx1BKNsd8zuvMcMiqTs+Ry3ZLvAofT9NblIatHbB219D5+sw D73A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d35-v6si10354868pla.116.2018.06.29.11.26.12; Fri, 29 Jun 2018 11:26:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755226AbeF2PRD (ORCPT + 99 others); Fri, 29 Jun 2018 11:17:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:46912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750892AbeF2PRC (ORCPT ); Fri, 29 Jun 2018 11:17:02 -0400 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B494B27E1D; Fri, 29 Jun 2018 15:17:00 +0000 (UTC) Date: Fri, 29 Jun 2018 11:16:58 -0400 From: Steven Rostedt To: Matthias Reichl Cc: Kees Cook , Russell King - ARM Linux , Stefan Wahren , Eric Anholt , Phil Elwell , LKML , linux-rpi-kernel@lists.infradead.org, "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH] Arm: mm: ftrace: Only set text back to ro after kernel has been marked ro Message-ID: <20180629111658.02bfcc11@gandalf.local.home> In-Reply-To: <20180629144714.hkvwqzpikweyihmo@camel2.lan> References: <20170823150351.606ba09f@gandalf.local.home> <20171205114709.f6aj6i426keq2cn5@camel2.lan> <20171205131416.GW10595@n2100.armlinux.org.uk> <20171205132339.behn34z6b7ci2m4j@camel2.lan> <5b9b86cf-4b62-c984-fe52-a22df8fce33c@raspberrypi.org> <20171205133601.GX10595@n2100.armlinux.org.uk> <20171205200935.GY10595@n2100.armlinux.org.uk> <20180629144714.hkvwqzpikweyihmo@camel2.lan> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 29 Jun 2018 16:47:14 +0200 Matthias Reichl wrote: > On Tue, Dec 05, 2017 at 12:14:46PM -0800, Kees Cook wrote: > > On Tue, Dec 5, 2017 at 12:09 PM, Russell King - ARM Linux > > wrote: > > > On Tue, Dec 05, 2017 at 11:35:59AM -0800, Kees Cook wrote: > > >> We don't _need_ to, but they're all contiguous, so the ro_perms array > > >> used by set_kernel_text_*() is actually only a single entry: > > >> > > >> static struct section_perm ro_perms[] = { > > >> /* Make kernel code and rodata RX (set RO). */ > > >> { > > >> .name = "text/rodata RO", > > >> .start = (unsigned long)_stext, > > >> .end = (unsigned long)__init_begin, > > >> ... > > > > > > Well, they may not be contiguous - it depends on DEBUG_ALIGN_RODATA. > > > > Maybe I'm picking a slightly wrong word. I guess I meant adjacent. The > > range _stext to __init_begin is all read-only, though there may be > > padding (controlled by DEBUG_ALIGN_RODATA), to allow a split for NX > > markings on rodata. > > > > > Either way, we have __start_rodata_section_aligned, which is either > > > the start of the read-only data section, or the start of the first > > > section beyond __start_rodata if DEBUG_ALIGN_RODATA is not set. > > > > > > Given that __start_rodata_section_aligned will always be less than > > > __init_begin, is there any reason not to make the above end at > > > __start_rodata_section_aligned, thereby allowing more of the read-only > > > data (in the case of DEBUG_ALIGN_RODATA=n) or all of the read-only > > > data (in the case of DEBUG_ALIGN_RODATA=y) to remain write-protected? > > > > Sure, there's no reason not to split this into two entries. It'll > > require some reworking of the function calls to get it right, > > obviously. > > Gentle ping, arm is still oopsing when the function tracer is > enabled at boot time. > I take it that my patch never got applied: http://lkml.kernel.org/r/20180621124710.453ee0ae@gandalf.local.home -- Steve > Tested on bcm2835 (RPiB+) with current mainline tree > (githash 90368a37fbbe) and bcm2835_defconfig. > > arm64 seems to be fine, tested on bcm2837 (RPi3) with same tree and > arm64 defconfig plus function tracer enabled.