kernel/kprobes.c:145: warning: Function parameter or struct member 'c' not described in '__get_insn_slot'
From: kernel test robot
Date: Sun Dec 22 2024 - 03:00:51 EST
Hi Sven,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 48f506ad0b683d3e7e794efa60c5785c4fdc86fa
commit: 8858ac8e9e9b1894f7bb218bc0035532371b8d7e parisc: Implement kprobes
date: 6 years ago
config: parisc-randconfig-001-20241218 (https://download.01.org/0day-ci/archive/20241222/202412221527.sjEK4g7J-lkp@xxxxxxxxx/config)
compiler: hppa-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241222/202412221527.sjEK4g7J-lkp@xxxxxxxxx/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412221527.sjEK4g7J-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
>> kernel/kprobes.c:145: warning: Function parameter or struct member 'c' not described in '__get_insn_slot'
vim +145 kernel/kprobes.c
b4c6c34a530b4d1 Masami Hiramatsu 2006-12-06 139
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 140 /**
129415607845d4d Masami Hiramatsu 2009-01-06 141 * __get_insn_slot() - Find a slot on an executable page for an instruction.
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 142 * We allocate an executable page if there's no room on existing ones.
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 143 */
55479f64756fc50 Masami Hiramatsu 2014-04-17 144 kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c)
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 @145 {
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 146 struct kprobe_insn_page *kip;
c802d64a356b5cf Heiko Carstens 2013-09-11 147 kprobe_opcode_t *slot = NULL;
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 148
5b485629ba0d5d0 Masami Hiramatsu 2017-01-08 149 /* Since the slot array is not protected by rcu, we need a mutex */
c802d64a356b5cf Heiko Carstens 2013-09-11 150 mutex_lock(&c->mutex);
b4c6c34a530b4d1 Masami Hiramatsu 2006-12-06 151 retry:
5b485629ba0d5d0 Masami Hiramatsu 2017-01-08 152 rcu_read_lock();
5b485629ba0d5d0 Masami Hiramatsu 2017-01-08 153 list_for_each_entry_rcu(kip, &c->pages, list) {
4610ee1d3638fa0 Masami Hiramatsu 2010-02-25 154 if (kip->nused < slots_per_page(c)) {
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 155 int i;
4610ee1d3638fa0 Masami Hiramatsu 2010-02-25 156 for (i = 0; i < slots_per_page(c); i++) {
ab40c5c6b6861ee Masami Hiramatsu 2007-01-30 157 if (kip->slot_used[i] == SLOT_CLEAN) {
ab40c5c6b6861ee Masami Hiramatsu 2007-01-30 158 kip->slot_used[i] = SLOT_USED;
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 159 kip->nused++;
c802d64a356b5cf Heiko Carstens 2013-09-11 160 slot = kip->insns + (i * c->insn_size);
5b485629ba0d5d0 Masami Hiramatsu 2017-01-08 161 rcu_read_unlock();
c802d64a356b5cf Heiko Carstens 2013-09-11 162 goto out;
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 163 }
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 164 }
4610ee1d3638fa0 Masami Hiramatsu 2010-02-25 165 /* kip->nused is broken. Fix it. */
4610ee1d3638fa0 Masami Hiramatsu 2010-02-25 166 kip->nused = slots_per_page(c);
4610ee1d3638fa0 Masami Hiramatsu 2010-02-25 167 WARN_ON(1);
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 168 }
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 169 }
5b485629ba0d5d0 Masami Hiramatsu 2017-01-08 170 rcu_read_unlock();
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 171
b4c6c34a530b4d1 Masami Hiramatsu 2006-12-06 172 /* If there are any garbage slots, collect it and try again. */
4610ee1d3638fa0 Masami Hiramatsu 2010-02-25 173 if (c->nr_garbage && collect_garbage_slots(c) == 0)
b4c6c34a530b4d1 Masami Hiramatsu 2006-12-06 174 goto retry;
4610ee1d3638fa0 Masami Hiramatsu 2010-02-25 175
4610ee1d3638fa0 Masami Hiramatsu 2010-02-25 176 /* All out of space. Need to allocate a new page. */
4610ee1d3638fa0 Masami Hiramatsu 2010-02-25 177 kip = kmalloc(KPROBE_INSN_PAGE_SIZE(slots_per_page(c)), GFP_KERNEL);
6f716acd5fa20ae Christoph Hellwig 2007-05-08 178 if (!kip)
c802d64a356b5cf Heiko Carstens 2013-09-11 179 goto out;
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 180
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 181 /*
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 182 * Use module_alloc so this page is within +/- 2GB of where the
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 183 * kernel image and loaded module images reside. This is required
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 184 * so x86_64 can correctly handle the %rip-relative fixups.
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 185 */
af96397de860023 Heiko Carstens 2013-09-11 186 kip->insns = c->alloc();
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 187 if (!kip->insns) {
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 188 kfree(kip);
c802d64a356b5cf Heiko Carstens 2013-09-11 189 goto out;
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 190 }
c5cb5a2d8d7dc87 Masami Hiramatsu 2009-06-30 191 INIT_LIST_HEAD(&kip->list);
4610ee1d3638fa0 Masami Hiramatsu 2010-02-25 192 memset(kip->slot_used, SLOT_CLEAN, slots_per_page(c));
ab40c5c6b6861ee Masami Hiramatsu 2007-01-30 193 kip->slot_used[0] = SLOT_USED;
9ec4b1f356b3bad Ananth N Mavinakayanahalli 2005-06-27 194 kip->nused = 1;
b4c6c34a530b4d1 Masami Hiramatsu 2006-12-06 195 kip->ngarbage = 0;
af96397de860023 Heiko Carstens 2013-09-11 196 kip->cache = c;
5b485629ba0d5d0 Masami Hiramatsu 2017-01-08 197 list_add_rcu(&kip->list, &c->pages);
c802d64a356b5cf Heiko Carstens 2013-09-11 198 slot = kip->insns;
c802d64a356b5cf Heiko Carstens 2013-09-11 199 out:
c802d64a356b5cf Heiko Carstens 2013-09-11 200 mutex_unlock(&c->mutex);
c802d64a356b5cf Heiko Carstens 2013-09-11 201 return slot;
129415607845d4d Masami Hiramatsu 2009-01-06 202 }
129415607845d4d Masami Hiramatsu 2009-01-06 203
:::::: The code at line 145 was first introduced by commit
:::::: 9ec4b1f356b3bad928ae8e2aa9caebfa737d52df [PATCH] kprobes: fix single-step out of line - take2
:::::: TO: Ananth N Mavinakayanahalli <ananth@xxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki