From 2a0446265e37bc8d9a3949b88dff0e5f634072e1 Mon Sep 17 00:00:00 2001 From: Jianfeng Jiang Date: Wed, 29 Nov 2023 11:34:12 +0000 Subject: [PATCH] Add passwd&group files and enable gvisor uidgid test --- regression/Makefile | 7 ++++++- regression/etc/group | 10 ++++++++++ regression/etc/passwd | 14 ++++++++++++++ regression/syscall_test/Makefile | 2 +- regression/syscall_test/blocklists/uidgid_test | 4 ++++ 5 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 regression/etc/group create mode 100644 regression/etc/passwd create mode 100644 regression/syscall_test/blocklists/uidgid_test diff --git a/regression/Makefile b/regression/Makefile index a9a3f0e8a..0736f9bc6 100644 --- a/regression/Makefile +++ b/regression/Makefile @@ -5,7 +5,6 @@ INITRAMFS := $(BUILD_DIR)/initramfs INITRAMFS_IMAGE := $(BUILD_DIR)/initramfs.cpio.gz SHELL := /bin/bash INITRAMFS_EMPTY_DIRS := \ - $(INITRAMFS)/etc \ $(INITRAMFS)/sbin \ $(INITRAMFS)/root \ $(INITRAMFS)/tmp \ @@ -13,6 +12,7 @@ INITRAMFS_EMPTY_DIRS := \ $(INITRAMFS)/proc \ $(INITRAMFS)/dev INITRAMFS_ALL_DIRS := \ + $(INITRAMFS)/etc \ $(INITRAMFS)/lib/x86_64-linux-gnu \ $(INITRAMFS)/lib64 \ $(INITRAMFS)/bin \ @@ -36,6 +36,11 @@ $(INITRAMFS)/lib64: @mkdir -p $@ @cp -L /lib64/ld-linux-x86-64.so.2 $@ +$(INITRAMFS)/etc: + @mkdir -p $@ + @cp $(CUR_DIR)/etc/passwd $@ + @cp $(CUR_DIR)/etc/group $@ + # Install busybox into /bin and /usr/bin. $(INITRAMFS)/bin: @mkdir -p $@ diff --git a/regression/etc/group b/regression/etc/group new file mode 100644 index 000000000..53d75e3dc --- /dev/null +++ b/regression/etc/group @@ -0,0 +1,10 @@ +## +# User group file. +# +# There is one entry per line, with the following format: +# group_name:password:GID:user_list +# +# See the group(5) man page for additional information about this file. +## +root:x:0: +nogroup:x:65534: diff --git a/regression/etc/passwd b/regression/etc/passwd new file mode 100644 index 000000000..365dbca37 --- /dev/null +++ b/regression/etc/passwd @@ -0,0 +1,14 @@ +## +# Password file. +# +# Each line of the file describes a single user, and contains seven +# colon-separated fields: +# name:password:UID:GID:GECOS:directory:shell +# +# The password field can be either the encrypted user password, an asterisk +# (*), or the letter 'x'. See the pwconf(8) man page for explanation of 'x'. +# +# See the passwd(5) man page for additional information about this file. +## +root:x:0:0:root:/:/bin/sh +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin diff --git a/regression/syscall_test/Makefile b/regression/syscall_test/Makefile index 8789dc56f..385448682 100644 --- a/regression/syscall_test/Makefile +++ b/regression/syscall_test/Makefile @@ -1,4 +1,4 @@ -TESTS ?= open_test read_test statfs_test chmod_test pty_test +TESTS ?= open_test read_test statfs_test chmod_test pty_test uidgid_test MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CUR_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH))) diff --git a/regression/syscall_test/blocklists/uidgid_test b/regression/syscall_test/blocklists/uidgid_test new file mode 100644 index 000000000..2648a9557 --- /dev/null +++ b/regression/syscall_test/blocklists/uidgid_test @@ -0,0 +1,4 @@ +UidGidRootTest.Setgid +UidGidRootTest.SetgidNotFromThreadGroupLeader +UidGidRootTest.Setregid +UidGidRootTest.Setresgid \ No newline at end of file