Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp754329pxb; Fri, 22 Apr 2022 10:26:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYHKU+5T/DajK6uWfVp9QlylOZO9qpUd2AiPX0tQbaWR07C9/bWlywK8Ps2JlD9CDg2rcT X-Received: by 2002:a63:6a85:0:b0:398:9e2b:afd6 with SMTP id f127-20020a636a85000000b003989e2bafd6mr4844557pgc.582.1650648370052; Fri, 22 Apr 2022 10:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650648370; cv=none; d=google.com; s=arc-20160816; b=iGeSWFPJG1NirCfc6RIJLQSVAGKQ1uX0BVxC5eZ0DrKWtr/RPhSadiC/h2aagxexYg NZ8fKd3DNpBuWR4+v1ORsZmNmUKOS+P6H2QUWk/ZA8BwVhamu9WLWFIjmRQ3s21Jt8JL eT0YqOlOKFy/8sABuaPIvK/y1332nHTTRIGtsFWkKOu0TlwS7X0IQs3CLj/GjQ/9shtS RK5o/KNS36Pq/C9+x2afcm3MYC7ufR83zxPFttBo6dfIV0VPOg2p5Om2upehQBWOaLsM vFWVn8hTHgb9pu3j5vbyuU0bEn4Z1Ri2AtZb92ZgRMXDFp3jdRUexpnrMS3NO8ta2yl9 ydww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:references :in-reply-to:subject:cc:to:from:date:mime-version; bh=dVuc1v4gar9UklM6H5tPyxax9q6+uwvbD6m0Dn8n6Bo=; b=w7lKIsaByeQK9ap6FQVF9VWK/68Tpx2+tF4PwUVryiDA97mNaTLpFlQQ/kH0k9ftlp gSfYBCemREdeotJRgXKqVk1Qth6FL7q/icWgctt/9BNEiG0K0EQMfvBCLvwMzrPfGED4 kWTEmz4yBgTM6adqubaAjCqQ4a2J6ah30OHSQHBVu6iz7l7mG78RF79ffinUDVIF+wCr zWPkDXbwXWfLWUjJOCW8VRaMZHq4vWXII3VJftUYr8QObMfFDnJHgElgFJL5G7TczS13 UZjx61rXIxHj2oYnhhg+t7hPJ55hi8qSCwWgaqfP821iW6t11y4GKLMvaXzcu1H6tFRY LAWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id cp6-20020a056a00348600b0050cef81c245si1826168pfb.225.2022.04.22.10.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 10:26:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D31F5BAB9C; Fri, 22 Apr 2022 10:19:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382959AbiDTWoF (ORCPT + 99 others); Wed, 20 Apr 2022 18:44:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359233AbiDTWn6 (ORCPT ); Wed, 20 Apr 2022 18:43:58 -0400 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22B0633E16; Wed, 20 Apr 2022 15:40:47 -0700 (PDT) Received: (Authenticated sender: joao@overdrivepizza.com) by mail.gandi.net (Postfix) with ESMTPA id AA7401BF204; Wed, 20 Apr 2022 22:40:41 +0000 (UTC) MIME-Version: 1.0 Date: Wed, 20 Apr 2022 15:40:41 -0700 From: Joao Moreira To: Nick Desaulniers Cc: Josh Poimboeuf , hjl.tools@gmail.com, Fangrui Song , Peter Zijlstra , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, andrew.cooper3@citrix.com, keescook@chromium.org, samitolvanen@google.com, mark.rutland@arm.com, alyssa.milburn@linux.intel.com, gabriel.gomes@linux.intel.com, rick.p.edgecombe@intel.com Subject: Re: [RFC PATCH 00/11] Kernel FineIBT Support In-Reply-To: References: <20220420004241.2093-1-joao@overdrivepizza.com> <20220420074044.GC2731@worktop.programming.kicks-ass.net> <20220420151714.fderdz4dzea75rvg@treble> Message-ID: X-Sender: joao@overdrivepizza.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no 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 >> >> If FineIBT needs it, I could reconsider. But I think there's a strong >> case to be made that the linker should be doing that instead. > > That sounds reasonable to me (and reminds me of linker relaxation). > Joao, can you please work with Fangrui (LLD) and HJ (GNU binutils) to > determine how feasible this would be? I assume code outside the kernel > might enjoy such an optimization, too. When that's the case, then it > probably makes more sense to "upstream" such "optimizations" from the > kernel-specific objtool into the toolchains. Alright, these are the greenlights I was hoping for. I went quickly into this with HJ and he mentioned that it should be doable in the linker, and that he has a patch for it in gcc (for local function, from what I could see): https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590832.html If @Fangrui is fine with it, I would like to try implementing this myself in lld (I'm still learning a lot about lld and having an actual problem to solve is the kind of fuel I need). Should take me a while, but I think this is not urgent, right? I can also go ahead and replicate HJ's gcc patch into clang, so we can also handle the local functions within the compiler (I think this makes a lot of sense). Once we have these in, I'll revisit FineIBT and extend the features to handle the FineIBT instrumentation. Hopefully we'll be released from needing objtool (famous last words?!). This sounds like a plan, but I'm ofc open to suggestions or different ideas/plans. Tks, Joao