Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4200149pxb; Mon, 27 Sep 2021 11:28:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAmiOGJelbJ73gOy0udtQQ5jyPSXt2V0dTyN1hKzlM8kEIEKQi2ak3IoPJ0oRzjMCZkphC X-Received: by 2002:a05:6a00:216f:b0:44b:6212:4967 with SMTP id r15-20020a056a00216f00b0044b62124967mr1310746pff.23.1632767292279; Mon, 27 Sep 2021 11:28:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632767292; cv=none; d=google.com; s=arc-20160816; b=Ms4NizYX5229u7Cjmam0wvus8iQ6vHSfRY9l65fUJs71+ZLPTLut8kR/6qn5QEuc/F bDGWxz+b/LXJlRMCIO3YoRhvdAHMV0GwBHoYToIQp5dbJ39rGsC2JryRj55Xe2/BAB16 N8lYEbVit0ayuPB5+QCO6NUxehQjUPxxP6DUFNrT8SkRzogEl8aubkRdL4Tb1f6+TS21 Mh4PcdgiZ3tDhgzBX0/w5a/8JIgWKBUrCCLFVvujBUj0ix92294ydsxwvVcYBH63DsRZ vKDNgNSOEd/9OEpVu5SUVsSz6shyx+dz1+tYGB0T1nYSJZa9cltkJvD4//gAga6uf4FA DfuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=cqZ/haXgFjIpSJHfI1VAsLg6naAL8kq0nI4pUX8OICI=; b=mo6qEiXbiqW7wzFj9qS+/hyyCu7cEXXMsDlkztiB2+KA2huI7nv7rZGJYc60HT/5Tm loht1XEGXhR2al4wKKP/7CF4K8rVMXi+DcpWfCO/f0b3Ywwj+WyPzRItXxVQqc3TXJdi T1nk584G2FHtaf5YCN74M/kgrKd5SOnHfspioH3QoVqXShWzcH9QQ7Ak+ZjgeqlEL9Go Vmcb94qm7NkR8JIA/TJskF6uYwiWezYcvpdhqXFHrb4AnTdpv2lYKihqL5qGtaL9A8cL pI6lnuXnWGQn7NN2vxhGc9tzBnciba+S/UhnHTZxWuxY+RwRUi1WlWLoxA26S2JuuRBP PXKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Ae/GnkZx"; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a10si22196599pll.352.2021.09.27.11.27.59; Mon, 27 Sep 2021 11:28:12 -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=@chromium.org header.s=google header.b="Ae/GnkZx"; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235991AbhI0S2m (ORCPT + 99 others); Mon, 27 Sep 2021 14:28:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236011AbhI0S2m (ORCPT ); Mon, 27 Sep 2021 14:28:42 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16947C061604 for ; Mon, 27 Sep 2021 11:27:03 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id d4-20020a17090ad98400b0019ece228690so4362221pjv.5 for ; Mon, 27 Sep 2021 11:27:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cqZ/haXgFjIpSJHfI1VAsLg6naAL8kq0nI4pUX8OICI=; b=Ae/GnkZxx3AzOrnhpyQniuKHJ0wlNZWBFXL/PP1m5XyrATkGpzSqE3Uq9DuDZcHqBT 3/7Pw6GZqWYV5lFyBe6YWzOm62BJxOQ1gbk2uXzktlBWHR6jSykmBSNWR3rHP9Q44Ws4 uBBuE2m75g5Q8oX4OZxMmO0/NIOGZwIvpfmq4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cqZ/haXgFjIpSJHfI1VAsLg6naAL8kq0nI4pUX8OICI=; b=yZ+sVTC9CPZSiUbO6ATUrnq8zvGwykU4XAOFEwQWrLfnYc6mKINklcpd7doe3I85FA AmduEC7xVNhwz+shbK1JlnmU9wsMajbbLsknDJNUY2NSR9xJKa0n+fW94FvwAKMn6mv9 mY7iOe24lljbG+yByjuPjdtvZKMmFZvTasNfABCvx9Uf4s4UHE70RMG8FYfGQCIVXbNO lYN4kLn5s3Z3gb+Dh6yKDrnSsetgMEbAjE21inxcjbX2IqP1cDqag2+AkFRQK+y5NdHQ mzQ4o/5wBghCr/an+HIwK2pYqrDCHyLPR5Zc1z8lsoGc/Ct7pDCMZT84uAXoVNRylXwt 354Q== X-Gm-Message-State: AOAM531xQMTC8VH0TGHGUv1RfX9i87XSObzU/Q/fxIqm38E7f5S4gteq M9kXgm9nDMQJptr7MI/SlBk5Mw== X-Received: by 2002:a17:902:bd8d:b0:13a:8c8:a2b2 with SMTP id q13-20020a170902bd8d00b0013a08c8a2b2mr1103469pls.89.1632767223468; Mon, 27 Sep 2021 11:27:03 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id p26sm16995621pfw.137.2021.09.27.11.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Sep 2021 11:27:02 -0700 (PDT) From: Kees Cook To: Alexei Starovoitov Cc: Kees Cook , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH 0/2] bpf: Build with -Wcast-function-type Date: Mon, 27 Sep 2021 11:26:58 -0700 Message-Id: <20210927182700.2980499-1-keescook@chromium.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=813; h=from:subject; bh=MnT3y2POoh9krBGr+oM0LKIH9K7M9hDNGXXQn9PnoRw=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBhUgzzvGdW82BhK8YP1w6/r5Vk4Bo4qJhhkmiN8oKK zuSXBkqJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYVIM8wAKCRCJcvTf3G3AJhHyD/ 92lm82tkG/wPJiioqfs+Kxaa88GuCYKYWWP/IpncLQxmww37DgGOH/Wl/oJrhtTcw8GZZpOoNH3sse 7rn2JRT4QSEt5CzLLoD05pa6ceTWKIjkJ/d/VXCqNv+AfWepP3FacdWj60HKye/chGORzdj39B1tvC v62lA+y14QDzdx/r3AZ9MVzrnNaQFo4toGxCBRp7MnHFxL/mEv4cgPPAjFTfouI8vjnDy9GxHwlWnC xRONH7W48GvmgxCCtQg8Xmj380nJ/j3EImlyRlV0GulKQE8HUggfHnCp0BhmGL+RnuYJgfcpRkeO8F xI5c1r+1N6SZdUoRpQeXoaXu06lnFVybmVEa2qQwbq8zB0lCmpWH4moHHvk2EJ6lejNPCr8Tqbhyz7 2Sfh9Wzdb0IwASUho4vpo8yC3j3Z1EglOYMbTnM0yfx9K8vVmDNfJAi07mlFimGY/El21EE+vEb0Bb ZWJEP5ZsVJoI2H+wJXoNMM1rYE9WVWNJlCakhG7SJKxKbe85sJ6Z0/bPeukf+StZP+PhGG9uYGsygG kTPKuc45qiVI4IKKLnwhHm4B8BAg8WqCGUqePAvbi0tIopgbzqU37XmEc07HeCiwfr70U+YuVMs2wD x8/ZL4nbwMj00/sy7GZ/kgYZFPRtsLQ2djb0/g0c0gZAzlD9lQHeSbx4nrmA== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, In order to keep ahead of cases in the kernel where Control Flow Integrity (CFI) may trip over function call casts, enabling -Wcast-function-type is helpful. To that end, replace BPF_CAST_CALL() as it triggers warnings with this option and is now one of the last places in the kernel in need of fixing. Thanks, -Kees Kees Cook (2): bpf: Replace "want address" users of BPF_CAST_CALL with BPF_CALL_IMM bpf: Replace callers of BPF_CAST_CALL with proper function typedef include/linux/bpf.h | 4 +++- include/linux/filter.h | 7 +++---- kernel/bpf/arraymap.c | 7 +++---- kernel/bpf/hashtab.c | 13 ++++++------- kernel/bpf/helpers.c | 5 ++--- kernel/bpf/verifier.c | 26 +++++++++----------------- 6 files changed, 26 insertions(+), 36 deletions(-) -- 2.30.2