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]
Message-ID: <202006171658.W4WevFz7%lkp@intel.com>
Date:   Wed, 17 Jun 2020 16:38:09 +0800
From:   kernel test robot <lkp@...el.com>
To:     Ira Weiny <ira.weiny@...el.com>
Cc:     kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
        linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Memory Management List <linux-mm@...ck.org>,
        Christoph Hellwig <hch@....de>
Subject: fs/ntfs/file.c:1730:16: warning: stack frame size of 1040 bytes in
 function 'ntfs_perform_write'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   69119673bd50b176ded34032fadd41530fb5af21
commit: abca2500c0c1b20c3e552f259da4c4a99db3b4d1 arch/kunmap_atomic: consolidate duplicate code
date:   12 days ago
config: mips-randconfig-r013-20200617 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 487ca07fcc75d52755c9fe2ee05bcb3b6eeeec44)
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 mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        git checkout abca2500c0c1b20c3e552f259da4c4a99db3b4d1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

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 >>, old ones prefixed by <<):

>> fs/ntfs/file.c:1730:16: warning: stack frame size of 1040 bytes in function 'ntfs_perform_write' [-Wframe-larger-than=]
static ssize_t ntfs_perform_write(struct file *file, struct iov_iter *i,
^
1 warning generated.

vim +/ntfs_perform_write +1730 fs/ntfs/file.c

9014da7525dffe Marco Stornelli    2012-12-15  1723  
98b270362bb9ea Anton Altaparmakov 2005-10-11  1724  /**
a632f559304130 Anton Altaparmakov 2015-03-11  1725   * ntfs_perform_write - perform buffered write to a file
a632f559304130 Anton Altaparmakov 2015-03-11  1726   * @file:	file to write to
a632f559304130 Anton Altaparmakov 2015-03-11  1727   * @i:		iov_iter with data to write
a632f559304130 Anton Altaparmakov 2015-03-11  1728   * @pos:	byte offset in file at which to begin writing to
98b270362bb9ea Anton Altaparmakov 2005-10-11  1729   */
a632f559304130 Anton Altaparmakov 2015-03-11 @1730  static ssize_t ntfs_perform_write(struct file *file, struct iov_iter *i,
a632f559304130 Anton Altaparmakov 2015-03-11  1731  		loff_t pos)
98b270362bb9ea Anton Altaparmakov 2005-10-11  1732  {
98b270362bb9ea Anton Altaparmakov 2005-10-11  1733  	struct address_space *mapping = file->f_mapping;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1734  	struct inode *vi = mapping->host;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1735  	ntfs_inode *ni = NTFS_I(vi);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1736  	ntfs_volume *vol = ni->vol;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1737  	struct page *pages[NTFS_MAX_PAGES_PER_CLUSTER];
98b270362bb9ea Anton Altaparmakov 2005-10-11  1738  	struct page *cached_page = NULL;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1739  	VCN last_vcn;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1740  	LCN lcn;
a632f559304130 Anton Altaparmakov 2015-03-11  1741  	size_t bytes;
a632f559304130 Anton Altaparmakov 2015-03-11  1742  	ssize_t status, written = 0;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1743  	unsigned nr_pages;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1744  
a632f559304130 Anton Altaparmakov 2015-03-11  1745  	ntfs_debug("Entering for i_ino 0x%lx, attribute type 0x%x, pos "
a632f559304130 Anton Altaparmakov 2015-03-11  1746  			"0x%llx, count 0x%lx.", vi->i_ino,
a632f559304130 Anton Altaparmakov 2015-03-11  1747  			(unsigned)le32_to_cpu(ni->type),
a632f559304130 Anton Altaparmakov 2015-03-11  1748  			(unsigned long long)pos,
a632f559304130 Anton Altaparmakov 2015-03-11  1749  			(unsigned long)iov_iter_count(i));
98b270362bb9ea Anton Altaparmakov 2005-10-11  1750  	/*
98b270362bb9ea Anton Altaparmakov 2005-10-11  1751  	 * If a previous ntfs_truncate() failed, repeat it and abort if it
98b270362bb9ea Anton Altaparmakov 2005-10-11  1752  	 * fails again.
98b270362bb9ea Anton Altaparmakov 2005-10-11  1753  	 */
98b270362bb9ea Anton Altaparmakov 2005-10-11  1754  	if (unlikely(NInoTruncateFailed(ni))) {
a632f559304130 Anton Altaparmakov 2015-03-11  1755  		int err;
a632f559304130 Anton Altaparmakov 2015-03-11  1756  
bd5fe6c5eb9c54 Christoph Hellwig  2011-06-24  1757  		inode_dio_wait(vi);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1758  		err = ntfs_truncate(vi);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1759  		if (err || NInoTruncateFailed(ni)) {
98b270362bb9ea Anton Altaparmakov 2005-10-11  1760  			if (!err)
98b270362bb9ea Anton Altaparmakov 2005-10-11  1761  				err = -EIO;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1762  			ntfs_error(vol->sb, "Cannot perform write to inode "
98b270362bb9ea Anton Altaparmakov 2005-10-11  1763  					"0x%lx, attribute type 0x%x, because "
98b270362bb9ea Anton Altaparmakov 2005-10-11  1764  					"ntfs_truncate() failed (error code "
98b270362bb9ea Anton Altaparmakov 2005-10-11  1765  					"%i).", vi->i_ino,
98b270362bb9ea Anton Altaparmakov 2005-10-11  1766  					(unsigned)le32_to_cpu(ni->type), err);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1767  			return err;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1768  		}
98b270362bb9ea Anton Altaparmakov 2005-10-11  1769  	}
98b270362bb9ea Anton Altaparmakov 2005-10-11  1770  	/*
98b270362bb9ea Anton Altaparmakov 2005-10-11  1771  	 * Determine the number of pages per cluster for non-resident
98b270362bb9ea Anton Altaparmakov 2005-10-11  1772  	 * attributes.
98b270362bb9ea Anton Altaparmakov 2005-10-11  1773  	 */
98b270362bb9ea Anton Altaparmakov 2005-10-11  1774  	nr_pages = 1;
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  1775  	if (vol->cluster_size > PAGE_SIZE && NInoNonResident(ni))
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  1776  		nr_pages = vol->cluster_size >> PAGE_SHIFT;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1777  	last_vcn = -1;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1778  	do {
98b270362bb9ea Anton Altaparmakov 2005-10-11  1779  		VCN vcn;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1780  		pgoff_t idx, start_idx;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1781  		unsigned ofs, do_pages, u;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1782  		size_t copied;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1783  
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  1784  		start_idx = idx = pos >> PAGE_SHIFT;
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  1785  		ofs = pos & ~PAGE_MASK;
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  1786  		bytes = PAGE_SIZE - ofs;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1787  		do_pages = 1;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1788  		if (nr_pages > 1) {
98b270362bb9ea Anton Altaparmakov 2005-10-11  1789  			vcn = pos >> vol->cluster_size_bits;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1790  			if (vcn != last_vcn) {
98b270362bb9ea Anton Altaparmakov 2005-10-11  1791  				last_vcn = vcn;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1792  				/*
98b270362bb9ea Anton Altaparmakov 2005-10-11  1793  				 * Get the lcn of the vcn the write is in.  If
98b270362bb9ea Anton Altaparmakov 2005-10-11  1794  				 * it is a hole, need to lock down all pages in
98b270362bb9ea Anton Altaparmakov 2005-10-11  1795  				 * the cluster.
98b270362bb9ea Anton Altaparmakov 2005-10-11  1796  				 */
98b270362bb9ea Anton Altaparmakov 2005-10-11  1797  				down_read(&ni->runlist.lock);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1798  				lcn = ntfs_attr_vcn_to_lcn_nolock(ni, pos >>
c49c31115067bc Richard Knutsson   2006-09-30  1799  						vol->cluster_size_bits, false);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1800  				up_read(&ni->runlist.lock);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1801  				if (unlikely(lcn < LCN_HOLE)) {
98b270362bb9ea Anton Altaparmakov 2005-10-11  1802  					if (lcn == LCN_ENOMEM)
98b270362bb9ea Anton Altaparmakov 2005-10-11  1803  						status = -ENOMEM;
a632f559304130 Anton Altaparmakov 2015-03-11  1804  					else {
a632f559304130 Anton Altaparmakov 2015-03-11  1805  						status = -EIO;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1806  						ntfs_error(vol->sb, "Cannot "
98b270362bb9ea Anton Altaparmakov 2005-10-11  1807  							"perform write to "
98b270362bb9ea Anton Altaparmakov 2005-10-11  1808  							"inode 0x%lx, "
98b270362bb9ea Anton Altaparmakov 2005-10-11  1809  							"attribute type 0x%x, "
98b270362bb9ea Anton Altaparmakov 2005-10-11  1810  							"because the attribute "
98b270362bb9ea Anton Altaparmakov 2005-10-11  1811  							"is corrupt.",
98b270362bb9ea Anton Altaparmakov 2005-10-11  1812  							vi->i_ino, (unsigned)
98b270362bb9ea Anton Altaparmakov 2005-10-11  1813  							le32_to_cpu(ni->type));
a632f559304130 Anton Altaparmakov 2015-03-11  1814  					}
98b270362bb9ea Anton Altaparmakov 2005-10-11  1815  					break;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1816  				}
98b270362bb9ea Anton Altaparmakov 2005-10-11  1817  				if (lcn == LCN_HOLE) {
98b270362bb9ea Anton Altaparmakov 2005-10-11  1818  					start_idx = (pos & ~(s64)
98b270362bb9ea Anton Altaparmakov 2005-10-11  1819  							vol->cluster_size_mask)
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  1820  							>> PAGE_SHIFT;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1821  					bytes = vol->cluster_size - (pos &
98b270362bb9ea Anton Altaparmakov 2005-10-11  1822  							vol->cluster_size_mask);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1823  					do_pages = nr_pages;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1824  				}
98b270362bb9ea Anton Altaparmakov 2005-10-11  1825  			}
98b270362bb9ea Anton Altaparmakov 2005-10-11  1826  		}
a632f559304130 Anton Altaparmakov 2015-03-11  1827  		if (bytes > iov_iter_count(i))
a632f559304130 Anton Altaparmakov 2015-03-11  1828  			bytes = iov_iter_count(i);
a632f559304130 Anton Altaparmakov 2015-03-11  1829  again:
98b270362bb9ea Anton Altaparmakov 2005-10-11  1830  		/*
98b270362bb9ea Anton Altaparmakov 2005-10-11  1831  		 * Bring in the user page(s) that we will copy from _first_.
98b270362bb9ea Anton Altaparmakov 2005-10-11  1832  		 * Otherwise there is a nasty deadlock on copying from the same
98b270362bb9ea Anton Altaparmakov 2005-10-11  1833  		 * page(s) as we are writing to, without it/them being marked
98b270362bb9ea Anton Altaparmakov 2005-10-11  1834  		 * up-to-date.  Note, at present there is nothing to stop the
98b270362bb9ea Anton Altaparmakov 2005-10-11  1835  		 * pages being swapped out between us bringing them into memory
98b270362bb9ea Anton Altaparmakov 2005-10-11  1836  		 * and doing the actual copying.
98b270362bb9ea Anton Altaparmakov 2005-10-11  1837  		 */
4bce9f6ee8f84f Al Viro            2016-09-17  1838  		if (unlikely(iov_iter_fault_in_readable(i, bytes))) {
a632f559304130 Anton Altaparmakov 2015-03-11  1839  			status = -EFAULT;
a632f559304130 Anton Altaparmakov 2015-03-11  1840  			break;
a632f559304130 Anton Altaparmakov 2015-03-11  1841  		}
98b270362bb9ea Anton Altaparmakov 2005-10-11  1842  		/* Get and lock @do_pages starting at index @start_idx. */
98b270362bb9ea Anton Altaparmakov 2005-10-11  1843  		status = __ntfs_grab_cache_pages(mapping, start_idx, do_pages,
4c99000ac47cbd Minchan Kim        2010-05-24  1844  				pages, &cached_page);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1845  		if (unlikely(status))
98b270362bb9ea Anton Altaparmakov 2005-10-11  1846  			break;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1847  		/*
98b270362bb9ea Anton Altaparmakov 2005-10-11  1848  		 * For non-resident attributes, we need to fill any holes with
98b270362bb9ea Anton Altaparmakov 2005-10-11  1849  		 * actual clusters and ensure all bufferes are mapped.  We also
98b270362bb9ea Anton Altaparmakov 2005-10-11  1850  		 * need to bring uptodate any buffers that are only partially
98b270362bb9ea Anton Altaparmakov 2005-10-11  1851  		 * being written to.
98b270362bb9ea Anton Altaparmakov 2005-10-11  1852  		 */
98b270362bb9ea Anton Altaparmakov 2005-10-11  1853  		if (NInoNonResident(ni)) {
98b270362bb9ea Anton Altaparmakov 2005-10-11  1854  			status = ntfs_prepare_pages_for_non_resident_write(
98b270362bb9ea Anton Altaparmakov 2005-10-11  1855  					pages, do_pages, pos, bytes);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1856  			if (unlikely(status)) {
98b270362bb9ea Anton Altaparmakov 2005-10-11  1857  				do {
98b270362bb9ea Anton Altaparmakov 2005-10-11  1858  					unlock_page(pages[--do_pages]);
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  1859  					put_page(pages[do_pages]);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1860  				} while (do_pages);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1861  				break;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1862  			}
98b270362bb9ea Anton Altaparmakov 2005-10-11  1863  		}
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  1864  		u = (pos >> PAGE_SHIFT) - pages[0]->index;
a632f559304130 Anton Altaparmakov 2015-03-11  1865  		copied = ntfs_copy_from_user_iter(pages + u, do_pages - u, ofs,
a632f559304130 Anton Altaparmakov 2015-03-11  1866  					i, bytes);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1867  		ntfs_flush_dcache_pages(pages + u, do_pages - u);
a632f559304130 Anton Altaparmakov 2015-03-11  1868  		status = 0;
a632f559304130 Anton Altaparmakov 2015-03-11  1869  		if (likely(copied == bytes)) {
a632f559304130 Anton Altaparmakov 2015-03-11  1870  			status = ntfs_commit_pages_after_write(pages, do_pages,
a632f559304130 Anton Altaparmakov 2015-03-11  1871  					pos, bytes);
a632f559304130 Anton Altaparmakov 2015-03-11  1872  			if (!status)
a632f559304130 Anton Altaparmakov 2015-03-11  1873  				status = bytes;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1874  		}
98b270362bb9ea Anton Altaparmakov 2005-10-11  1875  		do {
98b270362bb9ea Anton Altaparmakov 2005-10-11  1876  			unlock_page(pages[--do_pages]);
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  1877  			put_page(pages[do_pages]);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1878  		} while (do_pages);
a632f559304130 Anton Altaparmakov 2015-03-11  1879  		if (unlikely(status < 0))
98b270362bb9ea Anton Altaparmakov 2005-10-11  1880  			break;
a632f559304130 Anton Altaparmakov 2015-03-11  1881  		copied = status;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1882  		cond_resched();
a632f559304130 Anton Altaparmakov 2015-03-11  1883  		if (unlikely(!copied)) {
a632f559304130 Anton Altaparmakov 2015-03-11  1884  			size_t sc;
a632f559304130 Anton Altaparmakov 2015-03-11  1885  
a632f559304130 Anton Altaparmakov 2015-03-11  1886  			/*
a632f559304130 Anton Altaparmakov 2015-03-11  1887  			 * We failed to copy anything.  Fall back to single
a632f559304130 Anton Altaparmakov 2015-03-11  1888  			 * segment length write.
a632f559304130 Anton Altaparmakov 2015-03-11  1889  			 *
a632f559304130 Anton Altaparmakov 2015-03-11  1890  			 * This is needed to avoid possible livelock in the
a632f559304130 Anton Altaparmakov 2015-03-11  1891  			 * case that all segments in the iov cannot be copied
a632f559304130 Anton Altaparmakov 2015-03-11  1892  			 * at once without a pagefault.
a632f559304130 Anton Altaparmakov 2015-03-11  1893  			 */
a632f559304130 Anton Altaparmakov 2015-03-11  1894  			sc = iov_iter_single_seg_count(i);
a632f559304130 Anton Altaparmakov 2015-03-11  1895  			if (bytes > sc)
a632f559304130 Anton Altaparmakov 2015-03-11  1896  				bytes = sc;
a632f559304130 Anton Altaparmakov 2015-03-11  1897  			goto again;
a632f559304130 Anton Altaparmakov 2015-03-11  1898  		}
a632f559304130 Anton Altaparmakov 2015-03-11  1899  		iov_iter_advance(i, copied);
a632f559304130 Anton Altaparmakov 2015-03-11  1900  		pos += copied;
a632f559304130 Anton Altaparmakov 2015-03-11  1901  		written += copied;
a632f559304130 Anton Altaparmakov 2015-03-11  1902  		balance_dirty_pages_ratelimited(mapping);
a632f559304130 Anton Altaparmakov 2015-03-11  1903  		if (fatal_signal_pending(current)) {
a632f559304130 Anton Altaparmakov 2015-03-11  1904  			status = -EINTR;
a632f559304130 Anton Altaparmakov 2015-03-11  1905  			break;
a632f559304130 Anton Altaparmakov 2015-03-11  1906  		}
a632f559304130 Anton Altaparmakov 2015-03-11  1907  	} while (iov_iter_count(i));
98b270362bb9ea Anton Altaparmakov 2005-10-11  1908  	if (cached_page)
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  1909  		put_page(cached_page);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1910  	ntfs_debug("Done.  Returning %s (written 0x%lx, status %li).",
98b270362bb9ea Anton Altaparmakov 2005-10-11  1911  			written ? "written" : "status", (unsigned long)written,
98b270362bb9ea Anton Altaparmakov 2005-10-11  1912  			(long)status);
98b270362bb9ea Anton Altaparmakov 2005-10-11  1913  	return written ? written : status;
98b270362bb9ea Anton Altaparmakov 2005-10-11  1914  }
98b270362bb9ea Anton Altaparmakov 2005-10-11  1915  

:::::: The code at line 1730 was first introduced by commit
:::::: a632f5593041305c8adbf4727bc1ccdf0b45178b NTFS: Version 2.1.32 - Update file write from aio_write to write_iter.

:::::: TO: Anton Altaparmakov <anton@...era.com>
:::::: CC: Al Viro <viro@...iv.linux.org.uk>

---
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" (30951 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ