Merge tag 'soc-drivers-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
[linux-2.6-microblaze.git] / kernel / kallsyms.c
index 8193e94..7982cc9 100644 (file)
@@ -667,7 +667,7 @@ static int get_ksymbol_bpf(struct kallsym_iter *iter)
 {
        int ret;
 
-       strlcpy(iter->module_name, "bpf", MODULE_NAME_LEN);
+       strscpy(iter->module_name, "bpf", MODULE_NAME_LEN);
        iter->exported = 0;
        ret = bpf_get_kallsym(iter->pos - iter->pos_ftrace_mod_end,
                              &iter->value, &iter->type,
@@ -687,7 +687,7 @@ static int get_ksymbol_bpf(struct kallsym_iter *iter)
  */
 static int get_ksymbol_kprobe(struct kallsym_iter *iter)
 {
-       strlcpy(iter->module_name, "__builtin__kprobes", MODULE_NAME_LEN);
+       strscpy(iter->module_name, "__builtin__kprobes", MODULE_NAME_LEN);
        iter->exported = 0;
        return kprobe_get_kallsym(iter->pos - iter->pos_bpf_end,
                                  &iter->value, &iter->type,
@@ -907,41 +907,6 @@ late_initcall(bpf_ksym_iter_register);
 
 #endif /* CONFIG_BPF_SYSCALL */
 
-static inline int kallsyms_for_perf(void)
-{
-#ifdef CONFIG_PERF_EVENTS
-       extern int sysctl_perf_event_paranoid;
-       if (sysctl_perf_event_paranoid <= 1)
-               return 1;
-#endif
-       return 0;
-}
-
-/*
- * We show kallsyms information even to normal users if we've enabled
- * kernel profiling and are explicitly not paranoid (so kptr_restrict
- * is clear, and sysctl_perf_event_paranoid isn't set).
- *
- * Otherwise, require CAP_SYSLOG (assuming kptr_restrict isn't set to
- * block even that).
- */
-bool kallsyms_show_value(const struct cred *cred)
-{
-       switch (kptr_restrict) {
-       case 0:
-               if (kallsyms_for_perf())
-                       return true;
-               fallthrough;
-       case 1:
-               if (security_capable(cred, &init_user_ns, CAP_SYSLOG,
-                                    CAP_OPT_NOAUDIT) == 0)
-                       return true;
-               fallthrough;
-       default:
-               return false;
-       }
-}
-
 static int kallsyms_open(struct inode *inode, struct file *file)
 {
        /*