linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Igor Stoppa <igor.stoppa@huawei.com>
Cc: kbuild-all@01.org, david@fromorbit.com, willy@infradead.org,
	keescook@chromium.org, mhocko@kernel.org, labbott@redhat.com,
	linux-security-module@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	kernel-hardening@lists.openwall.com
Subject: Re: [PATCH 1/7] genalloc: track beginning of allocations
Date: Sat, 3 Mar 2018 00:47:07 +0800	[thread overview]
Message-ID: <201803030033.qwnGJuxP%fengguang.wu@intel.com> (raw)
In-Reply-To: <20180228200620.30026-2-igor.stoppa@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 7289 bytes --]

Hi Igor,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on next-20180223]
[also build test WARNING on v4.16-rc3]
[cannot apply to linus/master mmotm/master char-misc/char-misc-testing v4.16-rc3 v4.16-rc2 v4.16-rc1]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Igor-Stoppa/mm-security-ro-protection-for-dynamic-data/20180302-232215
config: i386-randconfig-x007-201808 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/bug.h:83:0,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:15,
                    from lib/genalloc.c:99:
   lib/genalloc.c: In function 'gen_pool_free':
   lib/genalloc.c:616:10: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'struct gen_pool *' [-Wformat=]
             "Trying to free unallocated memory"
             ^
   include/asm-generic/bug.h:98:50: note: in definition of macro '__WARN_printf'
    #define __WARN_printf(arg...) do { __warn_printk(arg); __WARN(); } while (0)
                                                     ^~~
   lib/genalloc.c:615:5: note: in expansion of macro 'WARN'
        WARN(true,
        ^~~~
   lib/genalloc.c:617:23: note: format string is defined here
             " from pool %s", pool);
                         ~^
   In file included from include/asm-generic/bug.h:5:0,
                    from arch/x86/include/asm/bug.h:83,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:15,
                    from lib/genalloc.c:99:
   lib/genalloc.c:624:17: error: implicit declaration of function 'exit_test'; did you mean 'exit_sem'? [-Werror=implicit-function-declaration]
       if (unlikely(exit_test(boundary < 0))) {
                    ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> lib/genalloc.c:624:4: note: in expansion of macro 'if'
       if (unlikely(exit_test(boundary < 0))) {
       ^~
   include/linux/compiler.h:48:24: note: in expansion of macro '__branch_check__'
    #  define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
                           ^~~~~~~~~~~~~~~~
>> lib/genalloc.c:624:8: note: in expansion of macro 'unlikely'
       if (unlikely(exit_test(boundary < 0))) {
           ^~~~~~~~
   In file included from arch/x86/include/asm/bug.h:83:0,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:15,
                    from lib/genalloc.c:99:
   lib/genalloc.c:626:16: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'struct gen_pool *' [-Wformat=]
        WARN(true, "Corrupted pool %s", pool);
                   ^
   include/asm-generic/bug.h:98:50: note: in definition of macro '__WARN_printf'
    #define __WARN_printf(arg...) do { __warn_printk(arg); __WARN(); } while (0)
                                                     ^~~
   lib/genalloc.c:626:5: note: in expansion of macro 'WARN'
        WARN(true, "Corrupted pool %s", pool);
        ^~~~
   lib/genalloc.c:634:10: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'struct gen_pool *' [-Wformat=]
             "Size provided differs from size "
             ^
   include/asm-generic/bug.h:98:50: note: in definition of macro '__WARN_printf'
    #define __WARN_printf(arg...) do { __warn_printk(arg); __WARN(); } while (0)
                                                     ^~~
   lib/genalloc.c:633:5: note: in expansion of macro 'WARN'
        WARN(true,
        ^~~~
   lib/genalloc.c:635:31: note: format string is defined here
             "measured from pool %s", pool);
                                 ~^
   In file included from arch/x86/include/asm/bug.h:83:0,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:15,
                    from lib/genalloc.c:99:
   lib/genalloc.c:643:10: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'struct gen_pool *' [-Wformat=]
             "Unexpected bitmap collision while"
             ^
   include/asm-generic/bug.h:98:50: note: in definition of macro '__WARN_printf'
    #define __WARN_printf(arg...) do { __warn_printk(arg); __WARN(); } while (0)
                                                     ^~~
   lib/genalloc.c:642:5: note: in expansion of macro 'WARN'
        WARN(true,
        ^~~~
   lib/genalloc.c:644:36: note: format string is defined here
             " freeing memory in pool %s", pool);
                                      ~^
   cc1: some warnings being treated as errors

vim +/if +624 lib/genalloc.c

   609	
   610		rcu_read_lock();
   611		list_for_each_entry_rcu(chunk, &pool->chunks, next_chunk) {
   612			if (addr >= chunk->start_addr && addr <= chunk->end_addr) {
   613				if (unlikely(addr + size - 1 > chunk->end_addr)) {
   614					rcu_read_unlock();
   615					WARN(true,
   616					     "Trying to free unallocated memory"
   617					     " from pool %s", pool);
   618					return;
   619				}
   620				start_entry = (addr - chunk->start_addr) >> order;
   621				remaining_entries = (chunk->end_addr - addr) >> order;
   622				boundary = get_boundary(chunk->entries, start_entry,
   623							remaining_entries);
 > 624				if (unlikely(exit_test(boundary < 0))) {
   625					rcu_read_unlock();
   626					WARN(true, "Corrupted pool %s", pool);
   627					return;
   628				}
   629				nentries = boundary - start_entry;
   630				if (unlikely(size && (nentries !=
   631						      mem_to_units(size, order)))) {
   632					rcu_read_unlock();
   633					WARN(true,
   634					     "Size provided differs from size "
   635					     "measured from pool %s", pool);
   636					return;
   637				}
   638				remain = alter_bitmap_ll(CLEAR_BITS, chunk->entries,
   639							 start_entry, nentries);
   640				if (unlikely(remain)) {
   641					rcu_read_unlock();
   642					WARN(true,
   643					     "Unexpected bitmap collision while"
   644					     " freeing memory in pool %s", pool);
   645					return;
   646				}
   647				atomic_long_add(nentries << order, &chunk->avail);
   648				rcu_read_unlock();
   649				return;
   650			}
   651		}
   652		rcu_read_unlock();
   653		WARN(true, "address not found in pool %s", pool->name);
   654	}
   655	EXPORT_SYMBOL(gen_pool_free);
   656	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25964 bytes --]

  parent reply	other threads:[~2018-03-02 16:47 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 20:06 [RFC PATCH v18 0/7] mm: security: ro protection for dynamic data Igor Stoppa
2018-02-28 20:06 ` [PATCH 1/7] genalloc: track beginning of allocations Igor Stoppa
2018-03-02 16:37   ` kbuild test robot
2018-03-02 16:47   ` kbuild test robot [this message]
2018-03-05 19:00   ` J Freyensee
2018-03-06 17:39     ` Igor Stoppa
2018-03-06 13:19   ` Mike Rapoport
2018-03-06 14:13     ` Matthew Wilcox
2018-03-07 14:48     ` Igor Stoppa
2018-03-07 15:46       ` Igor Stoppa
2018-03-07 17:44       ` Mike Rapoprt
2018-03-06 14:10   ` Matthew Wilcox
2018-03-06 16:05     ` Igor Stoppa
2018-03-07 10:51       ` Igor Stoppa
2018-02-28 20:06 ` [PATCH 2/7] genalloc: selftest Igor Stoppa
2018-03-05 19:37   ` J Freyensee
2018-02-28 20:06 ` [PATCH 3/7] struct page: add field for vm_struct Igor Stoppa
2018-03-03  2:35   ` kbuild test robot
2018-03-05 20:31   ` J Freyensee
2018-02-28 20:06 ` [PATCH 4/7] Protectable Memory Igor Stoppa
2018-03-06  3:59   ` J Freyensee
2018-03-07 14:07     ` Igor Stoppa
2018-03-12 19:13   ` Matthew Wilcox
2018-03-12 21:25     ` Igor Stoppa
2018-02-28 20:06 ` [PATCH 5/7] Pmalloc selftest Igor Stoppa
2018-03-03  6:59   ` kbuild test robot
2018-03-06 17:13   ` J Freyensee
2018-02-28 20:06 ` [PATCH 6/7] lkdtm: crash on overwriting protected pmalloc var Igor Stoppa
2018-03-06 17:20   ` J Freyensee
2018-03-07 13:18     ` Igor Stoppa
2018-03-07 17:26       ` J Freyensee
2018-02-28 20:06 ` [PATCH 7/7] Documentation for Pmalloc Igor Stoppa
2018-03-06 13:30   ` Mike Rapoport
2018-03-06 17:33   ` J Freyensee
  -- strict thread matches above, loose matches on Subject: below --
2018-02-23 14:48 [RFC PATCH v17 0/7] mm: security: ro protection for dynamic data Igor Stoppa
2018-02-23 14:48 ` [PATCH 1/7] genalloc: track beginning of allocations Igor Stoppa
2018-02-23 22:28   ` J Freyensee
2018-02-26 12:09     ` Igor Stoppa
2018-02-26 17:32       ` J Freyensee
2018-02-26 18:44         ` Igor Stoppa
2018-02-25  3:37   ` kbuild test robot

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=201803030033.qwnGJuxP%fengguang.wu@intel.com \
    --to=lkp@intel.com \
    --cc=david@fromorbit.com \
    --cc=igor.stoppa@huawei.com \
    --cc=kbuild-all@01.org \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=labbott@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mhocko@kernel.org \
    --cc=willy@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox