Patch "bpf: Prevent decl_tag from being referenced in func_proto arg" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    bpf: Prevent decl_tag from being referenced in func_proto arg

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bpf-prevent-decl_tag-from-being-referenced-in-func_p.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 03634d5e68fcbc01d2d8e6e2fdb7435c27e5d146
Author: Stanislav Fomichev <sdf@xxxxxxxxxx>
Date:   Tue Nov 22 19:54:22 2022 -0800

    bpf: Prevent decl_tag from being referenced in func_proto arg
    
    [ Upstream commit f17472d4599697d701aa239b4c475a506bccfd19 ]
    
    Syzkaller managed to hit another decl_tag issue:
    
      btf_func_proto_check kernel/bpf/btf.c:4506 [inline]
      btf_check_all_types kernel/bpf/btf.c:4734 [inline]
      btf_parse_type_sec+0x1175/0x1980 kernel/bpf/btf.c:4763
      btf_parse kernel/bpf/btf.c:5042 [inline]
      btf_new_fd+0x65a/0xb00 kernel/bpf/btf.c:6709
      bpf_btf_load+0x6f/0x90 kernel/bpf/syscall.c:4342
      __sys_bpf+0x50a/0x6c0 kernel/bpf/syscall.c:5034
      __do_sys_bpf kernel/bpf/syscall.c:5093 [inline]
      __se_sys_bpf kernel/bpf/syscall.c:5091 [inline]
      __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5091
      do_syscall_64+0x54/0x70 arch/x86/entry/common.c:48
    
    This seems similar to commit ea68376c8bed ("bpf: prevent decl_tag from being
    referenced in func_proto") but for the argument.
    
    Reported-by: syzbot+8dd0551dda6020944c5d@xxxxxxxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Stanislav Fomichev <sdf@xxxxxxxxxx>
    Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
    Acked-by: Yonghong Song <yhs@xxxxxx>
    Link: https://lore.kernel.org/bpf/20221123035422.872531-2-sdf@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 7cb13b9f69a6..0c2fa93bd8d2 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -3864,6 +3864,11 @@ static int btf_func_proto_check(struct btf_verifier_env *env,
 			break;
 		}
 
+		if (btf_type_is_resolve_source_only(arg_type)) {
+			btf_verifier_log_type(env, t, "Invalid arg#%u", i + 1);
+			return -EINVAL;
+		}
+
 		if (args[i].name_off &&
 		    (!btf_name_offset_valid(btf, args[i].name_off) ||
 		     !btf_name_valid_identifier(btf, args[i].name_off))) {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux