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]
Message-ID: <diqzfs15o1ll.fsf@ackerleytng-ctop.c.googlers.com>
Date:   Thu, 16 Nov 2023 21:00:22 +0000
From:   Ackerley Tng <ackerleytng@...gle.com>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     pbonzini@...hat.com, maz@...nel.org, oliver.upton@...ux.dev,
        chenhuacai@...nel.org, mpe@...erman.id.au, anup@...infault.org,
        paul.walmsley@...ive.com, palmer@...belt.com,
        aou@...s.berkeley.edu, seanjc@...gle.com, viro@...iv.linux.org.uk,
        brauner@...nel.org, willy@...radead.org, akpm@...ux-foundation.org,
        kvm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        kvmarm@...ts.linux.dev, linux-mips@...r.kernel.org,
        linuxppc-dev@...ts.ozlabs.org, kvm-riscv@...ts.infradead.org,
        linux-riscv@...ts.infradead.org, linux-fsdevel@...r.kernel.org,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        xiaoyao.li@...el.com, yilun.xu@...el.com,
        chao.p.peng@...ux.intel.com, tabba@...gle.com, jarkko@...nel.org,
        amoorthy@...gle.com, dmatlack@...gle.com,
        yu.c.zhang@...ux.intel.com, isaku.yamahata@...el.com,
        mic@...ikod.net, vbabka@...e.cz, vannapurve@...gle.com,
        mail@...iej.szmigiero.name, david@...hat.com, qperret@...gle.com,
        michael.roth@....com, wei.w.wang@...el.com,
        liam.merwick@...cle.com, isaku.yamahata@...il.com,
        kirill.shutemov@...ux.intel.com
Subject: Re: [PATCH 32/34] KVM: selftests: Add basic selftest for guest_memfd()

Paolo Bonzini <pbonzini@...hat.com> writes:

> <snip>
>
> +static void test_create_guest_memfd_invalid(struct kvm_vm *vm)
> +{
> +	size_t page_size = getpagesize();
> +	uint64_t flag;
> +	size_t size;
> +	int fd;
> +
> +	for (size = 1; size < page_size; size++) {
> +		fd = __vm_create_guest_memfd(vm, size, 0);
> +		TEST_ASSERT(fd == -1 && errno == EINVAL,
> +			    "guest_memfd() with non-page-aligned page size '0x%lx' should fail with EINVAL",
> +			    size);
> +	}
> +
> +	for (flag = 1; flag; flag <<= 1) {

Since transparent hugepage support is no longer officially part of this
series, 

> +		uint64_t bit;

this declaration of bit can be removed.

> +
> +		fd = __vm_create_guest_memfd(vm, page_size, flag);
> +		TEST_ASSERT(fd == -1 && errno == EINVAL,
> +			    "guest_memfd() with flag '0x%lx' should fail with EINVAL",
> +			    flag);
> +

This loop can also be removed,

> +		for_each_set_bit(bit, &valid_flags, 64) {
> +			fd = __vm_create_guest_memfd(vm, page_size, flag | BIT_ULL(bit));
> +			TEST_ASSERT(fd == -1 && errno == EINVAL,
> +				    "guest_memfd() with flags '0x%llx' should fail with EINVAL",
> +				    flag | BIT_ULL(bit));
> +		}

otherwise this won't compile because valid_flags is not declared.

These lines will have to be added back when adding transparent hugepage
support.

> +	}
> +}

Tested-by: Ackerley Tng <ackerleytng@...gle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ