[LTP] [PATCH 1/2] Implement tst_setup_netns() helper function

Martin Doucha mdoucha@suse.cz
Fri Nov 25 18:09:34 CET 2022


On 25. 11. 22 18:01, Petr Vorel wrote:
> Hi Martin,
> 
>> +void tst_setup_netns(void)
>> +{
>> +	int real_uid = getuid();
>> +	int real_gid = getgid();
>> +	int nscount = 1;
>> +
>> +	if (!access("/proc/sys/user/max_user_namespaces", F_OK)) {
> Out of curiosity, this can happen only on old kernel, which does not support
> user namespaces (kernel < 3.8) ? I guess there must be other case,
> I suppose you would not bother about 3.8, right?
> 
> Also asking that if not readable we don't TCONF (int nscount = 1).

This is very much still happening on kernel 4.4.180 even though user 
namespaces are supported and enabled by default. That's why 
tst_setup_netns() fails with TCONF only when max_user_namespaces sysfile 
exists, is read-only AND the value inside is zero.

-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic



More information about the ltp mailing list