Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp871881pxf; Thu, 25 Mar 2021 16:29:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbQ2O2jMExTEW6JMiJ3ra8PT+zWmS5cKJ24FFU2BdGedr/PUTVNmUBGVRIQ6kFmJiCkYBL X-Received: by 2002:a17:906:16ca:: with SMTP id t10mr12458836ejd.85.1616714992005; Thu, 25 Mar 2021 16:29:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616714991; cv=none; d=google.com; s=arc-20160816; b=A3lxRvN8lLX3hHtyPJFU13Up1C7fVasfKOJK30UZHFt64T0dtWl8fuZkeojjszoQnm 5Pj9TvMeAQRGGDzno8hQbUN5M5yE5SHiCdh3k8qM56DMEZH29p9kdlkKXAPd/XmgNoAJ k1bwlT968mN3LbrzAGanqMzFogm6Ty8oGGyfYCceoZnP7U3wOsZkQLU0wiP9FgyWYava ET+eQNM8m6lg2i+Rjc8QsldpfngH6jscWFL4xpfQrJIMw/6ZiNsvRvIwFeOBcycATDt3 QGIJt8U4sKUkplURXMTaEUz62wJ9015uo74VOyjj+YBEY2Ntlg0AdUq3l+nfNegM0u4d NC0A== 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=sMIbLViyZj8/HlFK24+Kb6qHIJjqUM2GzqLOFEtB9oc=; b=m9bmDMkQ0GqA/S2S7HRidd5IWLoCymzGpDKxaQpwg4aCUFmlDGd/i85/KnOY609mva FQ7G3Mo1HMG+MgH6SYTsyLvP8qmauttM+6RXsHe7hMBcKcePeZFIBZU+501bia9x5xy5 cT8S85oxSZ1fOs0sMOzgFEOtXjlcDHDF+zDnrELWNrBb1a4cMmQGjlsZYjDEZpmYolMr p7DSTiU6GFyYl7wO9YdH2jmyf78naNfNZC8XUGANaD3rokxG1RYK9QQEX2kvBmAXEgI/ lbS+g+SomrCCaRW4wkq4JDyU2L2ULtgMvu/iV58NREinul2KkrrJgdwA+4wBXsx9AFwi 2/dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=L88zRiGV; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i26si7397034edb.84.2021.03.25.16.29.29; Thu, 25 Mar 2021 16:29:51 -0700 (PDT) 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=@google.com header.s=20161025 header.b=L88zRiGV; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231264AbhCYX2d (ORCPT + 99 others); Thu, 25 Mar 2021 19:28:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231191AbhCYX2F (ORCPT ); Thu, 25 Mar 2021 19:28:05 -0400 Received: from mail-vs1-xe32.google.com (mail-vs1-xe32.google.com [IPv6:2607:f8b0:4864:20::e32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D756C06175F for ; Thu, 25 Mar 2021 16:28:04 -0700 (PDT) Received: by mail-vs1-xe32.google.com with SMTP id e13so1812608vsl.5 for ; Thu, 25 Mar 2021 16:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sMIbLViyZj8/HlFK24+Kb6qHIJjqUM2GzqLOFEtB9oc=; b=L88zRiGVrc72dQhmDgR/gl8qiK4rX7wM+JKPd8gbrtbUdlgOq2qWt3hK/quHaVP65Z bO4L3tHQpHfPaRVNRTTnhWNEDjMxu1A8FIfWK6N3BgKWI7s/X8tWJ8JR/RN2kkJVQhtS s0kCqEIXJIfEpxWuw2lb+ancWufqeGs6cNlvu5zr1OPdoN77VELBfuVwv2098G1gVR1W qLssJpMKWs+sQI35oQtwqkRZkSmOqgSPEwWfmGUGgOs/3NzBSWZ7JE5XtmxzVrvSmrTS gbGr91kGamtH5beo2ZAoGW55Z6UpbyOfe0e7CVs3RKgb/23UoHpUO9eD2rAPuR6LB0Lr b6JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sMIbLViyZj8/HlFK24+Kb6qHIJjqUM2GzqLOFEtB9oc=; b=SmQVIgNt7AFsdYobtGGyPDM3UXYNGwrrH7g6G2KBSmOILHqAWWANY/nw4BNctFO36o ZvEE1nU5wwqdJAMR1PujtIx1deViCWz5q7zSrk2NRN27GXLKsYv2gdnmitQfaydlYkku fvbgTfqvtYxv6gAPh9enJrQWVqn4OoI6ZE9hfhhC9dJ0pjUB/V0LPpXahePhDFDGXCLs bK65KPMQEITnWT3YNGNUJrgS6nTc2vZ099cwA2q8HVYB6Ej439ua8eKVS+GpB30DyCM6 8fPI+mS2IqesmmD1/UgFQNc2rqEqSXs8gUo9lm5n1+4UtOmg91T+eb+6RQx6WqgrAYUR bX9w== X-Gm-Message-State: AOAM532E6Et0MXSq99S6DyOWpYky60rZXN3O2iFxkD9u+OGlbqbH6/sj q+Ir/RGoxyUM+Eeh/JKwzTUK+JnQndtlfRC3BKtvGQ== X-Received: by 2002:a05:6102:a49:: with SMTP id i9mr6830290vss.14.1616714882733; Thu, 25 Mar 2021 16:28:02 -0700 (PDT) MIME-Version: 1.0 References: <20210323203946.2159693-1-samitolvanen@google.com> <20210323203946.2159693-13-samitolvanen@google.com> <20210325103757.GD36570@C02TD0UTHF1T.local> In-Reply-To: <20210325103757.GD36570@C02TD0UTHF1T.local> From: Sami Tolvanen Date: Thu, 25 Mar 2021 16:27:51 -0700 Message-ID: Subject: Re: [PATCH v3 12/17] arm64: implement __va_function To: Mark Rutland , Peter Collingbourne Cc: Kees Cook , Nathan Chancellor , Nick Desaulniers , Masahiro Yamada , Will Deacon , Jessica Yu , Arnd Bergmann , Tejun Heo , "Paul E. McKenney" , Christoph Hellwig , Peter Zijlstra , bpf , linux-hardening@vger.kernel.org, linux-arch , linux-arm-kernel , linux-kbuild , PCI , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 25, 2021 at 3:38 AM Mark Rutland wrote: > > On Tue, Mar 23, 2021 at 01:39:41PM -0700, Sami Tolvanen wrote: > > With CONFIG_CFI_CLANG, the compiler replaces function addresses in > > instrumented C code with jump table addresses. This change implements > > the __va_function() macro, which returns the actual function address > > instead. > > > > Signed-off-by: Sami Tolvanen > > Reviewed-by: Kees Cook > > Is there really no attribute or builtin that can be used to do this > without assembly? I don't think the compiler currently offers anything that could help us here. Peter, can you think of another way to avoid the function address to jump table address conversion with -fno-sanitize-cfi-canonical-jump-tables? > IIUC from other patches the symbol tables will contain the "real" > non-cfi entry points (unless we explciitly asked to make the jump table > address canonical), so AFAICT here the compiler should have all the > necessary information to generate either the CFI or non-CFI entry point > addresses, even if it doesn't expose an interface for that today. > > It'd be a lot nicer if we could get the compiler to do this for us. I agree, that would be quite useful in the kernel. Sami