Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp132445rwb; Thu, 22 Sep 2022 15:37:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50yx2VfC8hjsNAQROcVwgAbJOHHkFPdtC4weqImER+BBe2YiKd6CbAd1aj6RvyT0jL8rY2 X-Received: by 2002:a05:6402:34cf:b0:454:53ae:6e83 with SMTP id w15-20020a05640234cf00b0045453ae6e83mr5393911edc.80.1663886269220; Thu, 22 Sep 2022 15:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663886269; cv=none; d=google.com; s=arc-20160816; b=CmrNRde3mrb2EPLjBCfwSPuZX5Uoh3lrxmTkUmvjnYfnaqd0+nl9EGcbpTW/Xfqbtn k7Nx8ISiXp2HjwJG6J8vPMopJPgTqsMOZ6DVGKwea5qFJXKXuqrExj5syXGWJjHxr+Pe BPMLvRc/WnwQQMngOPRGrTSyLeOlzQsDOVTx6Lj47lbW19nGvJmd0hczhdqphtSZiM7e KeO7n8F2st3KqWkA9J8b8Tx5BGK9MHu9p/uXMF14I3ArxhSSqauKm+LAeOb+pbqVznqF NZL6eJqy+4VTRCinwHNCAUExQHnQe1PqW9RhvQ1JHlaTdRHF3v+azzx84c6/at32ST7M oSJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3tQ8DexTmBQhSl481NWshvFci5ptg/GjLyg2jvTMyy8=; b=MhIp5A5a2bnZlvA/vv3Q52V174EDsK1oRgSJ9QyQPDLDlwiq5P5xXnRYpo9J17AxGP sn34Nm8lefPyzrVp6RL8wdXhUpS13Sfpz37+MDc2sX04ac7vYFPLRsP0RLSirTIqJKFy bV7QBV3zxZpt1aFShn7j1YkdvbWR0+C8c6MS6JzxbKjG2Hei8wnMONbDcKhmcU4RHGRt An5QmWXJqUnVoHSOyS/MErHICFXIaGL5CHV6uZDRa9s0NXdTD5CvelglekATFJLzCRoP tbN0xHkDl7yaj90vBdsr2lF27658At7EUf7KuvHT5XCoXRRuWnSiX+meZWXEs//VvfzX 9Ofg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=m2zXmoY9; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz22-20020a0564021d5600b00454290f2ff9si7199324edb.178.2022.09.22.15.37.22; Thu, 22 Sep 2022 15:37:49 -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=@chromium.org header.s=google header.b=m2zXmoY9; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230352AbiIVWSF (ORCPT + 99 others); Thu, 22 Sep 2022 18:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbiIVWSE (ORCPT ); Thu, 22 Sep 2022 18:18:04 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 457EB10D0E7 for ; Thu, 22 Sep 2022 15:18:03 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id y11so11169262pjv.4 for ; Thu, 22 Sep 2022 15:18:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date; bh=3tQ8DexTmBQhSl481NWshvFci5ptg/GjLyg2jvTMyy8=; b=m2zXmoY9XUMR6tDEDw/SxGMgC29NNYVTIjkuU19RN+nAKxMR0jR+SlImSib5RdnwhU IBd6KYLL/N+QCZXd0GePsiZhx8eKAG8BnzVYErauhrhmI5L3V68rn5ZqSYUzNktJ6P/M C9FMtt/Yims1ynU3WNfaGSqRCaOjqOdxaLf9I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=3tQ8DexTmBQhSl481NWshvFci5ptg/GjLyg2jvTMyy8=; b=5Y1NyLHs9G8l0i6wx4QTEPrht2ZACKUFItW4N1HfBudDpn8FcyjMLY2kMPh37wtfS0 OeQJ4UXZ08E5zRwmTeSTSlv6fqysIg+rotupByCt+Zwe8yFuKbxjwKDsYxOr8DEpKw05 EYgyBQ5d7oBwMuaAbQXXZzdlX8kcCypoJ23t6Q5TXNdHS1MBekFTwtqZUC6kQPVL4RFY oKSRUj03p+rGtihs7j2x4v3xkxYyv8/jN6by/n8SgtjvBdgAQnzQSIiphIiSqajK3wN4 zDvFp06xPi+tcq/sNWKT5oNfuoRavH6F16jHSyBUm0qgScf3oAuU4hlojoHZBQ8Md9rV pZbA== X-Gm-Message-State: ACrzQf3QWy0QCHA3MNwtiyJ+ZyW6XoDO0umm4B3QYVbomb97m+NP2oMo Lo7T0Rr0Y4alxr7qQ6GUUf1aydFo8MLwMA== X-Received: by 2002:a17:903:496:b0:176:ba09:1cc0 with SMTP id jj22-20020a170903049600b00176ba091cc0mr5292930plb.41.1663885082768; Thu, 22 Sep 2022 15:18:02 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id i2-20020a17090332c200b0017834a6966csm4777432plr.176.2022.09.22.15.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 15:18:02 -0700 (PDT) Date: Thu, 22 Sep 2022 15:18:01 -0700 From: Kees Cook To: Will Deacon Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sami Tolvanen , Mark Rutland , "Mohan Rao .vanimina" , Nathan Chancellor Subject: Re: [PATCH] vmlinux.lds.h: CFI: Reduce alignment of jump-table to function alignment Message-ID: <202209221514.B2B02622@keescook> References: <20220922215715.13345-1-will@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220922215715.13345-1-will@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 10:57:15PM +0100, 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. Heh. "That's not an image ... THIS is an image."[1] > 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. ❤️ Reviewed-by: Kees Cook -Kees [1] https://www.youtube.com/watch?v=rne8pOxGuwM#t=27 -- Kees Cook