From patchwork Mon Jan 4 12:20:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 11996611 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 90074C433DB for ; Mon, 4 Jan 2021 12:21:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5F5542075B for ; Mon, 4 Jan 2021 12:21:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726246AbhADMVg (ORCPT ); Mon, 4 Jan 2021 07:21:36 -0500 Received: from mail-40131.protonmail.ch ([185.70.40.131]:14856 "EHLO mail-40131.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726098AbhADMVf (ORCPT ); Mon, 4 Jan 2021 07:21:35 -0500 Date: Mon, 04 Jan 2021 12:20:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1609762851; bh=hjIccLTNrNOzUNrqAIbTw81FXVcf6wB+LAQsEABOGxY=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=RQmaKRugTD/OeHYkAjO46QoqnmWf4vDA/hVurOPWLM43feFjotxLEqLXf4SIdbdY0 GM0Jwqw3IuoKAmy8SPIi1f0sIA4ErhYws50NCN9yDJMeMAcGZwgyiODtDsVS1YDmVs uFPIxJoU0niqPvOVZJQS84du1doJ9mYeFrwoKTVXk8PIk85flTUYliB03ITyCuQm0f gSN00ogvn1rI7qWL1Ysru2P0GnpUAIboZt8Mm7TyhMmTke1erjEuujESu0p+1AfWy6 7Bg61m3T1YxJdawcNIyh3QZSCJmDSDmZVnWN8TjJ9Q0bvaCxDN1/rlVFI3PEfcwK2R Ikszf/9yWBGVQ== To: Thomas Bogendoerfer From: Alexander Lobakin Cc: Alexander Lobakin , Kees Cook , Ingo Molnar , Fangrui Song , Jiaxun Yang , Ralf Baechle , Alex Smith , Markos Chandras , linux-mips@vger.kernel.org, stable@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH mips-next 1/4] MIPS: vmlinux.lds.S: add missing PAGE_ALIGNED_DATA() section Message-ID: <20210104122016.47308-1-alobakin@pm.me> In-Reply-To: <20210104121729.46981-1-alobakin@pm.me> References: <20210104121729.46981-1-alobakin@pm.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org MIPS uses its own declaration of rwdata, and thus it should be kept in sync with the asm-generic one. Currently PAGE_ALIGNED_DATA() is missing from the linker script, which emits the following ld warnings: mips-alpine-linux-musl-ld: warning: orphan section `.data..page_aligned' from `arch/mips/kernel/vdso.o' being placed in section `.data..page_aligned' mips-alpine-linux-musl-ld: warning: orphan section `.data..page_aligned' from `arch/mips/vdso/vdso-image.o' being placed in section `.data..page_aligned' Add the necessary declaration, so the mentioned structures will be placed in vmlinux as intended: ffffffff80630580 D __end_once ffffffff80630580 D __start___dyndbg ffffffff80630580 D __start_once ffffffff80630580 D __stop___dyndbg ffffffff80634000 d mips_vdso_data ffffffff80638000 d vdso_data ffffffff80638580 D _gp ffffffff8063c000 T __init_begin ffffffff8063c000 D _edata ffffffff8063c000 T _sinittext -> ffffffff805a4000 D __end_init_task ffffffff805a4000 D __nosave_begin ffffffff805a4000 D __nosave_end ffffffff805a4000 d mips_vdso_data ffffffff805a8000 d vdso_data ffffffff805ac000 D mmlist_lock ffffffff805ac080 D tasklist_lock Fixes: ebb5e78cc634 ("MIPS: Initial implementation of a VDSO") Cc: stable@vger.kernel.org # 4.4+ Signed-off-by: Alexander Lobakin --- arch/mips/kernel/vmlinux.lds.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S index 5e97e9d02f98..83e27a181206 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S @@ -90,6 +90,7 @@ SECTIONS INIT_TASK_DATA(THREAD_SIZE) NOSAVE_DATA + PAGE_ALIGNED_DATA(PAGE_SIZE) CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) DATA_DATA From patchwork Mon Jan 4 12:20:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 11996615 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 C980CC433E9 for ; Mon, 4 Jan 2021 12:21:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 930872075B for ; Mon, 4 Jan 2021 12:21:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726637AbhADMVk (ORCPT ); Mon, 4 Jan 2021 07:21:40 -0500 Received: from mail-40133.protonmail.ch ([185.70.40.133]:30794 "EHLO mail-40133.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbhADMVk (ORCPT ); Mon, 4 Jan 2021 07:21:40 -0500 Date: Mon, 04 Jan 2021 12:20:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1609762858; bh=qSKUMkjU5GlKT1yGdK7US3YKLfx4lwIL2x207qkS1m4=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=ZRS6F78XW6uvtedI4xk4g1iJ+rUb3117NOO/m3AJHy/9CxFxWNLx5gdwDKjyFWgI5 MFCi/uk6pbz7c2TcxFopT9A4g2JobpjzcC2aHktcVT7/lV8qrhCNB5XI4IGqNdWMck X7nrz2ykcuQVR9gS8Uu1aUkShicCzBrDuFX3v7Mv3FKPnkYMd9ns5pxJOI2kRzYpbx yaiwJj1m8b5yPTNVQAKiS8ZP13dBr5DHEqmrJFm6ypmI1rnHjsK/LrsGH+5v0EMaHz O9v36XKIZmmD50PRH6fW4L1Y6JSdTIupjuazO0kN8AQepMLj+97mbm703b1mVIODO5 kLVSIkBU9OQMQ== To: Thomas Bogendoerfer From: Alexander Lobakin Cc: Alexander Lobakin , Kees Cook , Ingo Molnar , Fangrui Song , Jiaxun Yang , Ralf Baechle , Alex Smith , Markos Chandras , linux-mips@vger.kernel.org, stable@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH mips-next 2/4] MIPS: vmlinux.lds.S: add ".rel.dyn" to DISCARDS Message-ID: <20210104122016.47308-2-alobakin@pm.me> In-Reply-To: <20210104122016.47308-1-alobakin@pm.me> References: <20210104121729.46981-1-alobakin@pm.me> <20210104122016.47308-1-alobakin@pm.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org GCC somehow manages to place some of the symbols from main.c into .rel.dyn section: mips-alpine-linux-musl-ld: warning: orphan section `.rel.dyn' from `init/main.o' being placed in section `.rel.dyn' I couldn't catch up the exact symbol, but seems like it's harmless to discard it from the final vmlinux as kernel doesn't use or support dynamic relocations. Misc: sort DISCARDS section entries alphabetically. 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.lds.S index 83e27a181206..1c3c2e903062 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S @@ -221,9 +221,10 @@ SECTIONS /* ABI crap starts here */ *(.MIPS.abiflags) *(.MIPS.options) + *(.eh_frame) *(.options) *(.pdr) *(.reginfo) - *(.eh_frame) + *(.rel.dyn) } } From patchwork Mon Jan 4 12:20:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 11996635 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 EFD04C433E0 for ; Mon, 4 Jan 2021 12:22:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB83C207B1 for ; Mon, 4 Jan 2021 12:22:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726148AbhADMWY (ORCPT ); Mon, 4 Jan 2021 07:22:24 -0500 Received: from mail-03.mail-europe.com ([91.134.188.129]:56026 "EHLO mail-03.mail-europe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725840AbhADMWX (ORCPT ); Mon, 4 Jan 2021 07:22:23 -0500 Date: Mon, 04 Jan 2021 12:20:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1609762853; bh=SIcv4XaKrE3sjxZfC8U6t0751adTjmCuETpzD6NuSCs=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=bPMmaBiAOhYlDJK/WP/HejMz608GEwc4rUQd3zhL6wzuyuY7BGoviLNtY/TRG/QQj 1Lnm8VO6jaYUmvQ5BukLRA3Vgto2s225dVo/Fl/MiYpv5SLQCn0KFpJPOFuk2Pnk5K VHt/G6EpflXQo3uLKWn3FCgetsywnCUs43v4X7Nn/cbODlUwyFk/TAHUrTZxClz21S S9GzydYwIHrYfY79v/ECshGODjFcK034OAOPbp09euD4AEW09WryoI8RAecgCpNY6T 77E4PkMd3S41J9sz9k02re5tp/UwsYms57WlZOn0V11NIDhmlSiqfTTLMu61PBFs49 L+kNdYA80BOZA== To: Thomas Bogendoerfer From: Alexander Lobakin Cc: Alexander Lobakin , Kees Cook , Ingo Molnar , Fangrui Song , Jiaxun Yang , Ralf Baechle , Alex Smith , Markos Chandras , linux-mips@vger.kernel.org, stable@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH mips-next 3/4] MIPS: vmlinux.lds.S: add ".gnu.attributes" to DISCARDS Message-ID: <20210104122016.47308-3-alobakin@pm.me> In-Reply-To: <20210104122016.47308-1-alobakin@pm.me> References: <20210104121729.46981-1-alobakin@pm.me> <20210104122016.47308-1-alobakin@pm.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org 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' Signed-off-by: Alexander Lobakin --- arch/mips/kernel/vmlinux.lds.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S index 1c3c2e903062..8ac95269124a 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S @@ -222,6 +222,7 @@ SECTIONS *(.MIPS.abiflags) *(.MIPS.options) *(.eh_frame) + *(.gnu.attributes) *(.options) *(.pdr) *(.reginfo) From patchwork Mon Jan 4 12:20:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 11996613 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 A2499C43381 for ; Mon, 4 Jan 2021 12:21:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6FC6321E92 for ; Mon, 4 Jan 2021 12:21:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726661AbhADMVm (ORCPT ); Mon, 4 Jan 2021 07:21:42 -0500 Received: from mail-40134.protonmail.ch ([185.70.40.134]:26930 "EHLO mail-40134.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726325AbhADMVm (ORCPT ); Mon, 4 Jan 2021 07:21:42 -0500 Date: Mon, 04 Jan 2021 12:20:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1609762860; bh=FmvdsZCHCCE79sjLAYIX/gq7paKAr3hB9iXFALHlrb4=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=iA7fIKU+iUGl8//KALpAwglGMr5bbfoGRBV0KXWxYGgiY+xJfFF0Uu/ZnFJ3d9zf6 F5IzM9pVLffdB9/RrvxNF75hHhZUmHIEDUD4TdEGjqZcwtsgkaMGT/QiwlgjlQz11n WD2k0M/tQeEc6eQZ84AT41ZjdG9o9VQOxJYDkH+unsRuZnRCeJQT4vaBjW80qIFhRZ nvVb1CbKri8IbpOKf6CCbrrvZdGlFuhC3mYue+leQ72E3cAcutiyYjVguTNtb19gOU dzpj9taWqP1L0j8ex9aoneS99+iQixpcPcuzZJ31ZI5wzLlxmkoIUxrKlxnrhtuumv e1Wm73KNVeLcw== To: Thomas Bogendoerfer From: Alexander Lobakin Cc: Alexander Lobakin , Kees Cook , Ingo Molnar , Fangrui Song , Jiaxun Yang , Ralf Baechle , Alex Smith , Markos Chandras , linux-mips@vger.kernel.org, stable@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH mips-next 4/4] MIPS: select ARCH_WANT_LD_ORPHAN_WARN Message-ID: <20210104122016.47308-4-alobakin@pm.me> In-Reply-To: <20210104122016.47308-1-alobakin@pm.me> References: <20210104121729.46981-1-alobakin@pm.me> <20210104122016.47308-1-alobakin@pm.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Now, after that all the sections are explicitly described and declared in vmlinux.lds.S, we can enable ld orphan warnings to prevent from missing any new sections in future. Signed-off-by: Alexander Lobakin --- arch/mips/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index d68df1febd25..d3e64cc0932b 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -18,6 +18,7 @@ config MIPS select ARCH_USE_QUEUED_SPINLOCKS select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU select ARCH_WANT_IPC_PARSE_VERSION + select ARCH_WANT_LD_ORPHAN_WARN select BUILDTIME_TABLE_SORT select CLONE_BACKWARDS select CPU_NO_EFFICIENT_FFS if (TARGET_ISA_REV < 1)