Re: [PATCH 1/3] kcov: remove #ifdef CONFIG_RANDOMIZE_BASE

From: kbuild test robot
Date: Thu Sep 21 2017 - 18:17:02 EST


Hi Andrey,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.14-rc1 next-20170921]
[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/Andrey-Ryabinin/kcov-remove-ifdef-CONFIG_RANDOMIZE_BASE/20170922-035755
config: s390-allmodconfig (attached as .config)
compiler: s390x-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=s390

All errors (new ones prefixed by >>):

kernel/kcov.c: In function '__sanitizer_cov_trace_pc':
>> kernel/kcov.c:72:9: error: implicit declaration of function 'kaslr_offset' [-Werror=implicit-function-declaration]
ip -= kaslr_offset();
^~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/kaslr_offset +72 kernel/kcov.c

5c9a8750 Dmitry Vyukov 2016-03-22 49
5c9a8750 Dmitry Vyukov 2016-03-22 50 /*
5c9a8750 Dmitry Vyukov 2016-03-22 51 * Entry point from instrumented code.
5c9a8750 Dmitry Vyukov 2016-03-22 52 * This is called once per basic-block/edge.
5c9a8750 Dmitry Vyukov 2016-03-22 53 */
bdab42df James Morse 2016-04-28 54 void notrace __sanitizer_cov_trace_pc(void)
5c9a8750 Dmitry Vyukov 2016-03-22 55 {
5c9a8750 Dmitry Vyukov 2016-03-22 56 struct task_struct *t;
5c9a8750 Dmitry Vyukov 2016-03-22 57 enum kcov_mode mode;
5c9a8750 Dmitry Vyukov 2016-03-22 58
5c9a8750 Dmitry Vyukov 2016-03-22 59 t = current;
5c9a8750 Dmitry Vyukov 2016-03-22 60 /*
5c9a8750 Dmitry Vyukov 2016-03-22 61 * We are interested in code coverage as a function of a syscall inputs,
5c9a8750 Dmitry Vyukov 2016-03-22 62 * so we ignore code executed in interrupts.
5c9a8750 Dmitry Vyukov 2016-03-22 63 */
f61e869d Dmitry Vyukov 2017-05-08 64 if (!t || !in_task())
5c9a8750 Dmitry Vyukov 2016-03-22 65 return;
5c9a8750 Dmitry Vyukov 2016-03-22 66 mode = READ_ONCE(t->kcov_mode);
5c9a8750 Dmitry Vyukov 2016-03-22 67 if (mode == KCOV_MODE_TRACE) {
5c9a8750 Dmitry Vyukov 2016-03-22 68 unsigned long *area;
5c9a8750 Dmitry Vyukov 2016-03-22 69 unsigned long pos;
4983f0ab Alexander Popov 2016-12-19 70 unsigned long ip = _RET_IP_;
4983f0ab Alexander Popov 2016-12-19 71
4983f0ab Alexander Popov 2016-12-19 @72 ip -= kaslr_offset();
5c9a8750 Dmitry Vyukov 2016-03-22 73
5c9a8750 Dmitry Vyukov 2016-03-22 74 /*
5c9a8750 Dmitry Vyukov 2016-03-22 75 * There is some code that runs in interrupts but for which
5c9a8750 Dmitry Vyukov 2016-03-22 76 * in_interrupt() returns false (e.g. preempt_schedule_irq()).
5c9a8750 Dmitry Vyukov 2016-03-22 77 * READ_ONCE()/barrier() effectively provides load-acquire wrt
5c9a8750 Dmitry Vyukov 2016-03-22 78 * interrupts, there are paired barrier()/WRITE_ONCE() in
5c9a8750 Dmitry Vyukov 2016-03-22 79 * kcov_ioctl_locked().
5c9a8750 Dmitry Vyukov 2016-03-22 80 */
5c9a8750 Dmitry Vyukov 2016-03-22 81 barrier();
5c9a8750 Dmitry Vyukov 2016-03-22 82 area = t->kcov_area;
5c9a8750 Dmitry Vyukov 2016-03-22 83 /* The first word is number of subsequent PCs. */
5c9a8750 Dmitry Vyukov 2016-03-22 84 pos = READ_ONCE(area[0]) + 1;
5c9a8750 Dmitry Vyukov 2016-03-22 85 if (likely(pos < t->kcov_size)) {
4983f0ab Alexander Popov 2016-12-19 86 area[pos] = ip;
5c9a8750 Dmitry Vyukov 2016-03-22 87 WRITE_ONCE(area[0], pos);
5c9a8750 Dmitry Vyukov 2016-03-22 88 }
5c9a8750 Dmitry Vyukov 2016-03-22 89 }
5c9a8750 Dmitry Vyukov 2016-03-22 90 }
5c9a8750 Dmitry Vyukov 2016-03-22 91 EXPORT_SYMBOL(__sanitizer_cov_trace_pc);
5c9a8750 Dmitry Vyukov 2016-03-22 92

:::::: The code at line 72 was first introduced by commit
:::::: 4983f0ab7ffaad1e534b21975367429736475205 kcov: make kcov work properly with KASLR enabled

:::::: TO: Alexander Popov <alex.popov@xxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip