public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/setxattr03: turn off immutable and append bit only if already set
@ 2012-07-02 10:53 Eryu Guan
  2012-07-02 10:59 ` Caspar Zhang
  2012-07-02 11:29 ` Wanlong Gao
  0 siblings, 2 replies; 3+ messages in thread
From: Eryu Guan @ 2012-07-02 10:53 UTC (permalink / raw)
  To: ltp-list

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


Turn off immutable and append-only attribute in cleanup() only if they
are already turned on. Otherwise bogus WARNING would fail test case when
no xattr support in fs or mount without user_xattr option.

setxattr03    1  TCONF  :  No xattr support in fs or fs mounted without user_xattr option
setxattr03    2  TCONF  :  Remaining cases not appropriate for configuration
setxattr03    0  TWARN  :  Unset setxattr03immutable immutable failed: errno=EINVAL(22): Invalid argument
setxattr03    0  TWARN  :  Unset setxattr03appendonly append-only failed: errno=EINVAL(22): Invalid argument

(The check-fd-value way is not perfect, but I think it's much more
easier and could cover the most common case.)

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 testcases/kernel/syscalls/setxattr/setxattr03.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-syscalls-setxattr03-turn-off-immutable-and-append-bi.patch --]
[-- Type: text/x-patch; name="0001-syscalls-setxattr03-turn-off-immutable-and-append-bi.patch", Size: 671 bytes --]

diff --git a/testcases/kernel/syscalls/setxattr/setxattr03.c b/testcases/kernel/syscalls/setxattr/setxattr03.c
index fa97a6b..47a82b0 100644
--- a/testcases/kernel/syscalls/setxattr/setxattr03.c
+++ b/testcases/kernel/syscalls/setxattr/setxattr03.c
@@ -202,10 +202,10 @@ static void setup(void)
 
 static void cleanup(void)
 {
-	if (set_immutable_off(immu_fd))
+	if ((immu_fd > 0) && set_immutable_off(immu_fd))
 		tst_resm(TWARN | TERRNO, "Unset %s immutable failed",
 		    IMMU_FILE);
-	if (set_append_off(append_fd))
+	if ((append_fd > 0) && set_append_off(append_fd))
 		tst_resm(TWARN | TERRNO, "Unset %s append-only failed",
 		    APPEND_FILE);
 	close(immu_fd);

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

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

[-- 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] syscalls/setxattr03: turn off immutable and append bit only if already set
  2012-07-02 10:53 [LTP] [PATCH] syscalls/setxattr03: turn off immutable and append bit only if already set Eryu Guan
@ 2012-07-02 10:59 ` Caspar Zhang
  2012-07-02 11:29 ` Wanlong Gao
  1 sibling, 0 replies; 3+ messages in thread
From: Caspar Zhang @ 2012-07-02 10:59 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ltp-list

On 07/02/2012 06:53 PM, Eryu Guan wrote:
> 
> Turn off immutable and append-only attribute in cleanup() only if they
> are already turned on. Otherwise bogus WARNING would fail test case when
> no xattr support in fs or mount without user_xattr option.
> 
> setxattr03    1  TCONF  :  No xattr support in fs or fs mounted without user_xattr option
> setxattr03    2  TCONF  :  Remaining cases not appropriate for configuration
> setxattr03    0  TWARN  :  Unset setxattr03immutable immutable failed: errno=EINVAL(22): Invalid argument
> setxattr03    0  TWARN  :  Unset setxattr03appendonly append-only failed: errno=EINVAL(22): Invalid argument
> 
> (The check-fd-value way is not perfect, but I think it's much more
> easier and could cover the most common case.)
> 
> Signed-off-by: Eryu Guan <eguan@redhat.com>

Looks good to me.

Reviewed-by: Caspar Zhang <caspar@casparzhang.com>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
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] syscalls/setxattr03: turn off immutable and append bit only if already set
  2012-07-02 10:53 [LTP] [PATCH] syscalls/setxattr03: turn off immutable and append bit only if already set Eryu Guan
  2012-07-02 10:59 ` Caspar Zhang
@ 2012-07-02 11:29 ` Wanlong Gao
  1 sibling, 0 replies; 3+ messages in thread
From: Wanlong Gao @ 2012-07-02 11:29 UTC (permalink / raw)
  To: Eryu Guan; +Cc: ltp-list

On 07/02/2012 06:53 PM, Eryu Guan wrote:
> 
> Turn off immutable and append-only attribute in cleanup() only if they
> are already turned on. Otherwise bogus WARNING would fail test case when
> no xattr support in fs or mount without user_xattr option.
> 
> setxattr03    1  TCONF  :  No xattr support in fs or fs mounted without user_xattr option
> setxattr03    2  TCONF  :  Remaining cases not appropriate for configuration
> setxattr03    0  TWARN  :  Unset setxattr03immutable immutable failed: errno=EINVAL(22): Invalid argument
> setxattr03    0  TWARN  :  Unset setxattr03appendonly append-only failed: errno=EINVAL(22): Invalid argument
> 
> (The check-fd-value way is not perfect, but I think it's much more
> easier and could cover the most common case.)

pushed, thanks,


Wanlong Gao

> 
> Signed-off-by: Eryu Guan <eguan@redhat.com>
> ---
>  testcases/kernel/syscalls/setxattr/setxattr03.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> 
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> 
> 
> 
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
> 



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
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:[~2012-07-02 11:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-02 10:53 [LTP] [PATCH] syscalls/setxattr03: turn off immutable and append bit only if already set Eryu Guan
2012-07-02 10:59 ` Caspar Zhang
2012-07-02 11:29 ` Wanlong Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox