Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4559143pxf; Tue, 23 Mar 2021 13:43:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvSX6qm1x3AlRhgtNF6mUZGvrEd2Q8iFWIDsUEagVcriWCHEXSu88KYagb38+3mWml15Eh X-Received: by 2002:a17:907:10c1:: with SMTP id rv1mr55408ejb.5.1616532226913; Tue, 23 Mar 2021 13:43:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616532226; cv=none; d=google.com; s=arc-20160816; b=tc/Muk2pcpO8wZNwNFLSPM5f5SJqmtoI1zhZoLynMVMBjb7n5/hNaYMLvaDLV3oGkP zW1CsSdjGQ91lnMM6/WVJgJJOE/8ZXcx1Hff/9Y1ofxj63CSE+aFirij/pud60fFc7ia 61OuuGazLC6rdE83JaHAdEnj/Apu7ZZ44Et5rFdTtjQP9QNtw1GQ00N7DEAL320FW2a/ bBs4PTvcJRnxPET/jJg6LUMslvIdwhZlVNnvypKLGgJL400sdLIkEmhzZxGDq0qDVAjv esV/66H8prgY3ZP5N2WBzrptroFJqcO+ZqY90oNpXUQPZLZ9y0xRuTMca+QMy3/+frMl KUpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=qAbADIQAzXUoq/ElYpa9rjjQHxphEP8wPywcql//gEU=; b=VbdfxFJh654jpBE+/QyIy2uH+eUCNIvhz2BfTA/E3UA8+S5X1l+f/V4xSzOJC9K4kC ING8997ShxVZotdoe2hsrwolAScwLAwzGKsr97fLbxGWLomSdUezKD+Fl4ImnWh7EFHW NVTuTOpGJ+VYLmKtXAhrS0weFkMVWpBjEpYuAhU+PK2ZXf5UNsP91+nWbMMqv26kdsB2 9zZQizl9yQ6c1ixkFSIBcIMbBLwL25CcPnJa3av6qUgTD30ySZpxXvzoBQ+0JSbinX0D GE2PkdGy0y02dyhIPwWa+iHbKAKA+AnjuTNaWhoF5jxrSpW4T4+3rTurrfIlHYys98p+ 8Y7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=T9lYeG1v; 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 d5si78123ejt.487.2021.03.23.13.43.23; Tue, 23 Mar 2021 13:43:46 -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=T9lYeG1v; 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 S233640AbhCWUlO (ORCPT + 99 others); Tue, 23 Mar 2021 16:41:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233568AbhCWUkR (ORCPT ); Tue, 23 Mar 2021 16:40:17 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 527E4C0613DF for ; Tue, 23 Mar 2021 13:40:17 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 6so3849026ybq.7 for ; Tue, 23 Mar 2021 13:40:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=qAbADIQAzXUoq/ElYpa9rjjQHxphEP8wPywcql//gEU=; b=T9lYeG1vNkvikIi777MRSbbTtj3IaPeu7RN7uXeSPXvS4b9+WLGfOdasWEAHo+i17u 3080AmXMs2xVaLte8P7ahk8JJEdHsGELqvOLIoahy4V4PMsoqaf2aZV65W6Qbg5iWS+h b6ti/m6+OZ84hMZziyoN5GFocxb13Za6OwHGFrBaUy1iO+H9JEiP0tyCwkF3p/KzGz5a KI2Lj51XAl8PJy62wWStBc6KSEOp8id1hQ564UGK3S0iIjj4kUsIubPJjw5De4OUhc9s huAxEcZhyUcc7CzcBmMkKd6YmZw4qc0E+2UxOVGGUsXyQLc3FPDMC5xWzijn66SgJ0Xs vHJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=qAbADIQAzXUoq/ElYpa9rjjQHxphEP8wPywcql//gEU=; b=iXWhImn7vpl8EkNaePKFXgwzt7GXyd5sk/GcVzHbgnLAVS3mW9w1ZHPMZ1FlVclSB9 wl688r9z76zCG5T+GyrKtKLRAPqTD2VyFwZIlDd3qwq7jr/JsrUENjpq+NyOB8Xle8ZR uYkcIpc/llswjvedXsWCjsbb1riJt0CkDX5+yIrYR2ARHiAjquZm/4dO/wlE7JL/nYH4 6N5OXXtZasu3OuXuRMemOlQu3OPvla4piT6O4tRhJzlEcHmSEcWWg+jRC7y8N5CCkGtk EnAXGnIhXwL4pcF81rXFa2EWxFrRnmddM3yk+ixanRG5f+qSofenHvE+3m+PWsPdUk3J OPrg== X-Gm-Message-State: AOAM531N6nlYomn+Mfwjt6vyVY1/TpgpelRak3Cy44C8jte84ZsGHs9D WdArzKh3fqBluC0vlSmEYuMgOkxuyx2H8K9jDjM= X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:e9a3:260d:763b:67dc]) (user=samitolvanen job=sendgmr) by 2002:a25:3493:: with SMTP id b141mr100244yba.342.1616532016542; Tue, 23 Mar 2021 13:40:16 -0700 (PDT) Date: Tue, 23 Mar 2021 13:39:44 -0700 In-Reply-To: <20210323203946.2159693-1-samitolvanen@google.com> Message-Id: <20210323203946.2159693-16-samitolvanen@google.com> Mime-Version: 1.0 References: <20210323203946.2159693-1-samitolvanen@google.com> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog Subject: [PATCH v3 15/17] arm64: add __nocfi to __apply_alternatives From: Sami Tolvanen To: Kees Cook Cc: 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, Sami Tolvanen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org __apply_alternatives makes indirect calls to functions whose address is taken in assembly code using the alternative_cb macro. With non-canonical CFI, the compiler won't replace these function references with the jump table addresses, which trips CFI. Disable CFI checking in the function to work around the issue. Signed-off-by: Sami Tolvanen Reviewed-by: Kees Cook --- arch/arm64/kernel/alternative.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c index 1184c44ea2c7..abc84636af07 100644 --- a/arch/arm64/kernel/alternative.c +++ b/arch/arm64/kernel/alternative.c @@ -133,8 +133,8 @@ static void clean_dcache_range_nopatch(u64 start, u64 end) } while (cur += d_size, cur < end); } -static void __apply_alternatives(void *alt_region, bool is_module, - unsigned long *feature_mask) +static void __nocfi __apply_alternatives(void *alt_region, bool is_module, + unsigned long *feature_mask) { struct alt_instr *alt; struct alt_region *region = alt_region; -- 2.31.0.291.g576ba9dcdaf-goog