Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1173675pxu; Wed, 6 Jan 2021 14:39:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwU3tHv9zej+pQvn8XqYHPf0MH7rVNRXh5K64qBcM6MfuxBxaQfHFWddhPQQRGeQZ+yRNTW X-Received: by 2002:a05:6402:2292:: with SMTP id cw18mr5508994edb.336.1609972745262; Wed, 06 Jan 2021 14:39:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609972745; cv=none; d=google.com; s=arc-20160816; b=hgWXQRmUOvTWVQ8Expv9b9f2FLFhdCo3jHxODXZ6sm6bEdnoi8DjIV5FuZJaaA1Qpi fE1dIoNMyEZM8M3JFxPQ5+6x37cUdP0oMazwQVwLn8YhRd8Lfa9a72CpMe0Iml2JMeMY 7cF2biy/pkRc2igCe1iqGWQ2KAClCRhKKLWWPflAWSd83vLEj6Sbtv/G7m6QUAgSm4aO 0NaRY0NVQBlubVhzZaUOBxGfvVKfCTJLGGAqtNCnD+fO/+t4+G/fN5VwIAcOzIFM3wsl Uh8AdVjjbHRfqyHwgBbHog6SMFzdOnnIjlDIQugR6PSjunNP7tVnDiVfGsBpHWrUDUKX 5m6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=k6M2q3UgsdjUwB9RMkadILtzv8IamufG6KQUruldxKM=; b=nkRJdXNMFCnrak2agrLu3ZSyg5aKRpDnwjb2FZ8XgvzXqkzhjidKmFzsxF/dXlOUkk zx57GhtQnHMx9eD1Se+p+E5PQOJ7+Ol9kmjaOCYfPlk2zsqkatnco9ESQMiNRcPNArzu eYznFNBVztezwdyAQtRgWnpFaQA69y+D6xmR42Ggg3XBv3EZho8RTsYofY84sJdWYD6y W+fEAqxPtPg9Nm7g3f5q/H0o98dmcLcPZ9FLZ/rPbuV4EjkPJQ9GaoOAh089GVSj40+R VSvyPlk79y3+MeVLUFDjTDn5uAuvCcDoVm1gLU5HON66snUBfC5XwLv1AE012Td8JDUF 36lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b="L6maY/yD"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 97si1453495edr.29.2021.01.06.14.38.41; Wed, 06 Jan 2021 14:39:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b="L6maY/yD"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727308AbhAFWh3 (ORCPT + 99 others); Wed, 6 Jan 2021 17:37:29 -0500 Received: from mail-40136.protonmail.ch ([185.70.40.136]:50017 "EHLO mail-40136.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726684AbhAFWh3 (ORCPT ); Wed, 6 Jan 2021 17:37:29 -0500 Date: Wed, 06 Jan 2021 22:36:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1609972601; bh=k6M2q3UgsdjUwB9RMkadILtzv8IamufG6KQUruldxKM=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=L6maY/yDbZ8Li0Yu7ap8dAql+A6dhNs6Z/myf6kVJ/LEMEKRzBpHeJB3K6Caxqpxw 7Ix4vt5L6jfkFK6++/PLRVjeBWD0AObdMR3t1vk4ZA7I/8WgkaHP/vk/9XayK3XZXW H5r44Sb+JNddFSO3fmmLEtCN4qYiMYaMg/g0O+Ynmt03JLdONAWsVGXE3qwt3n74Z3 wEmU3UZr5coSYU/YIg1FAszTV5Qt+LwQ6bvuXD0XJpCXNUCQmEoqzMPhkL/6bVDfHv 1ga1Y22mEmL1T5yHnN+XgV0IGQ4R6l2hLDfOzNPhyHUAwrbE6/PrSOv8BAIGyq9NVU syUCww5on34kw== To: Kees Cook From: Alexander Lobakin Cc: Alexander Lobakin , Thomas Bogendoerfer , Nathan Chancellor , Fangrui Song , Jiaxun Yang , Alex Smith , Ralf Baechle , Markos Chandras , linux-mips@vger.kernel.org, stable@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: Re: [PATCH v2 mips-next 2/4] MIPS: vmlinux.lds.S: add ".gnu.attributes" to DISCARDS Message-ID: <20210106223606.267756-1-alobakin@pm.me> In-Reply-To: <202101061400.8F83981AE@keescook> References: <20210106200713.31840-1-alobakin@pm.me> <20210106200801.31993-1-alobakin@pm.me> <20210106200801.31993-2-alobakin@pm.me> <202101061400.8F83981AE@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kees Cook Date: Wed, 6 Jan 2021 14:07:07 -0800 > On Wed, Jan 06, 2021 at 08:08:19PM +0000, Alexander Lobakin wrote: >> Discard GNU attributes at link time as kernel doesn't use it at all. >> Solves a dozen of the following ld warnings (one per every file): >> >> mips-alpine-linux-musl-ld: warning: orphan section `.gnu.attributes' >> from `arch/mips/kernel/head.o' being placed in section >> `.gnu.attributes' >> mips-alpine-linux-musl-ld: warning: orphan section `.gnu.attributes' >> from `init/main.o' being placed in section `.gnu.attributes' >> >> Misc: sort DISCARDS section entries alphabetically. > > Hmm, I wonder what is causing the appearance of .eh_frame? With help I > tracked down all the causes of this on x86, arm, and arm64, so that's > why it's not in the asm-generic DISCARDS section. I suspect this could > be cleaned up for mips too? I could take a look and hunt it down. Could you please give some refs on what were the causes and solutions for the mentioned architectures? > Similarly for .gnu.attributes. What is generating that? (Or, more > specifically, why is it both being generated AND discarded?) On my setup, GNU Attributes consist of MIPS FP type (soft) and (if I'm correct) MIPS GNU Hash tables. > -Kees By the way. I've built the kernel with LLVM stack (and found several subjects for more patches) and, besides '.got', also got a fistful of '.data..compoundliteral*' symbols (drivers/mtd/nand/spi/, net/ipv6/ etc). Where should they be placed (rodata, rwdata, ...) or they are anomalies of some kind and should be fixed somehow? >> >> Signed-off-by: Alexander Lobakin >> --- >> arch/mips/kernel/vmlinux.lds.S | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.l= ds.S >> index 83e27a181206..5d6563970ab2 100644 >> --- a/arch/mips/kernel/vmlinux.lds.S >> +++ b/arch/mips/kernel/vmlinux.lds.S >> @@ -221,9 +221,10 @@ SECTIONS >> =09=09/* ABI crap starts here */ >> =09=09*(.MIPS.abiflags) >> =09=09*(.MIPS.options) >> +=09=09*(.eh_frame) >> +=09=09*(.gnu.attributes) >> =09=09*(.options) >> =09=09*(.pdr) >> =09=09*(.reginfo) >> -=09=09*(.eh_frame) >> =09} >> } >> -- >> 2.30.0 >> >> > > -- > Kees Cook Thanks, Al