Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp210192pxf; Wed, 24 Mar 2021 03:17:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLgp9TSz06gKmOrTGW8aB4Pgreu/jfvZytQFCWqrRzCAtLSTjiVoK/+DKe9vxKmyuaTkGw X-Received: by 2002:a17:907:94c3:: with SMTP id dn3mr2865127ejc.280.1616581056424; Wed, 24 Mar 2021 03:17:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616581056; cv=none; d=google.com; s=arc-20160816; b=lVzzIf7iWQcBI2Vh0VTUtyfEgzHzIZUAxDY/+pBJNiOos0ZdbZmuc7dn4W116jo7vk 3JBH2PGcG/WI22HEDJPEBbGQi9jv4VQL9QjT7wY+Cq2Lw75IxD98EiohG2ELz5zROMQJ 3XKch+4O8tSNrUiC8FF4NQ3WUJo/Ts/nieROq6tRDYWy6hphy1H6hZ6w78bVVRioJisr f9s2Z0Y0cVxUfG1AM7jgz8eg9O4fdi5XGXPYBVYIR9UKN8at0vOYscEf4QXi9dYPG8tC sUjW0EHyhSwZhy4pxF986Ce42pFUQZcEV/0K3yYMiQnPCqCilo7UMsi1SYGWmv+VQNQx iUCQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WZNXlX3eOEcZWcovU9zwR1I2oqNzGrOjWZWd75LU5ZE=; b=BCouCnvD3MgU//4W+PUMD7TucyS87dD662g/PPZdpF71j4sf17mzVOF0ZH4JtMYPu7 NTvA8pVUj987xJxjA54SoH2F8cilhjumzxTL4IprTXJLHlXk5ul7FSCF2h00kHlTFgJC ontRTKwSU3Y+67azpKg2HWH82VBOSwBc5I3XDfcnH+PEVfRisNU3uqnH8Twf0ApNuUfS tP0bXFr/iqocHKB7uAV81XsxqoSGLIyqDABmxWGn9M6VidSfCfn+nKXBWi4NiRVN4rtO uP83re6PRjTnIJIXMTyHPEwC5pOPJ5y7TlJdGhg4mV67JGmF9ogMJv7ley2XPRkCaJ6q H5YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=dkGd8++7; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ku22si1445031ejc.704.2021.03.24.03.17.13; Wed, 24 Mar 2021 03:17:36 -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=@infradead.org header.s=casper.20170209 header.b=dkGd8++7; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235732AbhCXHPW (ORCPT + 99 others); Wed, 24 Mar 2021 03:15:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231455AbhCXHPO (ORCPT ); Wed, 24 Mar 2021 03:15:14 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4680AC061763; Wed, 24 Mar 2021 00:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=WZNXlX3eOEcZWcovU9zwR1I2oqNzGrOjWZWd75LU5ZE=; b=dkGd8++747v3h/hYgkBJiJdwk5 PWwJAEoFe4SEvtib+PWo8O1uHz83djehIMQSdnlmb1REGO5EV+ai1XfGZioyH8Ql1EhLRkR5p2ZnG 1pkAuvYWEkKMLqDvjStL4l9A78QhLzRsPKxflpkfjhZ2hPNag18sMT1dpjWG2WWE+Uc0BBQ/s4dBy 6o1fFxinChsqDoPC9wz4p5NvxQWN+AGPjQkubFEVBSKNdmvEPii7GNy/yM3eT1P9iSLUd2Wy8Rhod prA0XCpf7vR/OA/R9UVZ9PZsy/YnOuA17GWykOo2KsrhKISaP/P7KLnX9JfhPBfXzaEy9Ohhktqgn wAvphNNA==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lOxiH-00B54e-77; Wed, 24 Mar 2021 07:14:16 +0000 Date: Wed, 24 Mar 2021 07:13:57 +0000 From: Christoph Hellwig To: Sami Tolvanen 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@vger.kernel.org, linux-hardening@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 03/17] mm: add generic __va_function and __pa_function macros Message-ID: <20210324071357.GB2639075@infradead.org> References: <20210323203946.2159693-1-samitolvanen@google.com> <20210323203946.2159693-4-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210323203946.2159693-4-samitolvanen@google.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 23, 2021 at 01:39:32PM -0700, Sami Tolvanen wrote: > With CONFIG_CFI_CLANG, the compiler replaces function addresses > in instrumented C code with jump table addresses. This means that > __pa_symbol(function) returns the physical address of the jump table > entry instead of the actual function, which may not work as the jump > table code will immediately jump to a virtual address that may not be > mapped. > > To avoid this address space confusion, this change adds generic > definitions for __va_function and __pa_function, which architectures > that support CFI can override. The typical implementation of the > __va_function macro would use inline assembly to take the function > address, which avoids compiler instrumentation. I think these helper are sensible, but shouldn't they have somewhat less arcane names and proper documentation?