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] [day] [month] [year] [list]
Message-ID: <20171123101422.6fu7ehvjuw2v5jjh@node.shutemov.name>
Date:   Thu, 23 Nov 2017 13:14:23 +0300
From:   "Kirill A. Shutemov" <kirill@...temov.name>
To:     "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
Cc:     akpm@...ux-foundation.org,
        "Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2] selftest/vm: Add test case for mmap across 128TB
 boundary.

On Thu, Nov 23, 2017 at 08:33:13AM +0530, Aneesh Kumar K.V wrote:
> From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
> 
> This patch add a self-test that covers a few corner cases of the interface.
> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
> ---
> 
> Changes from V1:
> * Add the test to run_vmtests script
> 
>  tools/testing/selftests/vm/Makefile         |   1 +
>  tools/testing/selftests/vm/run_vmtests      |  11 ++
>  tools/testing/selftests/vm/va_128TBswitch.c | 297 ++++++++++++++++++++++++++++
>  3 files changed, 309 insertions(+)
>  create mode 100644 tools/testing/selftests/vm/va_128TBswitch.c

Patch with my selftest is already in -tip tree. I think this selftest
should replace it, not add another one.

> diff --git a/tools/testing/selftests/vm/va_128TBswitch.c b/tools/testing/selftests/vm/va_128TBswitch.c
> new file mode 100644
> index 000000000000..2fdb84ab94b1
> --- /dev/null
> +++ b/tools/testing/selftests/vm/va_128TBswitch.c
> @@ -0,0 +1,297 @@
> +/*
> + *
> + * Authors: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> + * Authors: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of version 2.1 of the GNU Lesser General Public License
> + * as published by the Free Software Foundation.

LGPL? Why?

> + *
> + * This program is distributed in the hope that it would be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> + *
> + */
> +
> +static int run_test(struct testcase *test, int count)
> +{
> +	void *p;
> +	int i, ret = 0;
> +
> +	for (i = 0; i < count; i++) {
> +		struct testcase *t = test + i;
> +
> +		p = mmap(t->addr, t->size, PROT_READ | PROT_WRITE, t->flags, -1, 0);
> +
> +		printf("%s: %p - ", t->msg, p);
> +
> +		if (p == MAP_FAILED) {
> +			printf("FAILED\n");
> +			ret = 1;
> +			continue;
> +		}
> +
> +		if (t->low_addr_required && p >= (void *)(1UL << 47)) {
> +			printf("FAILED\n");
> +			ret = 1;
> +		} else {
> +			/*
> +			 * Do a dereference of the address returned so that we catch
> +			 * bugs in page fault handling
> +			 */
> +			*(int *)p = 10;

If we are going to touch memory, maybe not just first page, but whole
range? memset()?

> +			printf("OK\n");
> +		}
> +		if (!t->keep_mapped)
> +			munmap(p, t->size);
> +	}
> +
> +	return ret;
> +}

-- 
 Kirill A. Shutemov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ