All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] Fix unprivileged llseek01 behaviour
@ 2015-03-17  7:08 Nicolas Joly
  2015-03-17 13:32 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Joly @ 2015-03-17  7:08 UTC (permalink / raw)
  To: LTP list

[-- Attachment #1: Type: text/plain, Size: 814 bytes --]


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.

-- 
Nicolas Joly

Biology IT Center
Institut Pasteur, Paris.

[-- Attachment #2: ltp-llseekunprivileged.diff --]
[-- Type: text/plain, Size: 791 bytes --]

commit a98d20f5a35ecb09c0185ef7b8be1e46d726c1c9
Author: Nicolas Joly <njoly@pasteur.fr>
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.
    
    Signed-off-by: Nicolas Joly <njoly@pasteur.fr>

diff --git a/testcases/kernel/syscalls/llseek/llseek01.c b/testcases/kernel/syscalls/llseek/llseek01.c
index b956dbf..5202d3b 100644
--- a/testcases/kernel/syscalls/llseek/llseek01.c
+++ b/testcases/kernel/syscalls/llseek/llseek01.c
@@ -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");
-
 }

[-- Attachment #3: Type: text/plain, Size: 441 bytes --]

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

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] Fix unprivileged llseek01 behaviour
  2015-03-17  7:08 [LTP] [PATCH] Fix unprivileged llseek01 behaviour Nicolas Joly
@ 2015-03-17 13:32 ` Cyril Hrubis
       [not found]   ` <20150317144635.GA15545@issan.sis.pasteur.fr>
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2015-03-17 13:32 UTC (permalink / raw)
  To: Nicolas Joly; +Cc: LTP list

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.

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.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH v2] Fix unprivileged llseek01 behaviour
       [not found]     ` <20150318103219.GA29704@issan.sis.pasteur.fr>
@ 2015-03-18 10:54       ` Cyril Hrubis
  0 siblings, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2015-03-18 10:54 UTC (permalink / raw)
  To: Nicolas Joly; +Cc: LTP list

Hi!
> Please find a new version that adress Cyril concerns.

Pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-18 10:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-17  7:08 [LTP] [PATCH] Fix unprivileged llseek01 behaviour Nicolas Joly
2015-03-17 13:32 ` Cyril Hrubis
     [not found]   ` <20150317144635.GA15545@issan.sis.pasteur.fr>
     [not found]     ` <20150318103219.GA29704@issan.sis.pasteur.fr>
2015-03-18 10:54       ` [LTP] [PATCH v2] " Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.