Add passwd&group files and enable gvisor uidgid test

This commit is contained in:
Jianfeng Jiang
2023-11-29 11:34:12 +00:00
committed by Tate, Hongliang Tian
parent 5aa3124e66
commit 2a0446265e
5 changed files with 35 additions and 2 deletions

View File

@ -5,7 +5,6 @@ INITRAMFS := $(BUILD_DIR)/initramfs
INITRAMFS_IMAGE := $(BUILD_DIR)/initramfs.cpio.gz INITRAMFS_IMAGE := $(BUILD_DIR)/initramfs.cpio.gz
SHELL := /bin/bash SHELL := /bin/bash
INITRAMFS_EMPTY_DIRS := \ INITRAMFS_EMPTY_DIRS := \
$(INITRAMFS)/etc \
$(INITRAMFS)/sbin \ $(INITRAMFS)/sbin \
$(INITRAMFS)/root \ $(INITRAMFS)/root \
$(INITRAMFS)/tmp \ $(INITRAMFS)/tmp \
@ -13,6 +12,7 @@ INITRAMFS_EMPTY_DIRS := \
$(INITRAMFS)/proc \ $(INITRAMFS)/proc \
$(INITRAMFS)/dev $(INITRAMFS)/dev
INITRAMFS_ALL_DIRS := \ INITRAMFS_ALL_DIRS := \
$(INITRAMFS)/etc \
$(INITRAMFS)/lib/x86_64-linux-gnu \ $(INITRAMFS)/lib/x86_64-linux-gnu \
$(INITRAMFS)/lib64 \ $(INITRAMFS)/lib64 \
$(INITRAMFS)/bin \ $(INITRAMFS)/bin \
@ -36,6 +36,11 @@ $(INITRAMFS)/lib64:
@mkdir -p $@ @mkdir -p $@
@cp -L /lib64/ld-linux-x86-64.so.2 $@ @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. # Install busybox into /bin and /usr/bin.
$(INITRAMFS)/bin: $(INITRAMFS)/bin:
@mkdir -p $@ @mkdir -p $@

10
regression/etc/group Normal file
View File

@ -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:

14
regression/etc/passwd Normal file
View File

@ -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

View File

@ -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))) MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CUR_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH))) CUR_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))

View File

@ -0,0 +1,4 @@
UidGidRootTest.Setgid
UidGidRootTest.SetgidNotFromThreadGroupLeader
UidGidRootTest.Setregid
UidGidRootTest.Setresgid