Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp116154rwb; Thu, 22 Sep 2022 15:21:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5UgYbfnZmM8oaswzHgIxO/cjHmFe874RP0plLUQ26peTfbiG2amPcya0mI51JeYItypgl8 X-Received: by 2002:a17:90b:4f86:b0:203:bbe8:137c with SMTP id qe6-20020a17090b4f8600b00203bbe8137cmr6122361pjb.47.1663885292933; Thu, 22 Sep 2022 15:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663885292; cv=none; d=google.com; s=arc-20160816; b=glBQEuAKla6/tBLCmR3KMB7EmYJvEAP4L0xMAd8I+2DlC4f1DaPjAv2a7Eco0DSaWH 5yphx+CPveucNCDz11EIoTfbMNVvGOZngrczdFdMDJrMLUtxv8yrn6vwfXkg6oWkIA7T v7wU6XBiWLPjrB2HHPqQ/QhDmqVYW9fIVefrNwRCpBavqZewrY8C29HZILb+SU03ILXq RkYyuPWxM9dYSko987bF19bpX2EPxyeYgGYs7u7cERWvSRn2SucQYaPD4YHlUARjEEGB yHxNOQLxSMRoym1Cpfyk/tMzlTvPIlO8cIbfEOCz4O3TdNjfJ5z/KhWenfhCDeH/kbNE 2J7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ZW8ngLQwncVL4JlsWyY79eXQGckyqSHpOZGjTmoa8g4=; b=jCzjXGHmFzgcBDlYPyZowflfLI2F+PITanuCI+FSUtDgSJMVWuqcyJzp+BTEpZ/oTx uCP0+kVSkIdAabxnpx38lUjLG6unmk9PuRE5R8kODzaQ5ccwgv9D2GHWv+GJdguu4hdy oc42WBRTKVhZkL/1E6dLX8LjUdj6zgf+cRRXIOYw13YYxBKUnXpnmZ7myDQFjdaz50yo BlVcAoIU5HpEAkWhyWkorllzcapB9exri/PGcug2DhyXAQYzh7Z60oJr0bBtpgiBEgIk Qry05D5yh2M9PXbXmbxv97xu8u45S0K6ciiiYfIHHE4d54Rt4SVO/orZaSrwTE3KU6jO okEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=mKNJTkG+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a70-20020a639049000000b004397a9739cbsi7663808pge.851.2022.09.22.15.21.20; Thu, 22 Sep 2022 15:21:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=mKNJTkG+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229845AbiIVWBF (ORCPT + 99 others); Thu, 22 Sep 2022 18:01:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbiIVWBC (ORCPT ); Thu, 22 Sep 2022 18:01:02 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28208EA5B0 for ; Thu, 22 Sep 2022 15:00:58 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id p202so2640706iod.6 for ; Thu, 22 Sep 2022 15:00:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=ZW8ngLQwncVL4JlsWyY79eXQGckyqSHpOZGjTmoa8g4=; b=mKNJTkG+9zTEF1nC+8SnCcxqCpl+oDPYgrtavI2qnADjB0dM4zPUYLbxevunZP+bf3 /Y30GdsitvKXOFFHEm7eUut5SThUUVIUAKEUNd75FXYFDKWxKf927E+H1R2lgIfXzq7T OwR5hMW+g8PRwwwVriuU7tIIHn6tVHQE0nLcFN7+B8Hn7NF8QEa5FYN65IOxlZ8kJag3 b8KYMmPG6kR0PdXkV92kd/5AQxUNF/yKzOxPJWXRptoQFlup/XAMY5lemBqQR5AuCakl CBGRv0LOLksn48IZuUWqm7EHPSVA9KljmkO4QrLZC4lr+U3TT/asyAI3++bqrBVzClze hq+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=ZW8ngLQwncVL4JlsWyY79eXQGckyqSHpOZGjTmoa8g4=; b=pHT+Eb9F0P2ft3QMIJButVLauYkIWNRteNAMi2mq1PRBO3clw8cOkTAW5S5+4gg0LG s3E6l9XAeBd6XfyMiiM9hNciorMhG3/Yf3lwhARdMGTKMe5O6oI2KZ1+qiEpmY0B9KDa 2ooSmng5DOhxKL6PUsxIYDiA3O0pcuAdICiTKLWn4Qf7lY6ZM4jB1/A9/iwjknuGjc3I HzQd8n6gKKcpK8f0PIjoUbs0I+Ho00F2hrFEAV7rGwn+TU5OoUC9yjfO99h+82/eMESE vaNs5IrSCQ2nRct6FTWwleN1PNfdpktKIQO5mg66TyxDCMaOTvddq1NOoF1ixw7xgb6X 37JA== X-Gm-Message-State: ACrzQf1R69WhVROGyRWI1m/OkDhNuA2Sma+dkriONZBr7B2Pxxq0rsbp GOTJMLEK3+NHcohFXciLKjjEHqZ78xh5Y9mZ77VdVA== X-Received: by 2002:a05:6602:2c01:b0:68b:559f:bbef with SMTP id w1-20020a0566022c0100b0068b559fbbefmr2551160iov.204.1663884057461; Thu, 22 Sep 2022 15:00:57 -0700 (PDT) MIME-Version: 1.0 References: <20220922215715.13345-1-will@kernel.org> In-Reply-To: <20220922215715.13345-1-will@kernel.org> From: Sami Tolvanen Date: Thu, 22 Sep 2022 15:00:21 -0700 Message-ID: Subject: Re: [PATCH] vmlinux.lds.h: CFI: Reduce alignment of jump-table to function alignment To: Will Deacon Cc: LKML , linux-arm-kernel , Mark Rutland , "Mohan Rao .vanimina" , Kees Cook , Nathan Chancellor Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 22, 2022 at 2:57 PM Will Deacon wrote: > > Due to undocumented, hysterical raisins on x86, the CFI jump-table > sections in .text are needlessly aligned to PMD_SIZE in the vmlinux > linker script. When compiling a CFI-enabled arm64 kernel with a 64KiB > page-size, a PMD maps 512MiB of virtual memory and so the .text section > increases to a whopping 940MiB and blows the final Image up to 960MiB. > Others report a link failure. > > Since the CFI jump-table requires only instruction alignment, reduce the > alignment directives to function alignment for parity with other parts > of the .text section. This reduces the size of the .text section for the > aforementioned 64KiB page size arm64 kernel to 19MiB for a much more > reasonable total Image size of 39MiB. > > Cc: Sami Tolvanen > Cc: Mark Rutland > Cc: "Mohan Rao .vanimina" > Cc: Kees Cook > Cc: Nathan Chancellor > Link: https://lore.kernel.org/all/CAL_GTzigiNOMYkOPX1KDnagPhJtFNqSK=1USNbS0wUL4PW6-Uw@mail.gmail.com/ > Fixes: cf68fffb66d60 ("add support for Clang CFI") > Signed-off-by: Will Deacon > --- > include/asm-generic/vmlinux.lds.h | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h > index 7515a465ec03..7c90b1ab3e00 100644 > --- a/include/asm-generic/vmlinux.lds.h > +++ b/include/asm-generic/vmlinux.lds.h > @@ -543,10 +543,9 @@ > */ > #ifdef CONFIG_CFI_CLANG > #define TEXT_CFI_JT \ > - . = ALIGN(PMD_SIZE); \ > + ALIGN_FUNCTION(); \ > __cfi_jt_start = .; \ > *(.text..L.cfi.jumptable .text..L.cfi.jumptable.*) \ > - . = ALIGN(PMD_SIZE); \ > __cfi_jt_end = .; > #else > #define TEXT_CFI_JT Thanks for sending the patch! Reviewed-by: Sami Tolvanen Sami