public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Sharyathi Nagesh <sharyath@in.ibm.com>
To: subrata@linux.vnet.ibm.com
Cc: ltp-list@lists.sourceforge.net, mbeeraka@in.ibm.com
Subject: Re: [LTP] [PATCH][RESEND] Issue observed with chmod05, fchmod05 test	cases
Date: Tue, 15 Sep 2009 15:57:22 +0530	[thread overview]
Message-ID: <4AAF6C0A.3060501@in.ibm.com> (raw)
In-Reply-To: <1249648889.4851.38.camel@subratamodak.linux.ibm.com>

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

Subrata
   Excuse me for the late response, I have update the patch as well as the description. 
Please re-verify
Thanks
Sharyathi


[-- Attachment #2: fix_supplementary_group_id_issue.patch --]
[-- Type: text/x-patch, Size: 3004 bytes --]

This Patch fixes bug in the test cases chmod05.c and fchmod05.c. The test case uses 2 UserIds nobody and bin.
The issue is observed when one of the UserId is the supplementary group Ids of the rooti (either nobody or bin).
In that case the Posix standard mentions that S_IGSID bit should not be cleared by the systemcall, chmod() 
or fchmod(), which causes the test to fail. 
This patch fixes the issue by specifically clearing the supplementary group ID of the process.
The main intention of the test case is to test if S_IGSID bit is cleared in case the non privilage user tries to 
set file modes. Hence felt clearing the supplementary group Ids is the best way to fix the issue.
At the same time I am reverting the earlier patch submitted by Wei Yongjun <yjwei@cn.fujitsu.com> 

Signed-off-by: Sharyathi Nagesh <sharyath@in.ibm.com>

Index: ltp-full-20090831/testcases/kernel/syscalls/fchmod/fchmod05.c
===================================================================
--- ltp-full-20090831.orig/testcases/kernel/syscalls/fchmod/fchmod05.c	2009-08-31 10:45:51.000000000 +0530
+++ ltp-full-20090831/testcases/kernel/syscalls/fchmod/fchmod05.c	2009-09-15 15:37:20.000000000 +0530
@@ -218,12 +218,16 @@
 		tst_brkm(TBROK, cleanup, "mkdir(2) of %s failed", TESTDIR);
 	}
 
-	if (chown(TESTDIR, nobody_u->pw_uid, nobody_u->pw_gid) == -1)
+	if(setgroups(1, &nobody_u->pw_gid) == -1)
+		tst_brkm(TBROK, cleanup, "Couldn't change supplementary group Id: %s",
+				strerror(errno));
+
+	if (chown(TESTDIR, nobody_u->pw_uid, bin_group->gr_gid) == -1)
 		tst_brkm(TBROK, cleanup, "Couldn't change owner of testdir: %s",
 				strerror(errno));
 
-	/* change to nobody:bin */
-	if (setegid(bin_group->gr_gid) == -1 || seteuid(nobody_u->pw_uid) == -1)
+	/* change to nobody:nobody */
+	if (setegid(nobody_u->pw_gid) == -1 || seteuid(nobody_u->pw_uid) == -1)
 		tst_brkm(TBROK, cleanup, "Couldn't switch to nobody:nobody: %s",
 				strerror(errno));
 
Index: ltp-full-20090831/testcases/kernel/syscalls/chmod/chmod05.c
===================================================================
--- ltp-full-20090831.orig/testcases/kernel/syscalls/chmod/chmod05.c	2009-08-31 10:45:53.000000000 +0530
+++ ltp-full-20090831/testcases/kernel/syscalls/chmod/chmod05.c	2009-09-15 15:41:27.000000000 +0530
@@ -236,11 +236,15 @@
 	if (mkdir(TESTDIR, MODE_RWX) < 0)
 		tst_brkm(TBROK|TERRNO, cleanup, "mkdir(%s) failed", TESTDIR);
 
-	if (chown(TESTDIR, nobody_u->pw_uid, nobody_u->pw_gid) == -1)
+	if(setgroups(1, &nobody_u->pw_gid) == -1)
+		tst_brkm(TBROK, cleanup, "Couldn't change supplementary group Id: %s",
+				strerror(errno));
+
+	if (chown(TESTDIR, nobody_u->pw_uid, bin_group->gr_gid) == -1)
 		tst_brkm(TBROK|TERRNO, cleanup, "chown() of testdir failed");
 
-	/* change to nobody:bin */
-	if (setegid(bin_group->gr_gid) == -1 ||
+	/* change to nobody:nobody */
+	if (setegid(nobody_u->pw_gid) == -1 || 
 		 seteuid(nobody_u->pw_uid) == -1)
 		tst_brkm(TBROK|TERRNO, cleanup, "Couldn't switch to nobody:nobody");
 }

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

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf

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

  reply	other threads:[~2009-09-15 10:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-29  7:00 [LTP] Issue observed with chmod05, fchmod05 test cases Sharyathi Nagesh
2009-06-29  7:33 ` Wei Yongjun
2009-06-29 10:30   ` Sharyathi Nagesh
2009-07-02  4:34   ` Sharyathi Nagesh
2009-07-20 11:25   ` Sharyathi Nagesh
2009-07-20 15:56     ` Garrett Cooper
2009-07-21  8:57       ` Sharyathi Nagesh
2009-07-30 18:28         ` Subrata Modak
2009-07-31  1:38           ` Sharyathi Nagesh
2009-07-31  1:54             ` Subrata Modak
2009-08-06 11:39               ` [LTP] [PATCH][RESEND] " Sharyathi Nagesh
2009-08-07 12:41                 ` Subrata Modak
2009-09-15 10:27                   ` Sharyathi Nagesh [this message]
2009-09-16 15:16                     ` Subrata Modak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AAF6C0A.3060501@in.ibm.com \
    --to=sharyath@in.ibm.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=mbeeraka@in.ibm.com \
    --cc=subrata@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox