* truncated), or smaller (if log buffer wasn't filled completely).
                 */
                __u32           btf_log_true_size;
+               __u32           btf_flags;
+               /* BPF token FD to use with BPF_BTF_LOAD operation.
+                * If provided, btf_flags should have BPF_F_TOKEN_FD flag set.
+                */
+               __s32           btf_token_fd;
        };
 
        struct {
 
        return err;
 }
 
-#define BPF_BTF_LOAD_LAST_FIELD btf_log_true_size
+#define BPF_BTF_LOAD_LAST_FIELD btf_token_fd
 
 static int bpf_btf_load(const union bpf_attr *attr, bpfptr_t uattr, __u32 uattr_size)
 {
+       struct bpf_token *token = NULL;
+
        if (CHECK_ATTR(BPF_BTF_LOAD))
                return -EINVAL;
 
-       if (!bpf_capable())
+       if (attr->btf_flags & ~BPF_F_TOKEN_FD)
+               return -EINVAL;
+
+       if (attr->btf_flags & BPF_F_TOKEN_FD) {
+               token = bpf_token_get_from_fd(attr->btf_token_fd);
+               if (IS_ERR(token))
+                       return PTR_ERR(token);
+               if (!bpf_token_allow_cmd(token, BPF_BTF_LOAD)) {
+                       bpf_token_put(token);
+                       token = NULL;
+               }
+       }
+
+       if (!bpf_token_capable(token, CAP_BPF)) {
+               bpf_token_put(token);
                return -EPERM;
+       }
+
+       bpf_token_put(token);
 
        return btf_new_fd(attr, uattr, uattr_size);
 }
 
                 * truncated), or smaller (if log buffer wasn't filled completely).
                 */
                __u32           btf_log_true_size;
+               __u32           btf_flags;
+               /* BPF token FD to use with BPF_BTF_LOAD operation.
+                * If provided, btf_flags should have BPF_F_TOKEN_FD flag set.
+                */
+               __s32           btf_token_fd;
        };
 
        struct {