[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202109011355.OGEYctXZ-lkp@intel.com>
Date: Wed, 1 Sep 2021 13:57:13 +0800
From: kernel test robot <lkp@...el.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org,
Nathan Chancellor <nathan@...nel.org>,
Kees Cook <keescook@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Memory Management List <linux-mm@...ck.org>
Subject: fs/ntfs/file.c:1727:16: warning: stack frame size (4352) exceeds
limit (2048) in function 'ntfs_perform_write'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9e9fb7655ed585da8f468e29221f0ba194a5f613
commit: 97e4910232fa1f81e806aa60c25a0450276d99a2 linux/compiler-clang.h: define HAVE_BUILTIN_BSWAP*
date: 6 months ago
config: mips-randconfig-r026-20210829 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 510e106fa8635e7f9c51c896180b971de6309b2f)
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
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=97e4910232fa1f81e806aa60c25a0450276d99a2
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 97e4910232fa1f81e806aa60c25a0450276d99a2
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=mips SHELL=/bin/bash block/ fs/ntfs/ fs/xfs/
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 >>):
>> fs/ntfs/file.c:1727:16: warning: stack frame size (4352) exceeds limit (2048) in function 'ntfs_perform_write'
static ssize_t ntfs_perform_write(struct file struct iov_iter
^
fatal error: error in backend: Nested variants found in inline asm string: ' .set push
.set mips64r2
.if ( 0x00 ) != -1)) 0x00 ) != -1)) : ($( static struct ftrace_branch_data __attribute__((__aligned__(4))) __attribute__((__section__("_ftrace_branch"))) __if_trace = $( .func = __func__, .file = "arch/mips/include/asm/bitops.h", .line = 133, $); 0x00 ) != -1)) : $))) ) && ( 0 ); .set push; .set mips64r2; .rept 1; sync 0x00; .endr; .set pop; .else; ; .endif
1: lld $0, $1
and $0, $2
scd $0, $1
beqz $0, 1b
.set pop
'
clang-14: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 14.0.0 (git://gitmirror/llvm_project 4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc)
Target: mips64-unknown-linux
Thread model: posix
InstalledDir: /opt/cross/clang-4b1fde8a2b/bin
clang-14: note: diagnostic msg:
Makefile arch block drivers fs include kernel mm net nr_bisected scripts source usr
vim +/ntfs_perform_write +1727 fs/ntfs/file.c
9014da7525dffe Marco Stornelli 2012-12-15 1720
98b270362bb9ea Anton Altaparmakov 2005-10-11 1721 /**
a632f559304130 Anton Altaparmakov 2015-03-11 1722 * ntfs_perform_write - perform buffered write to a file
a632f559304130 Anton Altaparmakov 2015-03-11 1723 * @file: file to write to
a632f559304130 Anton Altaparmakov 2015-03-11 1724 * @i: iov_iter with data to write
a632f559304130 Anton Altaparmakov 2015-03-11 1725 * @pos: byte offset in file at which to begin writing to
98b270362bb9ea Anton Altaparmakov 2005-10-11 1726 */
a632f559304130 Anton Altaparmakov 2015-03-11 @1727 static ssize_t ntfs_perform_write(struct file *file, struct iov_iter *i,
a632f559304130 Anton Altaparmakov 2015-03-11 1728 loff_t pos)
98b270362bb9ea Anton Altaparmakov 2005-10-11 1729 {
98b270362bb9ea Anton Altaparmakov 2005-10-11 1730 struct address_space *mapping = file->f_mapping;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1731 struct inode *vi = mapping->host;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1732 ntfs_inode *ni = NTFS_I(vi);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1733 ntfs_volume *vol = ni->vol;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1734 struct page *pages[NTFS_MAX_PAGES_PER_CLUSTER];
98b270362bb9ea Anton Altaparmakov 2005-10-11 1735 struct page *cached_page = NULL;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1736 VCN last_vcn;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1737 LCN lcn;
a632f559304130 Anton Altaparmakov 2015-03-11 1738 size_t bytes;
a632f559304130 Anton Altaparmakov 2015-03-11 1739 ssize_t status, written = 0;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1740 unsigned nr_pages;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1741
a632f559304130 Anton Altaparmakov 2015-03-11 1742 ntfs_debug("Entering for i_ino 0x%lx, attribute type 0x%x, pos "
a632f559304130 Anton Altaparmakov 2015-03-11 1743 "0x%llx, count 0x%lx.", vi->i_ino,
a632f559304130 Anton Altaparmakov 2015-03-11 1744 (unsigned)le32_to_cpu(ni->type),
a632f559304130 Anton Altaparmakov 2015-03-11 1745 (unsigned long long)pos,
a632f559304130 Anton Altaparmakov 2015-03-11 1746 (unsigned long)iov_iter_count(i));
98b270362bb9ea Anton Altaparmakov 2005-10-11 1747 /*
98b270362bb9ea Anton Altaparmakov 2005-10-11 1748 * If a previous ntfs_truncate() failed, repeat it and abort if it
98b270362bb9ea Anton Altaparmakov 2005-10-11 1749 * fails again.
98b270362bb9ea Anton Altaparmakov 2005-10-11 1750 */
98b270362bb9ea Anton Altaparmakov 2005-10-11 1751 if (unlikely(NInoTruncateFailed(ni))) {
a632f559304130 Anton Altaparmakov 2015-03-11 1752 int err;
a632f559304130 Anton Altaparmakov 2015-03-11 1753
bd5fe6c5eb9c54 Christoph Hellwig 2011-06-24 1754 inode_dio_wait(vi);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1755 err = ntfs_truncate(vi);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1756 if (err || NInoTruncateFailed(ni)) {
98b270362bb9ea Anton Altaparmakov 2005-10-11 1757 if (!err)
98b270362bb9ea Anton Altaparmakov 2005-10-11 1758 err = -EIO;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1759 ntfs_error(vol->sb, "Cannot perform write to inode "
98b270362bb9ea Anton Altaparmakov 2005-10-11 1760 "0x%lx, attribute type 0x%x, because "
98b270362bb9ea Anton Altaparmakov 2005-10-11 1761 "ntfs_truncate() failed (error code "
98b270362bb9ea Anton Altaparmakov 2005-10-11 1762 "%i).", vi->i_ino,
98b270362bb9ea Anton Altaparmakov 2005-10-11 1763 (unsigned)le32_to_cpu(ni->type), err);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1764 return err;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1765 }
98b270362bb9ea Anton Altaparmakov 2005-10-11 1766 }
98b270362bb9ea Anton Altaparmakov 2005-10-11 1767 /*
98b270362bb9ea Anton Altaparmakov 2005-10-11 1768 * Determine the number of pages per cluster for non-resident
98b270362bb9ea Anton Altaparmakov 2005-10-11 1769 * attributes.
98b270362bb9ea Anton Altaparmakov 2005-10-11 1770 */
98b270362bb9ea Anton Altaparmakov 2005-10-11 1771 nr_pages = 1;
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 1772 if (vol->cluster_size > PAGE_SIZE && NInoNonResident(ni))
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 1773 nr_pages = vol->cluster_size >> PAGE_SHIFT;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1774 last_vcn = -1;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1775 do {
98b270362bb9ea Anton Altaparmakov 2005-10-11 1776 VCN vcn;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1777 pgoff_t idx, start_idx;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1778 unsigned ofs, do_pages, u;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1779 size_t copied;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1780
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 1781 start_idx = idx = pos >> PAGE_SHIFT;
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 1782 ofs = pos & ~PAGE_MASK;
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 1783 bytes = PAGE_SIZE - ofs;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1784 do_pages = 1;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1785 if (nr_pages > 1) {
98b270362bb9ea Anton Altaparmakov 2005-10-11 1786 vcn = pos >> vol->cluster_size_bits;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1787 if (vcn != last_vcn) {
98b270362bb9ea Anton Altaparmakov 2005-10-11 1788 last_vcn = vcn;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1789 /*
98b270362bb9ea Anton Altaparmakov 2005-10-11 1790 * Get the lcn of the vcn the write is in. If
98b270362bb9ea Anton Altaparmakov 2005-10-11 1791 * it is a hole, need to lock down all pages in
98b270362bb9ea Anton Altaparmakov 2005-10-11 1792 * the cluster.
98b270362bb9ea Anton Altaparmakov 2005-10-11 1793 */
98b270362bb9ea Anton Altaparmakov 2005-10-11 1794 down_read(&ni->runlist.lock);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1795 lcn = ntfs_attr_vcn_to_lcn_nolock(ni, pos >>
c49c31115067bc Richard Knutsson 2006-09-30 1796 vol->cluster_size_bits, false);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1797 up_read(&ni->runlist.lock);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1798 if (unlikely(lcn < LCN_HOLE)) {
98b270362bb9ea Anton Altaparmakov 2005-10-11 1799 if (lcn == LCN_ENOMEM)
98b270362bb9ea Anton Altaparmakov 2005-10-11 1800 status = -ENOMEM;
a632f559304130 Anton Altaparmakov 2015-03-11 1801 else {
a632f559304130 Anton Altaparmakov 2015-03-11 1802 status = -EIO;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1803 ntfs_error(vol->sb, "Cannot "
98b270362bb9ea Anton Altaparmakov 2005-10-11 1804 "perform write to "
98b270362bb9ea Anton Altaparmakov 2005-10-11 1805 "inode 0x%lx, "
98b270362bb9ea Anton Altaparmakov 2005-10-11 1806 "attribute type 0x%x, "
98b270362bb9ea Anton Altaparmakov 2005-10-11 1807 "because the attribute "
98b270362bb9ea Anton Altaparmakov 2005-10-11 1808 "is corrupt.",
98b270362bb9ea Anton Altaparmakov 2005-10-11 1809 vi->i_ino, (unsigned)
98b270362bb9ea Anton Altaparmakov 2005-10-11 1810 le32_to_cpu(ni->type));
a632f559304130 Anton Altaparmakov 2015-03-11 1811 }
98b270362bb9ea Anton Altaparmakov 2005-10-11 1812 break;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1813 }
98b270362bb9ea Anton Altaparmakov 2005-10-11 1814 if (lcn == LCN_HOLE) {
98b270362bb9ea Anton Altaparmakov 2005-10-11 1815 start_idx = (pos & ~(s64)
98b270362bb9ea Anton Altaparmakov 2005-10-11 1816 vol->cluster_size_mask)
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 1817 >> PAGE_SHIFT;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1818 bytes = vol->cluster_size - (pos &
98b270362bb9ea Anton Altaparmakov 2005-10-11 1819 vol->cluster_size_mask);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1820 do_pages = nr_pages;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1821 }
98b270362bb9ea Anton Altaparmakov 2005-10-11 1822 }
98b270362bb9ea Anton Altaparmakov 2005-10-11 1823 }
a632f559304130 Anton Altaparmakov 2015-03-11 1824 if (bytes > iov_iter_count(i))
a632f559304130 Anton Altaparmakov 2015-03-11 1825 bytes = iov_iter_count(i);
a632f559304130 Anton Altaparmakov 2015-03-11 1826 again:
98b270362bb9ea Anton Altaparmakov 2005-10-11 1827 /*
98b270362bb9ea Anton Altaparmakov 2005-10-11 1828 * Bring in the user page(s) that we will copy from _first_.
98b270362bb9ea Anton Altaparmakov 2005-10-11 1829 * Otherwise there is a nasty deadlock on copying from the same
98b270362bb9ea Anton Altaparmakov 2005-10-11 1830 * page(s) as we are writing to, without it/them being marked
98b270362bb9ea Anton Altaparmakov 2005-10-11 1831 * up-to-date. Note, at present there is nothing to stop the
98b270362bb9ea Anton Altaparmakov 2005-10-11 1832 * pages being swapped out between us bringing them into memory
98b270362bb9ea Anton Altaparmakov 2005-10-11 1833 * and doing the actual copying.
98b270362bb9ea Anton Altaparmakov 2005-10-11 1834 */
4bce9f6ee8f84f Al Viro 2016-09-17 1835 if (unlikely(iov_iter_fault_in_readable(i, bytes))) {
a632f559304130 Anton Altaparmakov 2015-03-11 1836 status = -EFAULT;
a632f559304130 Anton Altaparmakov 2015-03-11 1837 break;
a632f559304130 Anton Altaparmakov 2015-03-11 1838 }
98b270362bb9ea Anton Altaparmakov 2005-10-11 1839 /* Get and lock @do_pages starting at index @start_idx. */
98b270362bb9ea Anton Altaparmakov 2005-10-11 1840 status = __ntfs_grab_cache_pages(mapping, start_idx, do_pages,
4c99000ac47cbd Minchan Kim 2010-05-24 1841 pages, &cached_page);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1842 if (unlikely(status))
98b270362bb9ea Anton Altaparmakov 2005-10-11 1843 break;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1844 /*
98b270362bb9ea Anton Altaparmakov 2005-10-11 1845 * For non-resident attributes, we need to fill any holes with
98b270362bb9ea Anton Altaparmakov 2005-10-11 1846 * actual clusters and ensure all bufferes are mapped. We also
98b270362bb9ea Anton Altaparmakov 2005-10-11 1847 * need to bring uptodate any buffers that are only partially
98b270362bb9ea Anton Altaparmakov 2005-10-11 1848 * being written to.
98b270362bb9ea Anton Altaparmakov 2005-10-11 1849 */
98b270362bb9ea Anton Altaparmakov 2005-10-11 1850 if (NInoNonResident(ni)) {
98b270362bb9ea Anton Altaparmakov 2005-10-11 1851 status = ntfs_prepare_pages_for_non_resident_write(
98b270362bb9ea Anton Altaparmakov 2005-10-11 1852 pages, do_pages, pos, bytes);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1853 if (unlikely(status)) {
98b270362bb9ea Anton Altaparmakov 2005-10-11 1854 do {
98b270362bb9ea Anton Altaparmakov 2005-10-11 1855 unlock_page(pages[--do_pages]);
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 1856 put_page(pages[do_pages]);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1857 } while (do_pages);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1858 break;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1859 }
98b270362bb9ea Anton Altaparmakov 2005-10-11 1860 }
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 1861 u = (pos >> PAGE_SHIFT) - pages[0]->index;
a632f559304130 Anton Altaparmakov 2015-03-11 1862 copied = ntfs_copy_from_user_iter(pages + u, do_pages - u, ofs,
a632f559304130 Anton Altaparmakov 2015-03-11 1863 i, bytes);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1864 ntfs_flush_dcache_pages(pages + u, do_pages - u);
a632f559304130 Anton Altaparmakov 2015-03-11 1865 status = 0;
a632f559304130 Anton Altaparmakov 2015-03-11 1866 if (likely(copied == bytes)) {
a632f559304130 Anton Altaparmakov 2015-03-11 1867 status = ntfs_commit_pages_after_write(pages, do_pages,
a632f559304130 Anton Altaparmakov 2015-03-11 1868 pos, bytes);
a632f559304130 Anton Altaparmakov 2015-03-11 1869 if (!status)
a632f559304130 Anton Altaparmakov 2015-03-11 1870 status = bytes;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1871 }
98b270362bb9ea Anton Altaparmakov 2005-10-11 1872 do {
98b270362bb9ea Anton Altaparmakov 2005-10-11 1873 unlock_page(pages[--do_pages]);
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 1874 put_page(pages[do_pages]);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1875 } while (do_pages);
a632f559304130 Anton Altaparmakov 2015-03-11 1876 if (unlikely(status < 0))
98b270362bb9ea Anton Altaparmakov 2005-10-11 1877 break;
a632f559304130 Anton Altaparmakov 2015-03-11 1878 copied = status;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1879 cond_resched();
a632f559304130 Anton Altaparmakov 2015-03-11 1880 if (unlikely(!copied)) {
a632f559304130 Anton Altaparmakov 2015-03-11 1881 size_t sc;
a632f559304130 Anton Altaparmakov 2015-03-11 1882
a632f559304130 Anton Altaparmakov 2015-03-11 1883 /*
a632f559304130 Anton Altaparmakov 2015-03-11 1884 * We failed to copy anything. Fall back to single
a632f559304130 Anton Altaparmakov 2015-03-11 1885 * segment length write.
a632f559304130 Anton Altaparmakov 2015-03-11 1886 *
a632f559304130 Anton Altaparmakov 2015-03-11 1887 * This is needed to avoid possible livelock in the
a632f559304130 Anton Altaparmakov 2015-03-11 1888 * case that all segments in the iov cannot be copied
a632f559304130 Anton Altaparmakov 2015-03-11 1889 * at once without a pagefault.
a632f559304130 Anton Altaparmakov 2015-03-11 1890 */
a632f559304130 Anton Altaparmakov 2015-03-11 1891 sc = iov_iter_single_seg_count(i);
a632f559304130 Anton Altaparmakov 2015-03-11 1892 if (bytes > sc)
a632f559304130 Anton Altaparmakov 2015-03-11 1893 bytes = sc;
a632f559304130 Anton Altaparmakov 2015-03-11 1894 goto again;
a632f559304130 Anton Altaparmakov 2015-03-11 1895 }
a632f559304130 Anton Altaparmakov 2015-03-11 1896 iov_iter_advance(i, copied);
a632f559304130 Anton Altaparmakov 2015-03-11 1897 pos += copied;
a632f559304130 Anton Altaparmakov 2015-03-11 1898 written += copied;
a632f559304130 Anton Altaparmakov 2015-03-11 1899 balance_dirty_pages_ratelimited(mapping);
a632f559304130 Anton Altaparmakov 2015-03-11 1900 if (fatal_signal_pending(current)) {
a632f559304130 Anton Altaparmakov 2015-03-11 1901 status = -EINTR;
a632f559304130 Anton Altaparmakov 2015-03-11 1902 break;
a632f559304130 Anton Altaparmakov 2015-03-11 1903 }
a632f559304130 Anton Altaparmakov 2015-03-11 1904 } while (iov_iter_count(i));
98b270362bb9ea Anton Altaparmakov 2005-10-11 1905 if (cached_page)
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 1906 put_page(cached_page);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1907 ntfs_debug("Done. Returning %s (written 0x%lx, status %li).",
98b270362bb9ea Anton Altaparmakov 2005-10-11 1908 written ? "written" : "status", (unsigned long)written,
98b270362bb9ea Anton Altaparmakov 2005-10-11 1909 (long)status);
98b270362bb9ea Anton Altaparmakov 2005-10-11 1910 return written ? written : status;
98b270362bb9ea Anton Altaparmakov 2005-10-11 1911 }
98b270362bb9ea Anton Altaparmakov 2005-10-11 1912
:::::: The code at line 1727 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" (29725 bytes)
Powered by blists - more mailing lists