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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 10 Jun 2022 10:28:08 +0200
From:   Vasant Karasulli <vkarasulli@...e.de>
To:     Sean Christopherson <seanjc@...gle.com>
Cc:     linux-kernel@...r.kernel.org, jroedel@...e.de, kvm@...r.kernel.org,
        bp@...en8.de, x86@...nel.org, thomas.lendacky@....com
Subject: Re: [PATCH v6 2/4] x86/tests: Add tests for AMD SEV-ES #VC handling
 Add KUnit based tests to validate Linux's VC handling for instructions cpuid
 and wbinvd. These tests: 1. install a kretprobe on the #VC handler
 (sev_es_ghcb_hv_call, to access GHCB before/after the resulting VMGEXIT). 2.
 trigger an NAE by executing either cpuid or wbinvd. 3. check that the
 kretprobe was hit with the right exit_code available in GHCB.

On Mi 08-06-22 19:57:45, Sean Christopherson wrote:
> On Wed, Jun 08, 2022, Vasant Karasulli wrote:
> > On Mi 08-06-22 14:35:55, Sean Christopherson wrote:
> > > On Wed, Jun 08, 2022, Vasant Karasulli wrote:
> > > > On Mi 06-04-22 01:22:55, Sean Christopherson wrote:
> > > > > > +	if (ret) {
> > > > > > +		kunit_info(test, "Could not register kretprobe. Skipping.");
> > > > > > +		goto out;
> > > > > > +	}
> > > > > > +
> > > > > > +	test->priv = kunit_kzalloc(test, sizeof(u64), GFP_KERNEL);
> > > > >
> > > > > Allocating 8 bytes and storing the pointer an 8-byte field is rather pointless :-)
> > > > >
> > > >
> > > > Actually it's necessary to allocate memory to test->priv before using according to
> > > > https://www.kernel.org/doc/html/latest/dev-tools/kunit/tips.html
> > >
> > > If priv points at structure of some form, sure, but you're storing a simple value.
> >
> > Yes, I agree. The reason it was done this way I guess is that type of priv is a
> > void pointer and storing a u64 value results in a compiler warning:
> > cast from pointer to integer of different size [-Wpointer-to-int-cast].
>
> An intermediate cast to "unsigned long" should make that go away.

Yes, intermediate cast satisfied the compiler. Thanks for the tip.

--
Vasant Karasulli
Kernel generalist
www.suse.com<http://www.suse.com>
[https://www.suse.com/assets/img/social-platforms-suse-logo.png]<http://www.suse.com/>
SUSE - Open Source Solutions for Enterprise Servers & Cloud<http://www.suse.com/>
Modernize your infrastructure with SUSE Linux Enterprise servers, cloud technology for IaaS, and SUSE's software-defined storage.
www.suse.com

Powered by blists - more mailing lists