From patchwork Wed Jul 26 23:11:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 126573 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp745889vqo; Wed, 26 Jul 2023 17:16:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlGtlMADZQPQeHi0YMFnqv1EF+eVhVJssizBug08ntK7D0qtk4tsUBdG1sdmUbgxuBRb84Fl X-Received: by 2002:a05:6a00:1798:b0:653:de9a:d933 with SMTP id s24-20020a056a00179800b00653de9ad933mr4277286pfg.17.1690416975548; Wed, 26 Jul 2023 17:16:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690416975; cv=none; d=google.com; s=arc-20160816; b=LRg2RApaJTkQpHzkx01vKUFeubf13En86YN/EnAx+ME7rcWHQEdm4QD23+FFYoZdL6 xkGUrBCiNPdFHrDMMDuiv4ELggaPsaWWZ8gH9v2wGAN74Zwk/APGDKDHnATtnfza/Pti 3tgN5OR1IO9eKjHEbwPF9j8JvkuZ0zwDARYztNyRbMe1lx5Lmb4pdH7hRmi6RkjjNbsu J/oy7ZObfFMgYPrUh2l8LlikgR9N0qtyTjdT6BZyVEIeIbcGGXszCJ6txaIvN4xDuAMG uBQZoEcn/CjL3wW1Ll7fwZUJLadEP3bSsBP5kqVZSlUHcvVkvzxj2Pt+sAV23CuT9ffc KNyA== 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=r4jdfUVTE7WBKRvJpfj2d5OTzyL4Pf20Sw0o+vzmWQg=; fh=Ub2eiQPjDYliWtR+kp0H7uWnxJeEbWS1NbDli8oFijM=; b=MYvk6hvLf6to5aJ9JDyxN5RFtuv+G2f3Hg5HCMnP3/Yy7DGglakWPqyXeE7L9EHlXZ 0bkCCftw+GmsJnIKSiE2Cwr9BveC97HXzZULhrMXbLAuAH6DulyAZGzyyFmQqv93V37Y mSMLN7UuouU90i9TMyDkbB4a9zCHmw70fbo5UAB+yk/y1zIfGkkMTSiO4oChsCKvJqeq g575LHb4m9nqw8jCGeZ9WVUcv7sJpaXXBqM7aqyZrcP2fx1r8ldjO8umaAIJPzBqQnT0 kVH8NRuOE/RLyceoVw1A1MuH5y9EIsPOv8n9wTcl2kLfhfmj8IMZ4J+ili7BGv9llnlf v0zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="cWEM4cw/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w67-20020a636246000000b0055badd6d2d4si148014pgb.414.2023.07.26.17.16.01; Wed, 26 Jul 2023 17:16:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="cWEM4cw/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230355AbjGZXLu (ORCPT + 99 others); Wed, 26 Jul 2023 19:11:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229896AbjGZXLs (ORCPT ); Wed, 26 Jul 2023 19:11:48 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 844F51FC4 for ; Wed, 26 Jul 2023 16:11:46 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1bb2468257fso2296745ad.0 for ; Wed, 26 Jul 2023 16:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1690413106; x=1691017906; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=r4jdfUVTE7WBKRvJpfj2d5OTzyL4Pf20Sw0o+vzmWQg=; b=cWEM4cw/Xmvw/Yc4U7z6EZydB4+ARQlb9npX06puzQ8ttDgkdjkLDLzoPXiRYyO1Dc /WllWfsJwr4GdgXe+YaoqU38sCxEm2l1Zikmsb8G2cVdoF/6xfyjMS/+FISKFdO/zoHp JJ/jVwdqi8Mz+WxcTEieLsTvVJsQPtnbc/Oe8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690413106; x=1691017906; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=r4jdfUVTE7WBKRvJpfj2d5OTzyL4Pf20Sw0o+vzmWQg=; b=IW8qP86AGBjGBG5WdkZwmJFZ0XUGRII+farfdvF8uAf11Vdbj4QiofilzEavEFxSDN wHE2KwBJhpVBQ40ETzxu4ePhd2wfY17VpqoXcAwK8E79u39WAV9/2cYwNW2qAX7wx55a mZH0bHpB/sHiLMGAM3Tl9g+powG9o5M/8Umlm29StZq3a08jlF/uv3EFOKrzThxF5hxH E66F7UqFXT9TkV9Ej0i3uh7j8FpnN+FD1BvMC1IybPFwjadcA0Cz4Yok9JH6uT/2pBsq ePpSb8PTOxUwGfIL0DDHC8/dYnpw2qgIsVhjjt7M0sS2cptuz5nAPI9A2mVkaBWKs2W5 PtHg== X-Gm-Message-State: ABy/qLZHQV+5MjqiNmfnkK+bVYt9r4r8YgCc3ENJG+AH31r2Xkyha5+A BQ0zCDDTaxqYQ2DXA7PiOYcifw== X-Received: by 2002:a17:902:f545:b0:1bb:a367:a70 with SMTP id h5-20020a170902f54500b001bba3670a70mr2634155plf.17.1690413105998; Wed, 26 Jul 2023 16:11:45 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id 17-20020a170902e9d100b001bb9883714dsm82329plk.143.2023.07.26.16.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 16:11:45 -0700 (PDT) From: Kees Cook To: Juergen Gross Cc: Kees Cook , kernel test robot , Peter Zijlstra , Sami Tolvanen , Nathan Chancellor , Ajay Kaher , Alexey Makhalov , VMware PV-Drivers Reviewers , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, x86@kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: [PATCH] x86/paravirt: Fix tlb_remove_table function callback prototype warning Date: Wed, 26 Jul 2023 16:11:43 -0700 Message-Id: <20230726231139.never.601-kees@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2323; i=keescook@chromium.org; h=from:subject:message-id; bh=LqLAiBHCS3SOIFmrkPyUKr3/p9LAy4Na2qeKgbyRhrI=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBkwagvwZ+7zZjxcV7wmzqScO6yy6gJ+KlcGXU/K mS4h3RYHdSJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZMGoLwAKCRCJcvTf3G3A JhbOD/9dxIW8nQqK8eLsN8DjarrXXo2MbTowMSbdqTmppURh3d8EQCiVCszUdxoaRUHvFmiKUwD D86KLX1tiSS5FlmX4ehFA5HpFl8hytrIv6LOuRxqCpKGC2bBI/G9LV1VsezmZIaynIqq33TTzSb 109A2v1VaTm7/xkCakSz3YP1bb54E0aaHp1s8DpDiDQd0TyfFi/M8mdGqi/obyPLhg8JG+rijen upCg0o3/Ein1HDCtKa6opIYvNATV0grvRApCnAIctGb9+8SFY2a0OfcJKvkl6PzUSboTIYJGhUj BouFli9hesufXioK68mpt9jpJN8jbgriMKaxEWrFmMQFplcKDGpsF1mCidFz+XzJYoBc9JHktUb 6MkSAssX4OZC+kqJ6DLNqCWg5au02WpdbEhCtzMlZm79xenUBUIgOEulsIrUSqjm1Cs2q5ovoJl OOrOyA0ckQKVx+JXSgwDfog4rCyllA0sD2ui31ftHyETeH8MPOr6t45gSN/h6rtv3lNCmlbPuLp zwt96o1ZirQgD3U2/AVclaSoqcS7bsL22skLip02dZ0Zx4mVqTxfueAigIzDiB79B6dz+3V4E5J ypR9j+96fTzo6acv0GLam7/8ORNyRhm10PhPoup2PKCgVqq2FuhihR9cmInkFlclyfcxbFFHNBh 00lNaL4 PSbWXsTQ== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772530670488816553 X-GMAIL-MSGID: 1772530670488816553 Under W=1, this warning is visible in Clang 16 and newer: arch/x86/kernel/paravirt.c:337:4: warning: cast from 'void (*)(struct mmu_gather *, struct page *)' to 'void (*)(struct mmu_gather *, void *)' converts to incompatible function type [-Wcast-function-type-strict] (void (*)(struct mmu_gather *, void *))tlb_remove_page, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Add a direct wrapper instead, which will make this warning (and potential KCFI failures) go away. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202307260332.pJntWR6o-lkp@intel.com/ Cc: Juergen Gross Cc: Peter Zijlstra Cc: Sami Tolvanen Cc: Nathan Chancellor Cc: Ajay Kaher Cc: Alexey Makhalov Cc: VMware PV-Drivers Reviewers Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: virtualization@lists.linux-foundation.org Signed-off-by: Kees Cook Reviewed-by: Juergen Gross --- arch/x86/kernel/paravirt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index ac10b46c5832..23d4d7114473 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c @@ -79,6 +79,11 @@ void __init native_pv_lock_init(void) static_branch_disable(&virt_spin_lock_key); } +static void native_tlb_remove_table(struct mmu_gather *tlb, void *table) +{ + tlb_remove_page(tlb, table); +} + unsigned int paravirt_patch(u8 type, void *insn_buff, unsigned long addr, unsigned int len) { @@ -295,8 +300,7 @@ struct paravirt_patch_template pv_ops = { .mmu.flush_tlb_kernel = native_flush_tlb_global, .mmu.flush_tlb_one_user = native_flush_tlb_one_user, .mmu.flush_tlb_multi = native_flush_tlb_multi, - .mmu.tlb_remove_table = - (void (*)(struct mmu_gather *, void *))tlb_remove_page, + .mmu.tlb_remove_table = native_tlb_remove_table, .mmu.exit_mmap = paravirt_nop, .mmu.notify_page_enc_status_changed = paravirt_nop,