Subject: linux-next: manual merge of the execve tree with the mm tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 9 Sep 2024 17:18:43 +1000

Hi all,

Today's linux-next merge of the execve tree got a conflict in:

  include/linux/mm.h

between commits:

  99ab6f0a6854 ("mm/codetag: fix pgalloc_tag_split()")
  4d42ecdbd2fb ("mm/codetag: add pgalloc_tag_copy()")

from the mm-unstable branch of the mm tree and commit:

  44f65d900698 ("binfmt_elf: mseal address zero")

from the execve tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc include/linux/mm.h
index 79d69e998649,a178c15812eb..000000000000
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@@ -4148,61 -4201,14 +4148,71 @@@ void vma_pgtable_walk_end(struct vm_are
  
  int reserve_mem_find_by_name(const char *name, phys_addr_t *start, phys_addr_t *size);
  
 +#ifdef CONFIG_MEM_ALLOC_PROFILING
 +static inline void pgalloc_tag_split(struct folio *folio, int old_order, int new_order)
 +{
 +	int i;
 +	struct alloc_tag *tag;
 +	unsigned int nr_pages = 1 << new_order;
 +
 +	if (!mem_alloc_profiling_enabled())
 +		return;
 +
 +	tag = pgalloc_tag_get(&folio->page);
 +	if (!tag)
 +		return;
 +
 +	for (i = nr_pages; i < (1 << old_order); i += nr_pages) {
 +		union codetag_ref *ref = get_page_tag_ref(folio_page(folio, i));
 +
 +		if (ref) {
 +			/* Set new reference to point to the original tag */
 +			alloc_tag_ref_set(ref, tag);
 +			put_page_tag_ref(ref);
 +		}
 +	}
 +}
 +
 +static inline void pgalloc_tag_copy(struct folio *new, struct folio *old)
 +{
 +	struct alloc_tag *tag;
 +	union codetag_ref *ref;
 +
 +	tag = pgalloc_tag_get(&old->page);
 +	if (!tag)
 +		return;
 +
 +	ref = get_page_tag_ref(&new->page);
 +	if (!ref)
 +		return;
 +
 +	/* Clear the old ref to the original allocation tag. */
 +	clear_page_tag_ref(&old->page);
 +	/* Decrement the counters of the tag on get_new_folio. */
 +	alloc_tag_sub(ref, folio_nr_pages(new));
 +
 +	__alloc_tag_ref_set(ref, tag);
 +
 +	put_page_tag_ref(ref);
 +}
 +#else /* !CONFIG_MEM_ALLOC_PROFILING */
 +static inline void pgalloc_tag_split(struct folio *folio, int old_order, int new_order)
 +{
 +}
 +
 +static inline void pgalloc_tag_copy(struct folio *new, struct folio *old)
 +{
 +}
 +#endif /* CONFIG_MEM_ALLOC_PROFILING */
 +
+ #ifdef CONFIG_64BIT
+ int do_mseal(unsigned long start, size_t len_in, unsigned long flags);
+ #else
+ static inline int do_mseal(unsigned long start, size_t len_in, unsigned long flags)
+ {
+ 	/* noop on 32 bit */
+ 	return 0;
+ }
+ #endif
+ 
  #endif /* _LINUX_MM_H */