Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1221142rwd; Thu, 25 May 2023 09:30:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4AvHvJ/4D92YRWH8ZeIqf5RQhVCc4Ti+QNMfishOdE5P2qBlQPsEE/wv+oEzeaUQ5mh3gJ X-Received: by 2002:a17:902:b40b:b0:1ac:6d4c:c265 with SMTP id x11-20020a170902b40b00b001ac6d4cc265mr1973378plr.28.1685032233500; Thu, 25 May 2023 09:30:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685032233; cv=none; d=google.com; s=arc-20160816; b=lrmDKr0ztcT3i6dHt2YuaAhfHu/EQkBZNL31dqYvbtiLwSvG5q+07nfb9t0xpUvp0D Q6s+UiQaAEudZrUSf9jZ5zeoHvLqnpjc1WMKWJ6X9BsXm2sXQ+sacSy6kkLpjCB3fVpv BpwOFBsq8iM5MlPquT9mR4D/fnR7dK8x+NTX0HcF31k+4d2H2IRdqE4nNGwrHQ7AWa9/ iXSnVWsOAgzpYxGWTRbdtRDfFie9K2MUNpHQ/yzI4i+EmW8qtIa5/Uqo31RgtXH/pDn3 msErd2TMswyv/6z1jOOoJHLRIFVHvtvckBO3AfcIhc/jx8+SuhH3n2l72HCtWK/EBiE4 j+Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:from:subject :message-id:references:mime-version:in-reply-to:date:dkim-signature; bh=FJhJfniAgX/K6aNPg00s0hgGDGDmvcJtzARRej6TGOA=; b=icNE6gEbLe53Q349kyruio2GNEpvs7yI25FO9sC2wBQrbP58Hb/EwWX22f9uGi/TKf frHdMAk68kTKjCReEg+abFDcZAgo1t3cKL5u+KbZ0vaiuYRBhadIqvRfTLx+WeurlmuG Qy40xAcJsBPmxE/NjZ1vOyVIBfIqW+34vFcok39KZ+1NzBx1rGhy8viZTEaxjrqQXt9h WIBhnKHtNiRfKid2pU23cM0mdaNbJO19Yhg1ytx3F0cvh/pbS00t77sSErzZY+/H6qpn 0SCtHxPIO4fzgw6z1cXuhEMTdG+sA4IUO02YlzC2MB+xOviKOJdaNybd086+dG8962UH 2rZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=JAaXmQsU; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t18-20020a170902e85200b001a69d1be184si1920951plg.506.2023.05.25.09.30.21; Thu, 25 May 2023 09:30:33 -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=@google.com header.s=20221208 header.b=JAaXmQsU; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241382AbjEYPzf (ORCPT + 99 others); Thu, 25 May 2023 11:55:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241156AbjEYPzd (ORCPT ); Thu, 25 May 2023 11:55:33 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36B4A18D for ; Thu, 25 May 2023 08:55:31 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id 41be03b00d2f7-5343c1d114cso1796458a12.0 for ; Thu, 25 May 2023 08:55:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685030130; x=1687622130; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=FJhJfniAgX/K6aNPg00s0hgGDGDmvcJtzARRej6TGOA=; b=JAaXmQsUiv1MMYlIIQMGz3uobblUt+My3r9AwWFGnhn64piKXxlgqJS5+wucLy7MX3 8W/3BpF8qOQtu6SAArifGNKD3hCklvCmZpEX3UU9dlx0SdajPT2NtDYQWrTbkKG3Ojnf 863L28cxpMROTC5dUKAGZYr2NkUtGUp1du0EBjsmVt7RAfEl4M1yaJle7dEFJ55egM3Y 358v2Bftq3Nn8nSX2IALvmQ4d07XxVKxWUIfpH5C4Ty2GctFW5EfeIuFOkZEb8C4vLGf 88mD9zkeC8Arr0UFhwosZRucjhhf4/uUv36ml6I9iMBgPxMHsLjIA9pZx5KYjuTACVIa 61mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685030130; x=1687622130; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=FJhJfniAgX/K6aNPg00s0hgGDGDmvcJtzARRej6TGOA=; b=Xh+nV9q9gY5DOsYFBJF3Qkl2Q+D9YIZwZTmFI/K5+WprgNm61jr6/J6/frD/8Dfxmh bMdOlA0l737PDDyGY3nB3visQeQCZPdvw1I4aJXbXKhxv7mTSmMY/VoiL+3Tk4qm+ISj TfaZlI0bJ1wo7oz5lS0l0WYH48jaoSvNBpfbn9xLWfuUvmyrnJHDVzY6THulq59Vx8DV tQHvXObRv9ubvaVfFd6DjZOd+NIkc0xcM8kbZJAMR6tVbgxBxFRu1qof5dYc02qGVF5g ljrfNVXpZG0797fHjlrqPGnguSbC9dF2EhKjDWSKYx/5P9w03lWTqqvvhHf4Gqel2s4d Fpvw== X-Gm-Message-State: AC+VfDyu22LuD5YD6Fop7JiQ7iqSagh5ru67hDgggQyFydJVGAfjZFgp 8IHnOp2/b5Zvdhc6xFMuNgMBDcYhL+w= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90a:9804:b0:24d:f3d9:48b5 with SMTP id z4-20020a17090a980400b0024df3d948b5mr505815pjo.3.1685030130685; Thu, 25 May 2023 08:55:30 -0700 (PDT) Date: Thu, 25 May 2023 08:55:29 -0700 In-Reply-To: Mime-Version: 1.0 References: <20230420104622.12504-1-ljrcore@126.com> <20230420104622.12504-8-ljrcore@126.com> Message-ID: Subject: Re: [PATCH v2 7/7] KVM: selftests: Test pmu event filter with incompatible kvm_pmu_event_filter From: Sean Christopherson To: Jinrong Liang Cc: Like Xu , Paolo Bonzini , Jonathan Corbet , Shuah Khan , Aaron Lewis , David Matlack , Vishal Annapurve , Wanpeng Li , Bagas Sanjaya , Jinrong Liang , linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham 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 On Thu, May 25, 2023, Jinrong Liang wrote: > Sean Christopherson =E4=BA=8E2023=E5=B9=B45=E6=9C=882= 5=E6=97=A5=E5=91=A8=E5=9B=9B 07:50=E5=86=99=E9=81=93=EF=BC=9A > > > +static uint64_t test_incompatible_filter(struct kvm_vcpu *vcpu, uint= 32_t action, > > > + uint32_t bitmap) > > > +{ > > > + struct incompatible_pmu_event_filter err_f; > > > + > > > + err_f.action =3D action; > > > + err_f.fixed_counter_bitmap =3D bitmap; > > > + ioctl((vcpu->vm)->fd, KVM_SET_PMU_EVENT_FILTER, &err_f.action); > > > > This is completely busted. It "passes" by luck, not because it's a val= id test. > > The size of the argument is embedded in the IOCTL number itself, which = means that > > unless glibc is being very nice and using a macro + typeof + sizeof to = sanity check > > things, which I highly doubt is the case, this ioctl() is passing rando= m stack data, > > a.k.a. garbage, to KVM. > > > > In short, drop this patch. >=20 > Thank you for letting us know about the issues with the patch. I will > drop the patch as suggested. Would you advise me to prepare version 3 > to remove this patch? More comments on the other patches are incoming, please hold off on v3 unti= l then.