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>] [day] [month] [year] [list]
Date:   Fri, 5 Mar 2021 09:02:16 +0800
From:   kernel test robot <lkp@...el.com>
To:     Christoph Hellwig <hch@....de>
Cc:     clang-built-linux@...glegroups.com, linux-kernel@...r.kernel.org,
        "Matthew Wilcox (Oracle)" <willy@...radead.org>,
        Kent Overstreet <kmo@...erainc.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Memory Management List <linux-mm@...ck.org>
Subject: mm/filemap.c:2409:9: warning: stack frame size of 2704 bytes in
 function 'filemap_read'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3cb60ee6323968b694208c4cbd56a7176396e931
commit: 87fa0f3eb267eed966ee194907bc15376c1b758f mm/filemap: rename generic_file_buffered_read to filemap_read
date:   8 days ago
config: powerpc-randconfig-r023-20210304 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project eec7f8f7b1226be422a76542cb403d02538f453a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=87fa0f3eb267eed966ee194907bc15376c1b758f
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 87fa0f3eb267eed966ee194907bc15376c1b758f
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   In file included from mm/filemap.c:20:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:224:1: note: expanded from here
   __do_insw
   ^
   arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw'
   #define __do_insw(p, b, n)      readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from mm/filemap.c:20:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:228:1: note: expanded from here
   __do_insl
   ^
   arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
   #define __do_insl(p, b, n)      readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from mm/filemap.c:20:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:232:1: note: expanded from here
   __do_outsb
   ^
   arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
   #define __do_outsb(p, b, n)     writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from mm/filemap.c:20:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:236:1: note: expanded from here
   __do_outsw
   ^
   arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw'
   #define __do_outsw(p, b, n)     writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from mm/filemap.c:20:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:240:1: note: expanded from here
   __do_outsl
   ^
   arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
   #define __do_outsl(p, b, n)     writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
>> mm/filemap.c:2409:9: warning: stack frame size of 2704 bytes in function 'filemap_read' [-Wframe-larger-than=]
   ssize_t filemap_read(struct kiocb *iocb, struct iov_iter *iter,
           ^
   13 warnings generated.


vim +/filemap_read +2409 mm/filemap.c

  2395	
  2396	/**
  2397	 * filemap_read - Read data from the page cache.
  2398	 * @iocb: The iocb to read.
  2399	 * @iter: Destination for the data.
  2400	 * @already_read: Number of bytes already read by the caller.
  2401	 *
  2402	 * Copies data from the page cache.  If the data is not currently present,
  2403	 * uses the readahead and readpage address_space operations to fetch it.
  2404	 *
  2405	 * Return: Total number of bytes copied, including those already read by
  2406	 * the caller.  If an error happens before any bytes are copied, returns
  2407	 * a negative error number.
  2408	 */
> 2409	ssize_t filemap_read(struct kiocb *iocb, struct iov_iter *iter,
  2410			ssize_t already_read)
  2411	{
  2412		struct file *filp = iocb->ki_filp;
  2413		struct file_ra_state *ra = &filp->f_ra;
  2414		struct address_space *mapping = filp->f_mapping;
  2415		struct inode *inode = mapping->host;
  2416		struct pagevec pvec;
  2417		int i, error = 0;
  2418		bool writably_mapped;
  2419		loff_t isize, end_offset;
  2420	
  2421		if (unlikely(iocb->ki_pos >= inode->i_sb->s_maxbytes))
  2422			return 0;
  2423		if (unlikely(!iov_iter_count(iter)))
  2424			return 0;
  2425	
  2426		iov_iter_truncate(iter, inode->i_sb->s_maxbytes);
  2427		pagevec_init(&pvec);
  2428	
  2429		do {
  2430			cond_resched();
  2431	
  2432			/*
  2433			 * If we've already successfully copied some data, then we
  2434			 * can no longer safely return -EIOCBQUEUED. Hence mark
  2435			 * an async read NOWAIT at that point.
  2436			 */
  2437			if ((iocb->ki_flags & IOCB_WAITQ) && already_read)
  2438				iocb->ki_flags |= IOCB_NOWAIT;
  2439	
  2440			error = filemap_get_pages(iocb, iter, &pvec);
  2441			if (error < 0)
  2442				break;
  2443	
  2444			/*
  2445			 * i_size must be checked after we know the pages are Uptodate.
  2446			 *
  2447			 * Checking i_size after the check allows us to calculate
  2448			 * the correct value for "nr", which means the zero-filled
  2449			 * part of the page is not copied back to userspace (unless
  2450			 * another truncate extends the file - this is desired though).
  2451			 */
  2452			isize = i_size_read(inode);
  2453			if (unlikely(iocb->ki_pos >= isize))
  2454				goto put_pages;
  2455			end_offset = min_t(loff_t, isize, iocb->ki_pos + iter->count);
  2456	
  2457			/*
  2458			 * Once we start copying data, we don't want to be touching any
  2459			 * cachelines that might be contended:
  2460			 */
  2461			writably_mapped = mapping_writably_mapped(mapping);
  2462	
  2463			/*
  2464			 * When a sequential read accesses a page several times, only
  2465			 * mark it as accessed the first time.
  2466			 */
  2467			if (iocb->ki_pos >> PAGE_SHIFT !=
  2468			    ra->prev_pos >> PAGE_SHIFT)
  2469				mark_page_accessed(pvec.pages[0]);
  2470	
  2471			for (i = 0; i < pagevec_count(&pvec); i++) {
  2472				struct page *page = pvec.pages[i];
  2473				size_t page_size = thp_size(page);
  2474				size_t offset = iocb->ki_pos & (page_size - 1);
  2475				size_t bytes = min_t(loff_t, end_offset - iocb->ki_pos,
  2476						     page_size - offset);
  2477				size_t copied;
  2478	
  2479				if (end_offset < page_offset(page))
  2480					break;
  2481				if (i > 0)
  2482					mark_page_accessed(page);
  2483				/*
  2484				 * If users can be writing to this page using arbitrary
  2485				 * virtual addresses, take care about potential aliasing
  2486				 * before reading the page on the kernel side.
  2487				 */
  2488				if (writably_mapped) {
  2489					int j;
  2490	
  2491					for (j = 0; j < thp_nr_pages(page); j++)
  2492						flush_dcache_page(page + j);
  2493				}
  2494	
  2495				copied = copy_page_to_iter(page, offset, bytes, iter);
  2496	
  2497				already_read += copied;
  2498				iocb->ki_pos += copied;
  2499				ra->prev_pos = iocb->ki_pos;
  2500	
  2501				if (copied < bytes) {
  2502					error = -EFAULT;
  2503					break;
  2504				}
  2505			}
  2506	put_pages:
  2507			for (i = 0; i < pagevec_count(&pvec); i++)
  2508				put_page(pvec.pages[i]);
  2509			pagevec_reinit(&pvec);
  2510		} while (iov_iter_count(iter) && iocb->ki_pos < isize && !error);
  2511	
  2512		file_accessed(filp);
  2513	
  2514		return already_read ? already_read : error;
  2515	}
  2516	EXPORT_SYMBOL_GPL(filemap_read);
  2517	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (25077 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ