Commit 4722981c authored by Altgelt, Max (Nextron)'s avatar Altgelt, Max (Nextron) Committed by Alexei Starovoitov
Browse files

bpf: don't skip other information if xlated_prog_insns is skipped



If xlated_prog_insns should not be exposed, other information
(such as func_info) still can and should be filled in.
Therefore, instead of directly terminating in this case,
continue with the normal flow.

Signed-off-by: default avatarMax Altgelt <max.altgelt@nextron-systems.com>
Link: https://lore.kernel.org/r/efd00fcec5e3e247af551632726e2a90c105fbd8.camel@nextron-systems.com


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 6cc73f35
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -5056,10 +5056,7 @@ static int bpf_prog_get_info_by_fd(struct file *file,
		struct bpf_insn *insns_sanitized;
		bool fault;

		if (prog->blinded && !bpf_dump_raw_ok(file->f_cred)) {
			info.xlated_prog_insns = 0;
			goto done;
		}
		if (!prog->blinded || bpf_dump_raw_ok(file->f_cred)) {
			insns_sanitized = bpf_insn_prepare_dump(prog, file->f_cred);
			if (!insns_sanitized)
				return -ENOMEM;
@@ -5069,6 +5066,9 @@ static int bpf_prog_get_info_by_fd(struct file *file,
			kfree(insns_sanitized);
			if (fault)
				return -EFAULT;
		} else {
			info.xlated_prog_insns = 0;
		}
	}

	if (bpf_prog_is_offloaded(prog->aux)) {