Jiri Olsa
f64b2dc8a4
bpf: Fix prog_array_map_poke_run map poke update
...
commit 4b7de80160 upstream.
Lee pointed out issue found by syscaller [0] hitting BUG in prog array
map poke update in prog_array_map_poke_run function due to error value
returned from bpf_arch_text_poke function.
There's race window where bpf_arch_text_poke can fail due to missing
bpf program kallsym symbols, which is accounted for with check for
-EINVAL in that BUG_ON call.
The problem is that in such case we won't update the tail call jump
and cause imbalance for the next tail call update check which will
fail with -EBUSY in bpf_arch_text_poke.
I'm hitting following race during the program load:
CPU 0 CPU 1
bpf_prog_load
bpf_check
do_misc_fixups
prog_array_map_poke_track
map_update_elem
bpf_fd_array_map_update_elem
prog_array_map_poke_run
bpf_arch_text_poke returns -EINVAL
bpf_prog_kallsyms_add
After bpf_arch_text_poke (CPU 1) fails to update the tail call jump, the next
poke update fails on expected jump instruction check in bpf_arch_text_poke
with -EBUSY and triggers the BUG_ON in prog_array_map_poke_run.
Similar race exists on the program unload.
Fixing this by moving the update to bpf_arch_poke_desc_update function which
makes sure we call __bpf_arch_text_poke that skips the bpf address check.
Each architecture has slightly different approach wrt looking up bpf address
in bpf_arch_text_poke, so instead of splitting the function or adding new
'checkip' argument in previous version, it seems best to move the whole
map_poke_run update as arch specific code.
[0] https://syzkaller.appspot.com/bug?extid=97a4fe20470e9bc30810
Fixes: ebf7d1f508 ("bpf, x64: rework pro/epilogue and tailcall handling in JIT")
Reported-by: syzbot+97a4fe20470e9bc30810@syzkaller.appspotmail.com
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net >
Acked-by: Yonghong Song <yonghong.song@linux.dev >
Cc: Lee Jones <lee@kernel.org >
Cc: Maciej Fijalkowski <maciej.fijalkowski@intel.com >
Link: https://lore.kernel.org/bpf/20231206083041.1306660-2-jolsa@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-01-01 12:42:23 +00:00
..
2023-09-20 09:39:03 +02:00
2023-08-16 09:14:14 -07:00
2023-07-28 09:45:25 +02:00
2023-09-18 12:04:50 +02:00
2023-08-22 14:13:11 -07:00
2023-08-07 20:55:27 +02:00
2023-09-01 09:53:54 -07:00
2023-08-22 16:32:35 +02:00
2023-09-01 09:53:54 -07:00
2023-08-29 17:45:22 -04:00
2023-11-20 11:59:23 +01:00
2023-08-23 08:25:28 +01:00
2023-12-20 17:01:44 +01:00
2023-11-28 17:20:01 +00:00
2023-10-16 10:47:22 +02:00
2023-10-04 14:12:01 +02:00
2023-08-25 07:42:58 +01:00
2023-08-16 10:54:46 -06:00
2023-09-01 08:09:48 -07:00
2023-09-07 16:07:35 -07:00
2023-07-19 23:15:21 +02:00
2023-08-23 08:21:37 +01:00
2023-09-06 22:53:55 +08:00
2023-08-18 13:58:05 +01:00
2023-12-03 07:33:06 +01:00
2023-08-30 19:53:39 -07:00
2023-09-03 10:20:57 -07:00
2023-11-28 17:19:55 +00:00
2023-11-28 17:19:49 +00:00
2023-12-20 17:01:42 +01:00
2023-08-15 12:50:53 +01:00
2023-10-04 16:31:27 +01:00
2023-09-11 15:24:16 -07:00
2023-08-07 14:55:33 +02:00
2023-12-08 08:52:24 +01:00
2023-08-18 10:18:56 -07:00
2023-08-04 17:35:33 +01:00
2023-09-12 13:07:37 +01:00
2023-08-31 01:29:28 +02:00
2023-08-21 13:38:01 -07:00
2023-08-30 17:35:54 +08:00
2023-08-09 08:21:22 +02:00
2023-08-30 17:35:54 +08:00
2023-08-30 17:35:54 +08:00
2023-07-12 23:45:23 +02:00
2023-07-31 14:44:02 -07:00
2023-08-25 09:23:16 -07:00
2024-01-01 12:42:23 +00:00
2023-07-17 07:39:04 +01:00
2023-09-15 12:08:27 -07:00
2023-09-02 11:10:50 -07:00
2023-09-17 10:33:53 -07:00
2023-08-24 16:20:25 -07:00
2023-08-02 16:27:07 +02:00
2023-10-12 07:22:56 -10:00
2023-11-20 11:59:05 +01:00
2023-08-04 18:18:19 -07:00
2023-08-17 16:46:35 -07:00
2023-08-15 14:57:24 -07:00
2023-07-17 16:08:08 -07:00
2023-07-23 11:34:22 +01:00
2023-07-20 13:06:22 +02:00
2023-07-26 16:46:25 +01:00
2023-08-16 09:41:29 -04:00
2023-07-28 09:53:37 +02:00
2023-10-11 14:27:37 +02:00
2023-08-29 20:51:40 +02:00
2023-12-13 18:44:56 +01:00
2023-07-17 15:47:21 -07:00
2023-08-24 16:25:13 -07:00
2023-12-20 17:01:51 +01:00
2023-11-28 17:19:58 +00:00
2023-08-24 16:20:30 -07:00
2023-08-05 08:31:41 +02:00
2023-09-01 09:43:18 -07:00
2023-07-20 17:25:04 -05:00
2023-08-25 16:07:30 -07:00
2023-12-08 08:52:19 +01:00
2023-07-31 17:54:28 +02:00
2023-08-01 18:02:20 +02:00
2023-08-09 17:46:19 +02:00
2023-08-04 15:28:41 +02:00
2023-08-30 13:34:34 -07:00
2023-08-23 14:17:42 -07:00
2023-11-28 17:20:11 +00:00
2023-07-10 13:59:38 -04:00
2023-09-12 17:42:00 +02:00
2023-07-25 00:59:32 +09:00
2023-07-24 04:39:16 +09:00
2023-11-28 17:19:45 +00:00
2023-09-01 00:29:34 +02:00
2023-08-04 14:38:31 -07:00
2023-10-12 18:53:36 +03:00
2023-07-24 10:30:07 +02:00
2023-10-13 18:34:46 +02:00
2023-08-01 23:46:17 +02:00
2023-08-22 05:20:34 -04:00
2023-11-28 17:19:35 +00:00
2023-08-18 10:18:57 -07:00
2023-08-18 10:18:57 -07:00
2023-08-14 11:23:35 +02:00
2023-12-03 07:33:04 +01:00
2023-12-13 18:45:21 +01:00
2023-11-20 11:59:20 +01:00
2023-12-13 18:44:56 +01:00
2023-08-21 14:28:43 -07:00
2023-12-13 18:45:24 +01:00
2023-08-16 23:54:50 +10:00
2023-11-20 11:59:18 +01:00
2023-09-04 11:26:29 -07:00
2023-07-14 13:11:44 +02:00
2023-09-13 10:48:48 +02:00
2023-07-14 08:27:33 +01:00
2023-11-20 11:59:35 +01:00
2023-10-23 13:25:30 +02:00
2023-08-25 08:08:27 +01:00
2023-09-19 16:28:37 +02:00
2023-08-04 11:02:46 +01:00
2023-09-12 17:50:53 +02:00
2023-08-01 13:45:08 +02:00
2023-07-14 15:24:45 +02:00
2023-08-22 01:11:32 +03:00
2023-09-27 16:54:03 +02:00
2023-12-08 08:52:20 +01:00
2023-08-09 10:46:15 -06:00
2023-08-29 20:21:42 -07:00
2023-12-08 08:52:19 +01:00
2023-07-28 13:31:24 -03:00
2023-08-18 10:12:35 -07:00
2023-09-01 08:11:51 +01:00
2023-11-28 17:19:56 +00:00
2023-08-05 08:18:04 -04:00
2023-07-14 13:47:07 -06:00
2023-10-18 12:12:41 -07:00
2023-08-21 13:46:24 -07:00
2023-08-05 08:31:42 +02:00
2023-08-24 16:25:14 -07:00
2023-08-18 10:12:39 -07:00
2023-08-05 08:31:41 +02:00
2023-12-13 18:45:31 +01:00
2023-08-18 10:12:10 -07:00
2023-08-18 10:18:59 -07:00
2023-08-31 13:48:50 -04:00
2023-08-17 09:00:34 +01:00
2023-09-28 21:23:03 +09:00
2023-08-18 10:19:00 -07:00
2023-08-15 14:57:25 -07:00
2023-08-07 13:05:53 -07:00
2023-11-28 17:20:10 +00:00
2023-07-10 13:59:37 -04:00
2023-09-29 17:20:46 -07:00
2023-07-20 12:24:06 +02:00
2023-08-18 10:18:59 -07:00
2023-10-05 09:50:14 +02:00
2023-07-14 08:51:48 +01:00
2023-08-21 13:37:47 -07:00
2023-09-19 13:21:34 -07:00
2023-08-21 13:37:48 -07:00
2023-08-18 10:12:11 -07:00
2023-08-21 13:37:49 -07:00
2023-08-04 12:09:56 +05:30
2023-09-06 20:49:04 -07:00
2023-08-30 13:45:05 -07:00
2023-07-18 12:10:00 -10:00
2023-12-20 17:02:02 +01:00
2023-08-18 10:12:36 -07:00
2023-08-24 16:20:28 -07:00
2023-08-31 12:20:12 -07:00
2023-07-11 14:12:19 -07:00
2023-08-18 10:12:46 -07:00
2023-08-18 10:12:41 -07:00
2023-12-20 17:02:03 +01:00
2023-07-24 12:09:47 -07:00
2023-08-03 13:42:02 -07:00
2023-11-28 17:19:56 +00:00
2023-08-02 19:11:06 -07:00
2023-08-09 15:32:43 -07:00
2023-12-03 07:33:04 +01:00
2023-07-28 16:52:08 -07:00
2023-07-23 11:34:22 +01:00
2023-09-13 11:51:11 -04:00
2023-09-13 11:51:11 -04:00
2023-07-25 00:30:02 -05:00
2023-08-18 10:19:00 -07:00
2023-08-16 14:27:01 -07:00
2023-08-21 11:29:12 -07:00
2023-11-20 11:58:53 +01:00
2023-09-05 05:34:14 -04:00
2023-07-10 09:12:31 -07:00
2023-08-23 16:34:02 +02:00
2023-12-20 17:02:06 +01:00
2023-08-04 11:36:33 -06:00
2023-09-05 13:02:13 -05:00
2023-09-09 08:18:16 -05:00
2023-08-21 13:37:31 -07:00
2023-08-18 10:12:25 -07:00
2023-08-24 16:20:18 -07:00
2023-08-21 14:28:45 -07:00
2023-12-03 07:33:03 +01:00
2023-08-21 13:07:20 -07:00
2023-11-28 17:19:37 +00:00
2023-12-20 17:01:53 +01:00
2023-08-04 16:21:30 +02:00
2023-08-25 08:06:53 -07:00
2023-07-18 10:07:47 +02:00
2023-11-28 17:19:54 +00:00
2023-09-29 17:20:46 -07:00
2023-08-14 08:12:53 +01:00
2023-08-02 19:11:06 -07:00
2023-09-06 07:46:49 +01:00
2023-08-21 13:37:59 -07:00
2023-07-18 15:19:00 +01:00
2023-07-24 13:27:12 +05:30
2023-08-22 21:31:57 +02:00
2023-07-24 09:51:51 +02:00
2023-08-22 22:03:43 +02:00
2023-11-20 11:58:57 +01:00
2023-11-08 11:56:20 +01:00
2023-11-28 17:19:48 +00:00
2023-08-12 09:18:47 -07:00
2023-08-02 15:01:51 -07:00
2023-07-20 22:14:21 +12:00
2023-08-09 15:59:21 -07:00
2023-11-28 17:19:48 +00:00
2023-10-06 11:01:23 +02:00
2023-10-06 11:01:23 +02:00
2023-08-24 21:34:28 -04:00
2023-08-18 10:19:00 -07:00
2023-07-19 09:43:58 +02:00
2023-08-16 14:27:41 -07:00
2023-07-14 15:01:49 -07:00
2023-07-19 13:19:41 -07:00
2023-07-12 23:45:23 +02:00
2023-07-12 23:45:23 +02:00
2023-07-18 15:05:10 +01:00
2023-07-15 12:56:48 -07:00
2023-09-19 13:21:34 -07:00
2023-12-13 18:45:19 +01:00
2023-09-02 15:17:33 -07:00
2023-07-15 11:34:49 -07:00
2023-08-27 23:50:22 +02:00
2023-08-30 10:08:38 +02:00
2023-12-13 18:45:15 +01:00
2023-08-24 16:20:31 -07:00
2023-08-30 09:07:09 -07:00
2023-08-22 11:10:26 -06:00
2023-07-27 08:48:12 -07:00
2023-09-21 08:37:44 +02:00
2023-08-20 14:29:37 +02:00
2023-08-09 09:15:51 +02:00
2023-10-10 19:35:54 -07:00
2023-12-08 08:52:23 +01:00
2023-07-18 10:07:47 +02:00
2023-07-26 21:24:40 -07:00
2023-11-28 17:19:38 +00:00
2023-08-21 13:46:24 -07:00
2023-08-16 14:27:01 -07:00
2023-12-13 18:45:05 +01:00
2023-07-28 17:05:47 +02:00
2023-08-04 18:21:50 -07:00
2023-11-28 17:19:40 +00:00
2023-07-17 16:08:08 -07:00
2023-08-24 16:20:28 -07:00
2023-08-21 13:37:26 -07:00
2023-08-18 10:12:16 -07:00
2023-09-27 11:19:15 +02:00
2023-08-09 14:16:44 -05:00
2023-08-31 12:20:12 -07:00
2023-11-28 17:19:57 +00:00
2023-07-25 19:21:03 +02:00
2023-07-28 18:04:14 -07:00
2023-08-06 08:24:55 +01:00
2023-09-11 17:16:40 +02:00
2023-08-11 21:12:45 +02:00
2023-11-20 11:58:51 +01:00
2023-11-28 17:20:08 +00:00
2023-08-07 17:55:54 +00:00
2023-11-08 11:56:21 +01:00
2023-07-30 18:13:34 -04:00
2023-08-22 14:58:15 +02:00
2023-08-11 21:12:46 +02:00
2023-08-22 14:58:15 +02:00
2023-08-11 21:12:47 +02:00
2023-08-11 21:12:44 +02:00
2023-08-27 11:47:44 +02:00
2023-11-20 11:58:56 +01:00
2023-07-24 18:03:58 -04:00
2023-08-09 14:17:06 +02:00
2023-08-18 10:12:16 -07:00
2023-09-03 18:10:22 -04:00
2023-11-20 11:59:18 +01:00
2023-12-08 08:52:25 +01:00
2023-08-24 13:27:47 -05:00
2023-10-15 19:59:15 +01:00
2023-09-04 13:44:11 -07:00
2023-07-17 16:08:08 -07:00
2023-11-28 17:19:36 +00:00
2023-08-21 14:52:16 +02:00
2023-09-05 19:01:38 -04:00
2023-08-10 12:06:04 +02:00
2023-08-21 13:37:27 -07:00