From: kernel test robot <lkp@intel.com>
To: Jiri Olsa <jolsa@kernel.org>, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev, Lee Jones <lee@kernel.org>,
Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
syzbot+97a4fe20470e9bc30810@syzkaller.appspotmail.com,
bpf@vger.kernel.org, Martin KaFai Lau <kafai@fb.com>,
Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>
Subject: Re: [PATCH bpf] bpf, x64: Fix prog_array_map_poke_run map poke update
Date: Tue, 28 Nov 2023 00:27:02 +0800 [thread overview]
Message-ID: <202311272245.sevnkuSF-lkp@intel.com> (raw)
In-Reply-To: <20231127094525.1366740-1-jolsa@kernel.org>
Hi Jiri,
kernel test robot noticed the following build errors:
[auto build test ERROR on bpf/master]
url: https://github.com/intel-lab-lkp/linux/commits/Jiri-Olsa/bpf-x64-Fix-prog_array_map_poke_run-map-poke-update/20231127-174900
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master
patch link: https://lore.kernel.org/r/20231127094525.1366740-1-jolsa%40kernel.org
patch subject: [PATCH bpf] bpf, x64: Fix prog_array_map_poke_run map poke update
config: i386-randconfig-061-20231127 (https://download.01.org/0day-ci/archive/20231127/202311272245.sevnkuSF-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231127/202311272245.sevnkuSF-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311272245.sevnkuSF-lkp@intel.com/
All errors (new ones prefixed by >>):
ld: kernel/bpf/arraymap.o: in function `prog_array_map_poke_run':
>> kernel/bpf/arraymap.c:1067: undefined reference to `__bpf_arch_text_poke'
>> ld: kernel/bpf/arraymap.c:1079: undefined reference to `__bpf_arch_text_poke'
ld: kernel/bpf/arraymap.c:1090: undefined reference to `__bpf_arch_text_poke'
ld: kernel/bpf/arraymap.c:1072: undefined reference to `__bpf_arch_text_poke'
vim +1067 kernel/bpf/arraymap.c
1014
1015 static void prog_array_map_poke_run(struct bpf_map *map, u32 key,
1016 struct bpf_prog *old,
1017 struct bpf_prog *new)
1018 {
1019 u8 *old_addr, *new_addr, *old_bypass_addr;
1020 struct prog_poke_elem *elem;
1021 struct bpf_array_aux *aux;
1022
1023 aux = container_of(map, struct bpf_array, map)->aux;
1024 WARN_ON_ONCE(!mutex_is_locked(&aux->poke_mutex));
1025
1026 list_for_each_entry(elem, &aux->poke_progs, list) {
1027 struct bpf_jit_poke_descriptor *poke;
1028 int i, ret;
1029
1030 for (i = 0; i < elem->aux->size_poke_tab; i++) {
1031 poke = &elem->aux->poke_tab[i];
1032
1033 /* Few things to be aware of:
1034 *
1035 * 1) We can only ever access aux in this context, but
1036 * not aux->prog since it might not be stable yet and
1037 * there could be danger of use after free otherwise.
1038 * 2) Initially when we start tracking aux, the program
1039 * is not JITed yet and also does not have a kallsyms
1040 * entry. We skip these as poke->tailcall_target_stable
1041 * is not active yet. The JIT will do the final fixup
1042 * before setting it stable. The various
1043 * poke->tailcall_target_stable are successively
1044 * activated, so tail call updates can arrive from here
1045 * while JIT is still finishing its final fixup for
1046 * non-activated poke entries.
1047 * 3) Also programs reaching refcount of zero while patching
1048 * is in progress is okay since we're protected under
1049 * poke_mutex and untrack the programs before the JIT
1050 * buffer is freed.
1051 * 4) Any error happening below from __bpf_arch_text_poke()
1052 * is a unexpected bug.
1053 */
1054 if (!READ_ONCE(poke->tailcall_target_stable))
1055 continue;
1056 if (poke->reason != BPF_POKE_REASON_TAIL_CALL)
1057 continue;
1058 if (poke->tail_call.map != map ||
1059 poke->tail_call.key != key)
1060 continue;
1061
1062 old_bypass_addr = old ? NULL : poke->bypass_addr;
1063 old_addr = old ? (u8 *)old->bpf_func + poke->adj_off : NULL;
1064 new_addr = new ? (u8 *)new->bpf_func + poke->adj_off : NULL;
1065
1066 if (new) {
> 1067 ret = __bpf_arch_text_poke(poke->tailcall_target,
1068 BPF_MOD_JUMP,
1069 old_addr, new_addr);
1070 BUG_ON(ret < 0);
1071 if (!old) {
1072 ret = __bpf_arch_text_poke(poke->tailcall_bypass,
1073 BPF_MOD_JUMP,
1074 poke->bypass_addr,
1075 NULL);
1076 BUG_ON(ret < 0);
1077 }
1078 } else {
> 1079 ret = __bpf_arch_text_poke(poke->tailcall_bypass,
1080 BPF_MOD_JUMP,
1081 old_bypass_addr,
1082 poke->bypass_addr);
1083 BUG_ON(ret < 0);
1084 /* let other CPUs finish the execution of program
1085 * so that it will not possible to expose them
1086 * to invalid nop, stack unwind, nop state
1087 */
1088 if (!ret)
1089 synchronize_rcu();
1090 ret = __bpf_arch_text_poke(poke->tailcall_target,
1091 BPF_MOD_JUMP,
1092 old_addr, NULL);
1093 BUG_ON(ret < 0);
1094 }
1095 }
1096 }
1097 }
1098
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
prev parent reply other threads:[~2023-11-27 16:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-27 9:45 [PATCH bpf] bpf, x64: Fix prog_array_map_poke_run map poke update Jiri Olsa
2023-11-27 13:09 ` Jiri Olsa
2023-11-27 16:26 ` kernel test robot
2023-11-27 16:27 ` kernel test robot [this message]
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=202311272245.sevnkuSF-lkp@intel.com \
--to=lkp@intel.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=lee@kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=sdf@google.com \
--cc=songliubraving@fb.com \
--cc=syzbot+97a4fe20470e9bc30810@syzkaller.appspotmail.com \
--cc=yhs@fb.com \
/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