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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 16 Nov 2022 15:02:03 +0800
From:   kernel test robot <lkp@...el.com>
To:     Nhat Pham <nphamcs@...il.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Cc:     llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
        hannes@...xchg.org
Subject: Re: [PATCH 3/4] cachestat: implement cachestat syscall

Hi Nhat,

I love your patch! Yet something to improve:

[auto build test ERROR on shuah-kselftest/next]
[also build test ERROR on shuah-kselftest/fixes tip/x86/asm arnd-asm-generic/master linus/master v6.1-rc5 next-20221115]
[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/Nhat-Pham/cachestat-a-new-syscall-for-page-cache-state-of-files/20221116-023042
base:   https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next
patch link:    https://lore.kernel.org/r/20221115182901.2755368-4-nphamcs%40gmail.com
patch subject: [PATCH 3/4] cachestat: implement cachestat syscall
config: arm-buildonly-randconfig-r001-20221115
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 463da45892e2d2a262277b91b96f5f8c05dc25d0)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/intel-lab-lkp/linux/commit/e0d55eece256958cfaec0dd2842bf0edced26150
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Nhat-Pham/cachestat-a-new-syscall-for-page-cache-state-of-files/20221116-023042
        git checkout e0d55eece256958cfaec0dd2842bf0edced26150
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash kernel/time/ mm/ prepare

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

All error/warnings (new ones prefixed by >>):

>> <stdin>:1565:2: warning: syscall cachestat not implemented [-W#warnings]
   #warning syscall cachestat not implemented
    ^
   1 warning generated.
--
   In file included from kernel/time/time.c:33:
>> include/linux/syscalls.h:1060:9: warning: declaration of 'struct cachestat' will not be visible outside of this function [-Wvisibility]
           struct cachestat __user *ret_cstat);
                  ^
   1 warning generated.
--
   In file included from kernel/time/timer.c:35:
>> include/linux/syscalls.h:1060:9: warning: declaration of 'struct cachestat' will not be visible outside of this function [-Wvisibility]
           struct cachestat __user *ret_cstat);
                  ^
   kernel/time/timer.c:1365:20: warning: unused function 'del_timer_wait_running' [-Wunused-function]
   static inline void del_timer_wait_running(struct timer_list *timer) { }
                      ^
   2 warnings generated.
--
   In file included from kernel/time/hrtimer.c:30:
>> include/linux/syscalls.h:1060:9: warning: declaration of 'struct cachestat' will not be visible outside of this function [-Wvisibility]
           struct cachestat __user *ret_cstat);
                  ^
   kernel/time/hrtimer.c:120:21: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [CLOCK_REALTIME]        = HRTIMER_BASE_REALTIME,
                                     ^~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:118:27: note: previous initialization is here
           [0 ... MAX_CLOCKS - 1]  = HRTIMER_MAX_CLOCK_BASES,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:121:22: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [CLOCK_MONOTONIC]       = HRTIMER_BASE_MONOTONIC,
                                     ^~~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:118:27: note: previous initialization is here
           [0 ... MAX_CLOCKS - 1]  = HRTIMER_MAX_CLOCK_BASES,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:122:21: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [CLOCK_BOOTTIME]        = HRTIMER_BASE_BOOTTIME,
                                     ^~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:118:27: note: previous initialization is here
           [0 ... MAX_CLOCKS - 1]  = HRTIMER_MAX_CLOCK_BASES,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:123:17: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [CLOCK_TAI]             = HRTIMER_BASE_TAI,
                                     ^~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:118:27: note: previous initialization is here
           [0 ... MAX_CLOCKS - 1]  = HRTIMER_MAX_CLOCK_BASES,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:1648:7: warning: variable 'expires_in_hardirq' set but not used [-Wunused-but-set-variable]
           bool expires_in_hardirq;
                ^
   kernel/time/hrtimer.c:276:20: warning: unused function 'is_migration_base' [-Wunused-function]
   static inline bool is_migration_base(struct hrtimer_clock_base *base)
                      ^
   kernel/time/hrtimer.c:650:19: warning: unused function 'hrtimer_hres_active' [-Wunused-function]
   static inline int hrtimer_hres_active(void)
                     ^
   kernel/time/hrtimer.c:1887:20: warning: unused function '__hrtimer_peek_ahead_timers' [-Wunused-function]
   static inline void __hrtimer_peek_ahead_timers(void) { }
                      ^
   9 warnings generated.
--
   In file included from mm/cachestat.c:8:
>> include/linux/syscalls.h:1060:9: warning: declaration of 'struct cachestat' will not be visible outside of this function [-Wvisibility]
           struct cachestat __user *ret_cstat);
                  ^
>> mm/cachestat.c:37:1: error: conflicting types for 'sys_cachestat'
   SYSCALL_DEFINE4(cachestat, unsigned int, fd, off_t, off, size_t, len,
   ^
   include/linux/syscalls.h:220:36: note: expanded from macro 'SYSCALL_DEFINE4'
   #define SYSCALL_DEFINE4(name, ...) SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
                                      ^
   include/linux/syscalls.h:228:2: note: expanded from macro 'SYSCALL_DEFINEx'
           __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
           ^
   include/linux/syscalls.h:242:18: note: expanded from macro '__SYSCALL_DEFINEx'
           asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))       \
                           ^
   <scratch space>:109:1: note: expanded from here
   sys_cachestat
   ^
   include/linux/syscalls.h:1059:17: note: previous declaration is here
   asmlinkage long sys_cachestat(unsigned int fd, off_t off, size_t len,
                   ^
>> mm/cachestat.c:76:24: error: call to undeclared function 'radix_to_swp_entry'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                                           swp_entry_t swp = radix_to_swp_entry(folio);
                                                             ^
>> mm/cachestat.c:76:18: error: initializing 'swp_entry_t' with an expression of incompatible type 'int'
                                           swp_entry_t swp = radix_to_swp_entry(folio);
                                                       ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning and 3 errors generated.
--
>> <stdin>:1565:2: warning: syscall cachestat not implemented [-W#warnings]
   #warning syscall cachestat not implemented
    ^
   1 warning generated.


vim +/sys_cachestat +37 mm/cachestat.c

    15	
    16	/*
    17	 * The cachestat(3) system call.
    18	 *
    19	 * cachestat() returns the page cache status of a file in the
    20	 * bytes specified by `off` and `len`: number of cached pages,
    21	 * number of dirty pages, number of pages marked for writeback,
    22	 * number of (recently) evicted pages.
    23	 *
    24	 * If `off` + `len` >= `off`, the queried range is [`off`, `off` + `len`].
    25	 * Otherwise, we will query in the range from `off` to the end of the file.
    26	 *
    27	 * Because the status of a page can change after cachestat() checks it
    28	 * but before it returns to the application, the returned values may
    29	 * contain stale information.
    30	 *
    31	 * return values:
    32	 *  zero    - success
    33	 *  -EFAULT - cstat points to an illegal address
    34	 *  -EINVAL - invalid arguments
    35	 *  -EBADF	- invalid file descriptor
    36	 */
  > 37	SYSCALL_DEFINE4(cachestat, unsigned int, fd, off_t, off, size_t, len,
    38		struct cachestat __user *, cstat)
    39	{
    40		struct fd f;
    41		struct cachestat cs;
    42	
    43		memset(&cs, 0, sizeof(struct cachestat));
    44	
    45		if (off < 0)
    46			return -EINVAL;
    47	
    48		if (!access_ok(cstat, sizeof(struct cachestat)))
    49			return -EFAULT;
    50	
    51		f = fdget(fd);
    52		if (f.file) {
    53			struct address_space *mapping = f.file->f_mapping;
    54			pgoff_t first_index = off >> PAGE_SHIFT;
    55			XA_STATE(xas, &mapping->i_pages, first_index);
    56			struct folio *folio;
    57			pgoff_t last_index = (off + len - 1) >> PAGE_SHIFT;
    58	
    59			if (last_index < first_index)
    60				last_index = ULONG_MAX;
    61	
    62			rcu_read_lock();
    63			xas_for_each(&xas, folio, last_index) {
    64				if (xas_retry(&xas, folio) || !folio)
    65					continue;
    66	
    67				if (xa_is_value(folio)) {
    68					/* page is evicted */
    69					void *shadow;
    70					bool workingset; /* not used */
    71	
    72					cs.nr_evicted += 1;
    73	
    74					if (shmem_mapping(mapping)) {
    75						/* shmem file - in swap cache */
  > 76						swp_entry_t swp = radix_to_swp_entry(folio);

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (120242 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ