Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Yang Shi <yang@os.amperecomputing.com>
Cc: will@kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v6.13-rc1] arm64: mte: set VM_MTE_ALLOWED for hugetlbfs at correct place
Date: Thu, 21 Nov 2024 18:22:17 +0000	[thread overview]
Message-ID: <Zz96WefRxFL0FMRq@arm.com> (raw)
In-Reply-To: <20241119200914.1145249-1-yang@os.amperecomputing.com>

On Tue, Nov 19, 2024 at 12:09:14PM -0800, Yang Shi wrote:
> The commit 5de195060b2e ("mm: resolve faulty mmap_region() error path
> behaviour") moved vm flags validation before fop->mmap for file
> mappings.  But when commit 25c17c4b55de ("hugetlb: arm64: add mte support")
> was rebased on top of it, the hugetlbfs part was missed.  Mmapping
> hugetlbfs file may not have MAP_HUGETLB set.
> 
> Fixes: 25c17c4b55de ("hugetlb: arm64: add mte support")
> Signed-off-by: Yang Shi <yang@os.amperecomputing.com>

Since 5de195060b2e went into -rc7 and my arm64 tree was based on -rc1, I
did not test this combination. The patch looks fine, so:

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

So I either merge it via the arm64 tree at -rc1 or Linus picks it up and
applies it directly during the merging window. Both options are fine,
it's not essential that MTE + hugetlbfs works at -rc1. Adding Linus and
Andrew in case they have any preference (and leaving the patch in place
below).

Thanks,

Catalin

> ---
>  arch/arm64/include/asm/mman.h | 3 ++-
>  fs/hugetlbfs/inode.c          | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/mman.h b/arch/arm64/include/asm/mman.h
> index 1d53022fc7e1..21df8bbd2668 100644
> --- a/arch/arm64/include/asm/mman.h
> +++ b/arch/arm64/include/asm/mman.h
> @@ -7,6 +7,7 @@
>  #ifndef BUILD_VDSO
>  #include <linux/compiler.h>
>  #include <linux/fs.h>
> +#include <linux/hugetlb.h>
>  #include <linux/shmem_fs.h>
>  #include <linux/types.h>
>  
> @@ -44,7 +45,7 @@ static inline unsigned long arch_calc_vm_flag_bits(struct file *file,
>  	if (system_supports_mte()) {
>  		if (flags & (MAP_ANONYMOUS | MAP_HUGETLB))
>  			return VM_MTE_ALLOWED;
> -		if (shmem_file(file))
> +		if (shmem_file(file) || is_file_hugepages(file))
>  			return VM_MTE_ALLOWED;
>  	}
>  
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index 1bbf783b244a..2dea122e5b93 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -113,7 +113,7 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
>  	 * way when do_mmap unwinds (may be important on powerpc
>  	 * and ia64).
>  	 */
> -	vm_flags_set(vma, VM_HUGETLB | VM_DONTEXPAND | VM_MTE_ALLOWED);
> +	vm_flags_set(vma, VM_HUGETLB | VM_DONTEXPAND);
>  	vma->vm_ops = &hugetlb_vm_ops;
>  
>  	ret = seal_check_write(info->seals, vma);
> -- 


  reply	other threads:[~2024-11-21 18:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19 20:09 [PATCH v6.13-rc1] arm64: mte: set VM_MTE_ALLOWED for hugetlbfs at correct place Yang Shi
2024-11-21 18:22 ` Catalin Marinas [this message]
2024-11-21 18:29   ` Yang Shi
2024-12-02 18:16 ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zz96WefRxFL0FMRq@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=will@kernel.org \
    --cc=yang@os.amperecomputing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox