From mboxrd@z Thu Jan 1 00:00:00 1970 From: Borislav Petkov Subject: Re: [PATCH 07/29] x86: Restore "text" Program Header with dummy section Date: Thu, 10 Oct 2019 12:33:05 +0200 Message-ID: <20191010103305.GD7658@zn.tnic> References: <20190926175602.33098-1-keescook@chromium.org> <20190926175602.33098-8-keescook@chromium.org> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1570703593; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=61VcXOO6OC0TSDKYRbLOk7EXig9eCgXyOc1Sw8qjbMo=; b=QrtsacxT1YtNlQnr0l29ht/E0oAvW+TPvKSyK2g0/hm1JIpJUv3weRvTAKtk5um+tIL7NZ sMKAq2cd3qZJrCB8QeMiLz+W0PHOQeM7u7ISY1ucpnilVubyTseLgfkDcEzyeyNOoeMuUd DvcpBmRi6/Jkc81xIBQiQ4XT3IX11oI= Content-Disposition: inline In-Reply-To: <20190926175602.33098-8-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Kees Cook Cc: Thomas Gleixner , Rick Edgecombe , Ingo Molnar , "H. Peter Anvin" , Dave Hansen , Andy Lutomirski , Arnd Bergmann , linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org, linux-s390@vger.kernel.org, linux-c6x-dev@linux-c6x.org, Yoshinori Sato , Michal Simek , linux-parisc@vger.kernel.org, linux-xtensa@linux-xtensa.org, x86@kernel.org, linux-kernel@vger.kernel.org On Thu, Sep 26, 2019 at 10:55:40AM -0700, Kees Cook wrote: > Instead of depending on markings in the section following NOTES to > restore the associated Program Header, use a dummy section, as done > in other architectures. This is very laconic and after some staring at ld.info, I think you mean this: " If you place a section in one or more segments using ':PHDR', then the linker will place all subsequent allocatable sections which do not specify ':PHDR' in the same segments." but I could be way off. Yes, no? IOW, please write in the commit messages first what the problem is you're addressing. > This is preparation for moving NOTES into the > RO_DATA macro. > > Signed-off-by: Kees Cook > --- > arch/x86/kernel/vmlinux.lds.S | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S > index e2feacf921a0..788e78978030 100644 > --- a/arch/x86/kernel/vmlinux.lds.S > +++ b/arch/x86/kernel/vmlinux.lds.S > @@ -147,8 +147,9 @@ SECTIONS > } :text = 0x9090 > > NOTES :text :note > + .dummy : { *(.dummy) } :text > > - EXCEPTION_TABLE(16) :text = 0x9090 > + EXCEPTION_TABLE(16) This is killing the filler byte but I have a suspicion that'll change eventually to INT3... :) -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette From mboxrd@z Thu Jan 1 00:00:00 1970 From: Borislav Petkov Date: Thu, 10 Oct 2019 10:33:05 +0000 Subject: Re: [PATCH 07/29] x86: Restore "text" Program Header with dummy section Message-Id: <20191010103305.GD7658@zn.tnic> List-Id: References: <20190926175602.33098-1-keescook@chromium.org> <20190926175602.33098-8-keescook@chromium.org> In-Reply-To: <20190926175602.33098-8-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Kees Cook Cc: Thomas Gleixner , Rick Edgecombe , Ingo Molnar , "H. Peter Anvin" , Dave Hansen , Andy Lutomirski , Arnd Bergmann , linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org, linux-s390@vger.kernel.org, linux-c6x-dev@linux-c6x.org, Yoshinori Sato , Michal Simek , linux-parisc@vger.kernel.org, linux-xtensa@linux-xtensa.org, x86@kernel.org, linux-kernel@vger.kernel.org On Thu, Sep 26, 2019 at 10:55:40AM -0700, Kees Cook wrote: > Instead of depending on markings in the section following NOTES to > restore the associated Program Header, use a dummy section, as done > in other architectures. This is very laconic and after some staring at ld.info, I think you mean this: " If you place a section in one or more segments using ':PHDR', then the linker will place all subsequent allocatable sections which do not specify ':PHDR' in the same segments." but I could be way off. Yes, no? IOW, please write in the commit messages first what the problem is you're addressing. > This is preparation for moving NOTES into the > RO_DATA macro. > > Signed-off-by: Kees Cook > --- > arch/x86/kernel/vmlinux.lds.S | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S > index e2feacf921a0..788e78978030 100644 > --- a/arch/x86/kernel/vmlinux.lds.S > +++ b/arch/x86/kernel/vmlinux.lds.S > @@ -147,8 +147,9 @@ SECTIONS > } :text = 0x9090 > > NOTES :text :note > + .dummy : { *(.dummy) } :text > > - EXCEPTION_TABLE(16) :text = 0x9090 > + EXCEPTION_TABLE(16) This is killing the filler byte but I have a suspicion that'll change eventually to INT3... :) -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3815EC4360C for ; Thu, 10 Oct 2019 10:35:35 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A25321920 for ; Thu, 10 Oct 2019 10:35:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="QrtsacxT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A25321920 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46pnY00GL7zDr3h for ; Thu, 10 Oct 2019 21:35:32 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=alien8.de (client-ip=2a01:4f8:190:11c2::b:1457; helo=mail.skyhub.de; envelope-from=bp@alien8.de; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=alien8.de header.i=@alien8.de header.b="QrtsacxT"; dkim-atps=neutral Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46pnVn226jzDqsp for ; Thu, 10 Oct 2019 21:33:36 +1100 (AEDT) Received: from zn.tnic (p200300EC2F0A6300C5CFCA1B921AC096.dip0.t-ipconnect.de [IPv6:2003:ec:2f0a:6300:c5cf:ca1b:921a:c096]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 606201EC090E; Thu, 10 Oct 2019 12:33:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1570703593; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=61VcXOO6OC0TSDKYRbLOk7EXig9eCgXyOc1Sw8qjbMo=; b=QrtsacxT1YtNlQnr0l29ht/E0oAvW+TPvKSyK2g0/hm1JIpJUv3weRvTAKtk5um+tIL7NZ sMKAq2cd3qZJrCB8QeMiLz+W0PHOQeM7u7ISY1ucpnilVubyTseLgfkDcEzyeyNOoeMuUd DvcpBmRi6/Jkc81xIBQiQ4XT3IX11oI= Date: Thu, 10 Oct 2019 12:33:05 +0200 From: Borislav Petkov To: Kees Cook Subject: Re: [PATCH 07/29] x86: Restore "text" Program Header with dummy section Message-ID: <20191010103305.GD7658@zn.tnic> References: <20190926175602.33098-1-keescook@chromium.org> <20190926175602.33098-8-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190926175602.33098-8-keescook@chromium.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Michal Simek , linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org, linux-c6x-dev@linux-c6x.org, Arnd Bergmann , linux-xtensa@linux-xtensa.org, linux-kernel@vger.kernel.org, Dave Hansen , x86@kernel.org, Yoshinori Sato , Ingo Molnar , linux-parisc@vger.kernel.org, Andy Lutomirski , "H. Peter Anvin" , Thomas Gleixner , Rick Edgecombe , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, Sep 26, 2019 at 10:55:40AM -0700, Kees Cook wrote: > Instead of depending on markings in the section following NOTES to > restore the associated Program Header, use a dummy section, as done > in other architectures. This is very laconic and after some staring at ld.info, I think you mean this: " If you place a section in one or more segments using ':PHDR', then the linker will place all subsequent allocatable sections which do not specify ':PHDR' in the same segments." but I could be way off. Yes, no? IOW, please write in the commit messages first what the problem is you're addressing. > This is preparation for moving NOTES into the > RO_DATA macro. > > Signed-off-by: Kees Cook > --- > arch/x86/kernel/vmlinux.lds.S | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S > index e2feacf921a0..788e78978030 100644 > --- a/arch/x86/kernel/vmlinux.lds.S > +++ b/arch/x86/kernel/vmlinux.lds.S > @@ -147,8 +147,9 @@ SECTIONS > } :text = 0x9090 > > NOTES :text :note > + .dummy : { *(.dummy) } :text > > - EXCEPTION_TABLE(16) :text = 0x9090 > + EXCEPTION_TABLE(16) This is killing the filler byte but I have a suspicion that'll change eventually to INT3... :) -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette