From patchwork Fri Oct 23 16:49:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 55506 Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1356562lbq; Fri, 23 Oct 2015 09:50:53 -0700 (PDT) X-Received: by 10.66.61.205 with SMTP id s13mr21643662par.96.1445619053707; Fri, 23 Oct 2015 09:50:53 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id bl8si30718838pad.207.2015.10.23.09.50.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 09:50:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZpfX9-0001Q4-EM; Fri, 23 Oct 2015 16:49:39 +0000 Received: from mail-ig0-x236.google.com ([2607:f8b0:4001:c05::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZpfX6-0001Hj-4v for linux-arm-kernel@lists.infradead.org; Fri, 23 Oct 2015 16:49:37 +0000 Received: by igbkq10 with SMTP id kq10so38406006igb.0 for ; Fri, 23 Oct 2015 09:49:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=B7h9fNXhXmcs8GWOSrmTu6eTIKIIP+BcTAIkNIP2aKQ=; b=vgxXUw3sFcLDZm2fbqoon17pH7QVrGb2nTUwGQU5amptME/Ul3MqDceZKe9b8y+XFu VbfsAowiDKU2YtKH0xkf8Q6MzFkeK9gJIK0jKVmUhiUHpQL/JTBUD8zWr9lrqpSD4DJ8 OvTCFhRVsi5uX5l9U8/xXeYQNUDn2vHqj+EnNC0+LZ93cXap7PFNEA+lCheRw6QClLAI 27yVXkz7IzGK2GRNE8iFbIxqhwdgnDn7UZR5atH1vYZW+a1crTzsyek2ruuxXKg8Q5zc R7A6A1t7GnkJ3QRPo4kTpMCuoX0SMVf3yyGjihuvVAbHReqdzPH09/ELVEXa2T1Qp9JZ L5fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=B7h9fNXhXmcs8GWOSrmTu6eTIKIIP+BcTAIkNIP2aKQ=; b=PctE9QGbyWC112aOs11ZBQZzAxy/Dt3cxSUusauvtVlhx0PzulI8+N0z/lZYPnObfK kzGLDwuJL4eLIfAnfveYSwVEUMD1MLL88Vfke37vmybn3/HnCsx5zJFCBfjETme2SpV1 ozIZvUiFP1F6UYZ7DyK7wERgFEJUAaeQSCqm0ShV/SH1tczIrD0g5ouCEnyf9ozhdsBX vO1km4CdqXiGie9cJewqP9vt9FCysNoN0Tf+7zyeK+c7mbchBagptNzTC9CV3StHqJ51 2R1SobOcsplLoCPUsHIc28UIAhGmzvUlq/BYSK6tY+qfL35gdUhMoDEXJpOINkkxKdz8 hbXA== X-Gm-Message-State: ALoCoQlGKTDrBw7oTvFCPxbUfkyT5bK53WIr2jokleI1w6y3uVCwBSfMpUQyJ4aaHVkI1pyChH3b MIME-Version: 1.0 X-Received: by 10.50.20.67 with SMTP id l3mr5129364ige.75.1445618955157; Fri, 23 Oct 2015 09:49:15 -0700 (PDT) Received: by 10.36.214.215 with HTTP; Fri, 23 Oct 2015 09:49:15 -0700 (PDT) In-Reply-To: <562A610F.4090101@arm.com> References: <1445610134-20528-1-git-send-email-jeremy.linton@arm.com> <562A610F.4090101@arm.com> Date: Fri, 23 Oct 2015 18:49:15 +0200 Message-ID: Subject: Re: [PATCH] arm64: Align .text section to PAGE_SIZE From: Ard Biesheuvel To: Jeremy Linton , Laura Abbott X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151023_094936_371242_3DBBE789 X-CRM114-Status: GOOD ( 19.21 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:4001:c05:0:0:0:236 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Catalin Marinas , Will Deacon , "linux-arm-kernel@lists.infradead.org" , "Suzuki K. Poulose" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org (+ Laura) http://thread.gmane.org/gmane.linux.ports.arm.kernel/450513 On 23 October 2015 at 18:32, Jeremy Linton wrote: > On 10/23/2015 10:34 AM, Ard Biesheuvel wrote: >> >> It looks like fixup_executable() [with DEBUG_RODATA enabled] is the >> culprit here: it calls create mapping() with a size that gets rounded >> up to a multiple of PAGE_SIZE, which means the region that ends up >> getting its exec bits cleared is larger than it should. Perhaps it is >> better to fix that instead? > > > Ard, > Thanks for taking a look at this! > > Your probably right. > > But AFAIK, with just that fix text/ro sections can be partially > mapped without ro. Yes. > It seems to me that putting a little padding in so that > they are on separate pages is a good idea, especially since it seems the > remaining sections of interest are page aligned, either explicitly in the > linker script or via assembly directives in assorted places. > This should do the trick then, I think: ------8<---------- ------8<---------- > Maybe a clearer fix is an additional ifdef in the DEBUG_ALIGN_RODATA > stanza which sets ALIGN_DEBUG_RO to align to pagesize if DEBUG_RODATA is > set, that way it only takes affect for RODATA. > I think the diff does what you mean here. -- Ard. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index e9b8276ca079..db834a464986 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -104,7 +104,7 @@ SECTIONS _text = .; HEAD_TEXT } - ALIGN_DEBUG_RO + ALIGN_DEBUG_RO_MIN(PAGE_SIZE) .text : { /* Real text segment */ _stext = .; /* Text and read-only data */ __exception_text_start = .;