All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Haider Miraj <hmiraj@cisco.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: Re: [PATCH] [RFC] proc: Add mmap callback for /proc/<pid>/mem
Date: Mon, 16 Sep 2024 04:45:03 +0800	[thread overview]
Message-ID: <202409160450.N6EXHAts-lkp@intel.com> (raw)
In-Reply-To: <20240913174003.1786581-1-hmiraj@cisco.com>

Hi Haider,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on linus/master v6.11]
[cannot apply to next-20240913]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Haider-Miraj/proc-Add-mmap-callback-for-proc-pid-mem/20240914-014144
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/20240913174003.1786581-1-hmiraj%40cisco.com
patch subject: [PATCH] [RFC] proc: Add mmap callback for /proc/<pid>/mem
config: x86_64-allnoconfig (https://download.01.org/0day-ci/archive/20240916/202409160450.N6EXHAts-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240916/202409160450.N6EXHAts-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409160450.N6EXHAts-lkp@intel.com/

All errors (new ones prefixed by >>):

>> fs/proc/base.c:1022:20: error: too many arguments to function call, expected 6, have 7
    1021 |                 pinned = get_user_pages_remote(mm, addr, 1, FOLL_GET | FOLL_NOFAULT,
         |                          ~~~~~~~~~~~~~~~~~~~~~
    1022 |                                                 &page, NULL, NULL);
         |                                                              ^~~~
   include/linux/stddef.h:8:14: note: expanded from macro 'NULL'
       8 | #define NULL ((void *)0)
         |              ^~~~~~~~~~~
   include/linux/mm.h:2462:6: note: 'get_user_pages_remote' declared here
    2462 | long get_user_pages_remote(struct mm_struct *mm,
         |      ^                     ~~~~~~~~~~~~~~~~~~~~~
    2463 |                            unsigned long start, unsigned long nr_pages,
         |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2464 |                            unsigned int gup_flags, struct page **pages,
         |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2465 |                            int *locked);
         |                            ~~~~~~~~~~~
   1 error generated.


vim +1022 fs/proc/base.c

   970	
   971	/**
   972	 * mem_mmap - Memory mapping function
   973	 *
   974	 * This function implements mmap call for /proc/<pid>/mem.
   975	 *
   976	 * Assumptions and Limitations:
   977	 * - This function does not handle reverse mapping, which is required for swapping.
   978	 * - The VMA is not expected to be split with an unmap call.
   979	 */
   980	static int mem_mmap(struct file *file, struct vm_area_struct *vma)
   981	{
   982		uintptr_t addr, target_start_addr, target_end_addr;
   983		struct page_list_item *item;
   984		struct page *page, *zero_page;
   985		unsigned long zero_page_pfn;
   986		struct vma_info *info;
   987		long pinned;
   988		int ret;
   989	
   990		/* Retrieve mm of the target process*/
   991		struct mm_struct *mm = (struct mm_struct *)file->private_data;
   992		size_t size = vma->vm_end - vma->vm_start;
   993		uintptr_t start_addr = vma->vm_start;
   994	
   995		target_start_addr = vma->vm_pgoff << PAGE_SHIFT; /* Multiply by PAGE_SIZE */
   996		target_end_addr = target_start_addr + size;
   997	
   998		if (!mm)
   999			return -EINVAL;
  1000	
  1001		info = kmalloc(sizeof(struct vma_info), GFP_KERNEL);
  1002		if (!info)
  1003			return -ENOMEM;
  1004		INIT_LIST_HEAD(&info->page_list_head);
  1005		info->vma_start_addr = vma->vm_start;
  1006		info->vma_end_addr = vma->vm_end;
  1007	
  1008		vma->vm_private_data = info;
  1009		vma->vm_ops = &mem_vm_ops;
  1010	
  1011		zero_page = ZERO_PAGE(0);
  1012		zero_page_pfn = page_to_pfn(zero_page);
  1013	
  1014		/* Acquire the mmap_lock before pinning the page (get_user_pages_remote) */
  1015		down_read(&mm->mmap_lock);
  1016	
  1017		for (addr = target_start_addr; addr < target_end_addr; addr += PAGE_SIZE) {
  1018			unsigned long pfn;
  1019	
  1020			/* Pin the user page */
  1021			pinned = get_user_pages_remote(mm, addr, 1, FOLL_GET | FOLL_NOFAULT,
> 1022							&page, NULL, NULL);
  1023			/* Page is not resident (FOLL_NOFAULT), we will skip to the next address */
  1024			if (pinned <= 0) {
  1025				ret = remap_pfn_range(vma, start_addr, zero_page_pfn, PAGE_SIZE,
  1026						vma->vm_page_prot);
  1027				if (ret)
  1028					goto err_unlock;
  1029				start_addr += PAGE_SIZE;
  1030				continue;
  1031			}
  1032	
  1033			/* We need to keep track of pages which are pinned */
  1034			item = kmalloc(sizeof(struct page_list_item), GFP_KERNEL);
  1035			if (!item) {
  1036				kfree(info);
  1037				return -ENOMEM;
  1038			}
  1039	
  1040			item->page = page;
  1041			list_add(&item->list, &info->page_list_head);
  1042			pfn = page_to_pfn(page);
  1043	
  1044			/* Remap the page frame under current vma */
  1045			ret = remap_pfn_range(vma, start_addr, pfn, PAGE_SIZE,
  1046						vma->vm_page_prot);
  1047			if (ret)
  1048				kfree(item);
  1049	
  1050			start_addr += PAGE_SIZE;
  1051		}
  1052	err_unlock:
  1053		up_read(&mm->mmap_lock);
  1054		return 0;
  1055	}
  1056	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

      parent reply	other threads:[~2024-09-15 20:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-13 17:40 [PATCH] [RFC] proc: Add mmap callback for /proc/<pid>/mem Haider Miraj
2024-09-15 20:45 ` kernel test robot
2024-09-15 20:45 ` kernel test robot [this message]

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=202409160450.N6EXHAts-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=hmiraj@cisco.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.