Skip to contentSkip to conversation

Fix unprivileged llseek01 behaviour

PATCH In review Nicolas Joly 2 participants 3 messages Mar 17, 2015 – Mar 18, 2015 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix unprivileged llseek01 behaviour

Hi,

Running llseek01 testcase as unprivileged user currently fails.

njoly@raya [syscalls/llseek]> ./llseek01

llseek01    1  TPASS  :  Functionality of llseek() on tmp_file successful
llseek01    2  TBROK  :  llseek01.c:223: Cannot reset max. file size using setrlimit
llseek01    3  TBROK  :  llseek01.c:223: Remaining cases broken

This issue comes from cleanup function that tries to restore previously altered file size limit. But this fails as unprivileged because it cannot raise the hard limits.

The attached patch make the testcase succeed as unprivileged by removing the offending setrlimit call.

njoly@raya [syscalls/llseek]> ./llseek01
llseek01 1 TPASS : Functionality of llseek() on tmp_file successful

Hope this helps,
Regards.

Signature · 4 lines
Nicolas Joly

Biology IT Center
Institut Pasteur, Paris.

commit a98d20f5a35ecb09c0185ef7b8be1e46d726c1c9

Author: Nicolas Joly <[email protected]>
Date:   Tue Mar 17 07:51:21 2015 +0100

syscalls/llseek01: Fix unprivileged behaviour

Kill unneeded setrlimit call from cleanup. Only privileged process can increase hard limits.

testcases/kernel/syscalls/llseek/llseek01.c +0 -5
index b956dbf..5202d3b 100644
@@ -217,9 +217,4 @@ void cleanup(void)
 	SAFE_CLOSE(NULL, fildes);
 
 	tst_rmdir();
-
-	if (setrlimit(RLIMIT_FSIZE, &rlp_orig) == -1)
-		tst_brkm(TBROK, NULL,
-			 "Cannot reset max. file size using setrlimit");
-
 }

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw

Hi!

Quoted 10 lines

Running llseek01 testcase as unprivileged user currently fails.

njoly@raya [syscalls/llseek]> ./llseek01

llseek01    1  TPASS  :  Functionality of llseek() on tmp_file successful
llseek01    2  TBROK  :  llseek01.c:223: Cannot reset max. file size using setrlimit
llseek01    3  TBROK  :  llseek01.c:223: Remaining cases broken

This issue comes from cleanup function that tries to restore previously altered file size limit. But this fails as unprivileged because it cannot raise the hard limits.

Either we remove the restoration or add tst_require_root() to setup(), I'm fine with either one. However this patch is incomplete because it removes only the restoration part but leaves the then unused getrlimit() that gets the original limit in setup, this should be removed (with the global rlp_orig variable) as well.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi!

Quoted 1 line

Please find a new version that adress Cyril concerns.

Pushed, thanks.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list