Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1060402imm; Fri, 29 Jun 2018 10:40:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc909JzSqHMW7Avn2brs/WrEzWLRu1AEj2UxvwiMSPHhelyEF7R4414AJ9icvTe9A7n6rV0 X-Received: by 2002:a62:c20e:: with SMTP id l14-v6mr15538363pfg.185.1530294045415; Fri, 29 Jun 2018 10:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530294045; cv=none; d=google.com; s=arc-20160816; b=qPJO8E1uRwrwE/0z9uk3UmF9BIlAPiF/w1ykWmUidcV97MafglzHSfwJxkdW8tF03+ wrUocFPx7B62SN0PkTviR+t+eTJDLWqWAZm8CqcxXrC+ha811nWn/6owmtH/u2vpt8yo 3n5rcKhJ99f0y9ddRAqQlzqAh73PS2aMDMiF1RHGIzZQcLPO2nTAozIaiCAfwpUrOa2g IiqZ9fVkQBOK+02Qd2sYO9UPMfcAcg+eoAk9nY2IYEHczFVaZ3Fm4BU7ZxOLT73HNWqj E5AdTxyB7nps4fK29sDLQ9io6tmkTbGzVEnNjOUuXDGAOc+qvvKN0+VnHjulZZjMJM84 F1og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=x+rQuJtOeKk4F8fXQfrQXhU1ia+bd2AzIihaDp36Yvo=; b=rtVTxbpVtHVfBlvZfgJvxsCHlQUGMs1YWRa7b/2lxpzQc7mGqZstopBMSfwN0xFNDh MrgiwmBtXdD+CXMhMc0n1e1K/juGJNbBAzxURTkLuhxps9IPlo8MgNRAORx5gub6Qy1m 6+zWcDwwBAB3qTqm9UJDVac8XcxgBqOBm9QJ2cZKut3O5gdb2YI/UHcdYR4Pn7HcDboQ CHuEXNruwGV5FWISHCS0I9bxhWphlkjwUKGhR883JlABOHOpsTPoC/xQAkJSbmE6j2XT QBgjyqT+wrCyb1LFdkV6HndGp2lNugdkzYcU1fwC3Df+OCqpvDquUpmKOw2nG/GEpL1T ZBWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@horus.com header.s=20180324 header.b=bmWq31VJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=horus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l185-v6si10087051pfl.12.2018.06.29.10.40.31; Fri, 29 Jun 2018 10:40:45 -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; dkim=pass header.i=@horus.com header.s=20180324 header.b=bmWq31VJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=horus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933495AbeF2R3q (ORCPT + 99 others); Fri, 29 Jun 2018 13:29:46 -0400 Received: from mail.horus.com ([78.46.148.228]:59345 "EHLO mail.horus.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932548AbeF2R3o (ORCPT ); Fri, 29 Jun 2018 13:29:44 -0400 Received: from [192.168.1.20] (193-83-224-126.adsl.highway.telekom.at [193.83.224.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "E-Mail Matthias Reichl", Issuer "HiassofT CA 2014" (verified OK)) by mail.horus.com (Postfix) with ESMTPSA id 71D55640A0; Fri, 29 Jun 2018 19:29:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=horus.com; s=20180324; t=1530293382; bh=x+rQuJtOeKk4F8fXQfrQXhU1ia+bd2AzIihaDp36Yvo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bmWq31VJyQfiCnMGlXO/eijMtfo6YgPP+tgHWxDRlUVUn+7amxSpQkAr0+dQHW5dR JukXHpSxy/LHRgWRi+tLD8XpcanaKR25oVQ7JMwAOixp9zDvZl8X/o+WGlswUaWh7F Le/7BNeW6WH4IuSsZfbThQaAqG0DAjPd+2q9H/Fc= Received: by camel2.lan (Postfix, from userid 1000) id 4B2E81C78CA; Fri, 29 Jun 2018 19:29:41 +0200 (CEST) Date: Fri, 29 Jun 2018 19:29:40 +0200 From: Matthias Reichl To: Steven Rostedt 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: <20180629172940.i653fp6tjnimj4a5@camel2.lan> Mail-Followup-To: Matthias Reichl , Steven Rostedt , 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" References: <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> <20180629111658.02bfcc11@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180629111658.02bfcc11@gandalf.local.home> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 29, 2018 at 11:16:58AM -0400, Steven Rostedt wrote: > 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 Yes, sorry, forgot to include this info in my mail. Your patch no longer applies cleanly - a8e53c151fe7a added a debug_checkwx() to mark_rodata_ro() - but when applying it manually it still fixes the oops. so long, Hias > > -- 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. >