Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp875328pxf; Thu, 1 Apr 2021 16:34:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwA3oLJHiAf3sNtFdU+2Eicb81ITl03KUGLetJ56mxzFbCKZ3pzT37T6/lSffQ++a31pkJW X-Received: by 2002:a17:906:7c57:: with SMTP id g23mr11299308ejp.195.1617320067489; Thu, 01 Apr 2021 16:34:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617320067; cv=none; d=google.com; s=arc-20160816; b=I+uO4f8IaxyGFIDzHDZwGAd2ndMaV7dSuFdN/cfseT7bOcM1rD6/GWd3ViMmkSBF8H 37J7TxHj2FEC4AbHfMABAYrXYYhdbHMsmavhWJRgJKuRGQX8WW+H6AddvlC//8sEDmPl +r0anH8ymTaH4mMOpgUZnOFntqKeArbToYsBZ9tqgdzcn7YJx5AcyKzIRDmjv2VuJM3F +yBCzpcU8nTWGLtUg//eeUdtS56Cg5E+VmBHtyUUoP2u7X0p4qnePB60ELef1y0wkM0r UaBRnnFMkbv3QLYPymEYNdvsIHSgt0Uo3C0334pFgbTnqmjegNKkUR9QCnFxCvXOsh/5 igOw== 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=ygu6iZbbUsR2ZKi8zr0iQyDyVVNKo7dHAEFjMtj8SHY=; b=GthmIzR19u0XKgZQNTBO0uhy6V8TB5eRr+E3ElqerFV31xj99AuClj5yQ0r2c/o7+R o8svRLwQhX/+qshme3cECkib0gGXJI3yeZTkD6AzgxFOlPYLpQCpei+KaAO6wQkRHCEf SPZbe8SS4s7TtrY+073aBuEp4UuTDNBf7oCU4haVt61tbyb7xlKy8/c61Ad8UGppKBDl u1rrvBQ/NJac/XTuCtmZthQ8mre5vFEXJlDltzTjyrbPM8tVxE5cQmxo0iZPGDT4BDSO dJB55ZwGc1hxW2OkwTYSs2K7gJ4foQ7AkEUy2KWmtm/aieD3rRqAE2FNWzB/VlPVVWTv G8cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cVUYELPk; 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 g24si4935623ejw.478.2021.04.01.16.34.04; Thu, 01 Apr 2021 16:34:27 -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=cVUYELPk; 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 S236269AbhDAXdI (ORCPT + 99 others); Thu, 1 Apr 2021 19:33:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236279AbhDAXct (ORCPT ); Thu, 1 Apr 2021 19:32:49 -0400 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D225C0613BA for ; Thu, 1 Apr 2021 16:32:35 -0700 (PDT) Received: by mail-pf1-x44a.google.com with SMTP id g6so4243922pfo.2 for ; Thu, 01 Apr 2021 16:32:35 -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=ygu6iZbbUsR2ZKi8zr0iQyDyVVNKo7dHAEFjMtj8SHY=; b=cVUYELPkwyakQO4gpJ1n7nG1A7rYRu+EIAysLbBiPdUejJzOzMX96EChrBRzMBh6zW x0dx0cW3zE0Wop2s4iCPSYOfpp1cHt4q/JDYejpAPuJ5EaZ0LDn1eQc/EZSSQ+JcI/Ep aSzshOkORkt5as8iBp+LK+0GHTFWu6E+X7Dt6fjBCwDhmMdVOEg0cYoWse5r7hWwupSI GIMWTyJUk2Pdk4jDTUiSZMOsvnGKcBr86YBHhdMz5J55XRKRhzQZzbLI8+1/ECst6qrD FS5MXyt1H5ODIdkNU7FRNKO5mEHgSlK1RJwyJk198zwyxxkaAm68PyCFKSZaJgsbK+DZ 4xrg== 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=ygu6iZbbUsR2ZKi8zr0iQyDyVVNKo7dHAEFjMtj8SHY=; b=YQ1VinR1QXBDItksqtZzmFo77lIdNQzzIV4vHN3hY+JtX6qv/FHolPN7aCxAB+X5CR HLWTK4NQQ8KsRRgqdM6tTEUQGBFJ55ALi6h2X2kiK7sIjf73LOrsaxs3or4zoLWOD6Le rUWqQ4a7eZCTNXF0Xgphl1nSX4gZFriJrki97dz1mrS2qZFCMY0VcjJQA+zbRrdTRVCK 9HeADnSVFj67o9dz3lH1KEn3jQrQaxbm5xCr8JM1aSZJsF0VIBJozGK5CaFLNDC1N37u xMelFp60EZ55DY7vVJahM1h7MAo7E6DFGvr+nXJH9JwKqSnIxn7nMIVq75FgB66dMhy/ QzzQ== X-Gm-Message-State: AOAM5337TMiFbwM5MDpvn1g+LCCCfEe+ppQBkzLSIRO5SAnjtUxJIoSs J75HwIBkz/zd1ellBob0tO19f/QNkrYm8wijrD0= X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:4cd1:da86:e91b:70b4]) (user=samitolvanen job=sendgmr) by 2002:a17:902:9008:b029:e6:f37a:2183 with SMTP id a8-20020a1709029008b02900e6f37a2183mr10163478plp.49.1617319955033; Thu, 01 Apr 2021 16:32:35 -0700 (PDT) Date: Thu, 1 Apr 2021 16:32:06 -0700 In-Reply-To: <20210401233216.2540591-1-samitolvanen@google.com> Message-Id: <20210401233216.2540591-9-samitolvanen@google.com> Mime-Version: 1.0 References: <20210401233216.2540591-1-samitolvanen@google.com> X-Mailer: git-send-email 2.31.0.208.g409f899ff0-goog Subject: [PATCH v5 08/18] bpf: disable CFI in dispatcher functions 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 , Sedat Dilek , Mark Rutland , Catalin Marinas , 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, clang-built-linux@googlegroups.com, Sami Tolvanen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org BPF dispatcher functions are patched at runtime to perform direct instead of indirect calls. Disable CFI for the dispatcher functions to avoid conflicts. Signed-off-by: Sami Tolvanen Reviewed-by: Kees Cook --- include/linux/bpf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 3625f019767d..2f46f98479e1 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -650,7 +650,7 @@ struct bpf_dispatcher { struct bpf_ksym ksym; }; -static __always_inline unsigned int bpf_dispatcher_nop_func( +static __always_inline __nocfi unsigned int bpf_dispatcher_nop_func( const void *ctx, const struct bpf_insn *insnsi, unsigned int (*bpf_func)(const void *, @@ -678,7 +678,7 @@ void bpf_trampoline_put(struct bpf_trampoline *tr); } #define DEFINE_BPF_DISPATCHER(name) \ - noinline unsigned int bpf_dispatcher_##name##_func( \ + noinline __nocfi unsigned int bpf_dispatcher_##name##_func( \ const void *ctx, \ const struct bpf_insn *insnsi, \ unsigned int (*bpf_func)(const void *, \ -- 2.31.0.208.g409f899ff0-goog