Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac13095c authored by Tim Zimmermann's avatar Tim Zimmermann Committed by Harshit Jain
Browse files

syscall: Only fake uname on very first call of netbpfload



* The bpf programs actually still support older kernels,
  we just need to bypass the very first check for kernel version

Change-Id: I4264782ee63efb26b95abd94774938d5456200a3
Signed-off-by: default avatarCyber Knight <cyberknight755@gmail.com>
parent 2292020b
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -1182,16 +1182,17 @@ static int override_release(char __user *release, size_t len)
	return ret;
}

static uint64_t netbpfload_pid = 0;
SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
{
	struct new_utsname tmp;

	down_read(&uts_sem);
	memcpy(&tmp, utsname(), sizeof(tmp));
	if (!strncmp(current->comm, "bpfloader", 9) ||
	    !strncmp(current->comm, "netbpfload", 10) ||
	    !strncmp(current->comm, "netd", 4)) {
		strcpy(tmp.release, "5.4.0");
	if (!strncmp(current->comm, "netbpfload", 10) &&
		current->pid != netbpfload_pid) {
		netbpfload_pid = current->pid;
		strcpy(tmp.release, "5.4.186");
		pr_debug("fake uname: %s/%d release=%s\n",
			current->comm, current->pid, tmp.release);
	}