lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 28 Jun 2023 14:19:25 -0700
From:   Sean Christopherson <seanjc@...gle.com>
To:     Jinrong Liang <ljr.kernel@...il.com>
Cc:     Paolo Bonzini <pbonzini@...hat.com>,
        Jim Mattson <jmattson@...gle.com>,
        Shuah Khan <shuah@...nel.org>,
        Aaron Lewis <aaronlewis@...gle.com>,
        David Matlack <dmatlack@...gle.com>,
        Vishal Annapurve <vannapurve@...gle.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Like Xu <like.xu.linux@...il.com>,
        Jinrong Liang <cloudliang@...cent.com>,
        linux-kselftest@...r.kernel.org, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/4] KVM: selftests: Introduce __kvm_pmu_event_filter
 to improved event filter settings

On Wed, Jun 07, 2023, Jinrong Liang wrote:
> -static struct kvm_pmu_event_filter *remove_event(struct kvm_pmu_event_filter *f,
> +static struct kvm_pmu_event_filter *remove_event(struct __kvm_pmu_event_filter *__f,
>  						 uint64_t event)

Can you tack on a patch to drop the return?  None of the callers consume it, and
it incorrectly implies that the incoming filter isn't modified.

>  {
>  	bool found = false;
>  	int i;
> +	struct kvm_pmu_event_filter *f = (void *)__f;

Nit, reverse xmas tree is preferred:

	struct kvm_pmu_event_filter *f = (void *)__f;
	bool found = false;
	int i;

Hoever, I don't think this one needs to cast, the cast is only necessary when
invoking a KVM ioctl(), e.g. I believe this should work:

static void remove_event(struct __kvm_pmu_event_filter *f, uint64_t event)
{
	bool found = false;
	int i;

	for (i = 0; i < f->nevents; i++) {
		if (found)
			f->events[i - 1] = f->events[i];
		else
			found = f->events[i] == event;
	}
	if (found)
		f->nevents--;
}
> @@ -569,19 +554,16 @@ static void run_masked_events_test(struct kvm_vcpu *vcpu,
>  				   const uint64_t masked_events[],
>  				   const int nmasked_events)
>  {
> -	struct kvm_pmu_event_filter *f;
> +	struct __kvm_pmu_event_filter f = {
> +	    .nevents = nmasked_events,
> +	    .action = KVM_PMU_EVENT_ALLOW,
> +	    .flags = KVM_PMU_EVENT_FLAG_MASKED_EVENTS,

Tabs, not spaces please.

> +static int set_pmu_single_event_filter(struct kvm_vcpu *vcpu, uint64_t event,
> +				       uint32_t flags, uint32_t action)
> +{
> +	struct __kvm_pmu_event_filter f = {
> +	    .nevents = 1,
> +	    .flags = flags,
> +	    .action = action,
> +	    .events = {
> +		event,

Tabs.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ