Skip to contentSkip to conversation

syscalls/fork02: new test for fork()

PATCH zhaogongyi via ltp 1 participant 1 message Nov 16, 2022

lore
Share & tools
lore
#0 lore raw

Hi!

Quoted 18 lines

Hello,

Quoted 1 line · Zhao Gongyi via ltp

Verify that current workdir correctly inherited by child.

I'm not convinced by Cyrils comments that this should be included. I doubt LTP would work if the CWD wasn't inherited by children. At least in the common case. The test needs to do something more IMO.

Perhaps there has been a kernel bug involving fork and CWD? Perhaps relating to new file systems and mount options. I doubt we will see issues on a common setup. This isn't adding any test coverage in that case.

Also the path to the CWD and the CWD are two different things. The kernel generates the path on each invocation of getcwd IIRC.

Quoted 6 lines

Marking this as changes requested in patchwork. Although really, I think effort should be directed at clone3 which is lacking a lot of coverage.

--
Thank you,
Richard.

the pwd is one member of fs_struct:

struct fs_struct {
	int users;
	spinlock_t lock;
	seqcount_spinlock_t seq;
	int umask;
	int in_exec;
	struct path root, pwd;
} __randomize_layout;

And fs_struct is one member of struct task_struct:

	/* Filesystem information: */
	struct fs_struct		*fs;

In my opinion, the pwd will inherit from parent naturally if there is no a explicit change in fork.

Regards,
Gongyi

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp