Snap for 7216820 from a56618e0ceb7930a3ebfa671e0f8598bba61fc96 to android11-tests-release
Change-Id: Id327f425cf3d030d08c8875f93850868e7714abe
diff --git a/net/test/bpf.py b/net/test/bpf.py
index 5062e31..9e8f6c8 100755
--- a/net/test/bpf.py
+++ b/net/test/bpf.py
@@ -22,6 +22,7 @@
import net_test
import socket
import platform
+import resource
# __NR_bpf syscall numbers for various architectures.
# NOTE: If python inherited COMPAT_UTS_MACHINE, uname's 'machine' field will
@@ -178,6 +179,8 @@
libc = ctypes.CDLL(ctypes.util.find_library("c"), use_errno=True)
HAVE_EBPF_SUPPORT = net_test.LINUX_VERSION >= (4, 4, 0)
+# set memlock resource 1 GiB
+resource.setrlimit(resource.RLIMIT_MEMLOCK, (1073741824, 1073741824))
# BPF program syscalls
def BpfSyscall(op, attr):