Re: [PATCH 1/6] kselftest/arm64: Add utilities and a test to validate mte memory

From: Catalin Marinas
Date: Mon Sep 21 2020 - 07:36:40 EST


On Tue, Sep 01, 2020 at 02:57:14PM +0530, Amit Daniel Kachhap wrote:
> diff --git a/tools/testing/selftests/arm64/mte/mte_common_util.c b/tools/testing/selftests/arm64/mte/mte_common_util.c
> new file mode 100644
> index 000000000000..ac311919567d
> --- /dev/null
> +++ b/tools/testing/selftests/arm64/mte/mte_common_util.c
> @@ -0,0 +1,374 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright (C) 2020 ARM Limited
> +
> +#include <fcntl.h>
> +#include <sched.h>
> +#include <signal.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <unistd.h>
> +
> +#include <linux/auxvec.h>
> +#include <sys/auxv.h>
> +#include <sys/mman.h>
> +#include <sys/prctl.h>
> +
> +#include <asm/hwcap.h>
> +
> +#include "kselftest.h"
> +#include "mte_common_util.h"
> +#include "mte_def.h"
> +
> +/* The temp file must be created in a tmpfs filesystem */
> +#ifdef ANDROID
> +# define TEMPFILENAME "/storage/tmp_XXXXXX"
> +#else
> +# define TEMPFILENAME "/tmp/tmp_XXXXXX"
> +#endif

That's not guaranteed to be tmpfs (it's not on my Debian install). I
think you'd have a better chance with /dev/shm/tmp_XXXXXX.

--
Catalin