Skip to contentSkip to conversation

lchown test case

LTP Michal Simek 3 participants 10 messages Jan 4, 2010 – Jan 8, 2010

lore
Share & tools
lore
#0 lore raw

Hi,

I have some problems with lchown02 test which is caused with this patch. What is prep_create_link?

Thanks,
Michal

http://git.kernel.org/?p=linux/kernel/git/galak/ltp.git;a=commitdiff;h=ee1a022fc76076d7fc1b6b1797c195244414c038

runtest/syscalls +2 -3
index fbe8641..34631ed 100644 (file)
@@ -462,10 +462,10 @@ kill12 kill12
 
  lchown01 lchown01
  lchown01_16 lchown01_16
-lchown02 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02
-lchown02_16 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02_16
+lchown02 prep_create_link; lchown02
+lchown02_16 prep_create_link; lchown02_16
 
-- 

Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw

Michal Simek napsal(a):

Quoted 1 line

Hi,

Hi,

Quoted 19 lines

I have some problems with lchown02 test which is caused with this patch. What is prep_create_link?

Thanks,
Michal

http://git.kernel.org/?p=linux/kernel/git/galak/ltp.git;a=commitdiff;h=ee1a022fc76076d7fc1b6b1797c195244414c038

runtest/syscalls +0 -0
index fbe8641..34631ed 100644 (file)
@@ -462,10 +462,10 @@ kill12 kill12
 

lchown01 lchown01
lchown01_16 lchown01_16

runtest/syscalls kill12 kill12 · line 466

Quoted 4 lines
runtest/syscalls +2 -2
-lchown02 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02
-lchown02_16 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02_16
+lchown02 prep_create_link; lchown02
+lchown02_16 prep_create_link; lchown02_16

IMHO it should do the same as the line above. But I think the whole thing could be deleted without causing any grief:

http://repo.or.cz/w/ltp-debian.git?a=commit;h=a5499edcf368fa88df924f94ffcbe63c22b46e82

Regards
Jiri Palecek

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
Quoted 33 lines · Jiri Palecek

Michal Simek napsal(a):

Quoted 2 lines

Hi,

Hi,

Quoted 20 lines

I have some problems with lchown02 test which is caused with this patch. What is prep_create_link?

Thanks,
Michal

http://git.kernel.org/?p=linux/kernel/git/galak/ltp.git;a=commitdiff;h=ee1a022fc76076d7fc1b6b1797c195244414c038

runtest/syscalls +0 -0
index fbe8641..34631ed 100644 (file)
@@ -462,10 +462,10 @@ kill12 kill12
 

lchown01 lchown01
lchown01_16 lchown01_16

runtest/syscalls kill12 kill12 · line 466

Quoted 4 lines
runtest/syscalls +2 -2
-lchown02 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02
-lchown02_16 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02_16
+lchown02 prep_create_link; lchown02
+lchown02_16 prep_create_link; lchown02_16

IMHO it should do the same as the line above. But I think the whole thing could be deleted without causing any grief:

Quoted 1 line

http://repo.or.cz/w/ltp-debian.git?a=commit;h=a5499edcf368fa88df924f94ffcbe63c22b46e82

The test needs create_link in $TMP; that's why I scripted it as a one-liner (but stupid me probably forgot to add the script to CVS -_-).
Let me look and I'll get back to you shortly.
-Garrett

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw
Quoted 34 lines · Garrett Cooper
Quoted 33 lines · Jiri Palecek

Michal Simek napsal(a):

Quoted 2 lines

Hi,

Hi,

Quoted 20 lines

I have some problems with lchown02 test which is caused with this patch. What is prep_create_link?

Thanks,
Michal

http://git.kernel.org/?p=linux/kernel/git/galak/ltp.git;a=commitdiff;h=ee1a022fc76076d7fc1b6b1797c195244414c038

runtest/syscalls +0 -0
index fbe8641..34631ed 100644 (file)
@@ -462,10 +462,10 @@ kill12 kill12
 

lchown01 lchown01
lchown01_16 lchown01_16

runtest/syscalls kill12 kill12 · line 466

Quoted 4 lines
runtest/syscalls +2 -2
-lchown02 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02
-lchown02_16 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02_16
+lchown02 prep_create_link; lchown02
+lchown02_16 prep_create_link; lchown02_16

IMHO it should do the same as the line above. But I think the whole thing could be deleted without causing any grief:

Quoted 6 lines
Quoted 1 line

http://repo.or.cz/w/ltp-debian.git?a=commit;h=a5499edcf368fa88df924f94ffcbe63c22b46e82

The test needs create_link in $TMP; that's why I scripted it as a one-liner (but stupid me probably forgot to add the script to CVS -_-).
Let me look and I'll get back to you shortly.

Fixed. The executable needed CAP_CHOWN capability and that's part of the point behind that script...
-Garrett

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#4 lore raw
Quoted 31 lines · Garrett Cooper
Quoted 30 lines · Garrett Cooper
Quoted 29 lines · Jiri Palecek

Michal Simek napsal(a):

Quoted 1 line

Hi,

Hi,

Quoted 19 lines

I have some problems with lchown02 test which is caused with this patch. What is prep_create_link?

Thanks,
Michal

http://git.kernel.org/?p=linux/kernel/git/galak/ltp.git;a=commitdiff;h=ee1a022fc76076d7fc1b6b1797c195244414c038

runtest/syscalls +0 -0
index fbe8641..34631ed 100644 (file)
@@ -462,10 +462,10 @@ kill12 kill12
 

lchown01 lchown01
lchown01_16 lchown01_16

runtest/syscalls

Quoted 4 lines
runtest/syscalls +2 -2
-lchown02 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02
-lchown02_16 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02_16
+lchown02 prep_create_link; lchown02
+lchown02_16 prep_create_link; lchown02_16

IMHO it should do the same as the line above. But I think the whole thing could be deleted without causing any grief:

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

http://repo.or.cz/w/ltp-debian.git?a=commit;h=a5499edcf368fa88df924f94ffcbe63c22b46e82

The test needs create_link in $TMP; that's why I scripted it as a one-liner (but stupid me probably forgot to add the script to CVS -_-).
Let me look and I'll get back to you shortly.

Fixed. The executable needed CAP_CHOWN capability and that's part of the point behind that script...

ok. I rerun the latest code and lchown02 testcases still failing. I added two printf messages (path:Path_name - and buffer:Cmd_buffer) which you can see below. And remove tst_rmdir to see if file exist or not.

path /tmp/ltp-XXXX1ZaUjj/lch6m6mr0
buffer /mnt/4/ltp/build/testcases/bin/create_link /tmp/ltp-XXXX1ZaUjj/lch6m6mr0/tfile_1
change_owner: chown() of /tmp/ltp-XXXX1ZaUjj/lch6m6mr0/tfile_1 failed, error 1

lchown02    1  TBROK  :  Fail to modify tfile_1 ownership(s)!
lchown02    2  TBROK  :  Remaining cases broken
lchown02    3  TBROK  :  Remaining cases broken
lchown02    4  TBROK  :  Remaining cases broken
lchown02    5  TBROK  :  Remaining cases broken
lchown02    6  TBROK  :  Remaining cases broken
lchown02    7  TBROK  :  Remaining cases broken

path /tmp/ltp-XXXX1ZaUjj/lchouwHqq
buffer /mnt/4/ltp/build/testcases/bin/create_link /tmp/ltp-XXXX1ZaUjj/lchouwHqq/tfile_1
change_owner: chown() of /tmp/ltp-XXXX1ZaUjj/lchouwHqq/tfile_1 failed, error 1

lchown02    1  TBROK  :  Fail to modify tfile_1 ownership(s)!
lchown02    2  TBROK  :  Remaining cases broken
lchown02    3  TBROK  :  Remaining cases broken
lchown02    4  TBROK  :  Remaining cases broken
lchown02    5  TBROK  :  Remaining cases broken
lchown02    6  TBROK  :  Remaining cases broken
lchown02    7  TBROK  :  Remaining cases broken

The problem is at first with create_link because there is used /mnt/4/ltp/build/testcases/bin/create_link instead of /tmp/ltp-XXXX1ZaUjj/create_link which is setup by prep_create_link

Please test the patch below which run correct version on my system

Then I tried to run lchown02 test under user and I think that this line in prep_create_link is addtional
#chown root:root "$TMP/create_link"

lchown test must be run under root that's why create_link will have root rights and under user test reports that must be run as root.

lchown02    1  TBROK  :  Test must be run as root
lchown02    2  TBROK  :  Remaining cases broken
lchown02    3  TBROK  :  Remaining cases broken
lchown02    4  TBROK  :  Remaining cases broken
lchown02    5  TBROK  :  Remaining cases broken
lchown02    6  TBROK  :  Remaining cases broken
lchown02    7  TBROK  :  Remaining cases broken
lchown02    1  TBROK  :  Test must be run as root
lchown02    2  TBROK  :  Remaining cases broken
lchown02    3  TBROK  :  Remaining cases broken
lchown02    4  TBROK  :  Remaining cases broken
lchown02    5  TBROK  :  Remaining cases broken
lchown02    6  TBROK  :  Remaining cases broken
lchown02    7  TBROK  :  Remaining cases broken

Thanks for testing,
Michal

lchown02.c 2010-01-06 13:00:49.000000000 +0100 renamed from lchown02-old.c 2010-01-06 12:59:32.000000000 +0100 +0 -1
@@ -112,7 +112,6 @@
  char Longpathname[PATH_MAX + 2];
  char High_address_node[64];
  char EXEC_DIR[PATH_MAX];
-char main_test_dir[PATH_MAX + 2];
 
  struct test_case_t {           /* test case struct. to hold ref. test 

cond's */

         char *pathname;
@@ -265,12 +264,6 @@
         /* Pause if that option was specified */
         TEST_PAUSE;

- /* remember current dir, because create_link has been copied here */
- if (getcwd(main_test_dir, sizeof(main_test_dir)) == NULL) {
- tst_brkm(TBROK | TERRNO, cleanup,
- "failed to get the current working directory.");
- }
-

         /* Make a temp dir and cd to it */
         tst_tmpdir();

@@ -339,12 +332,13 @@

         strcpy(Path2_name, Path_name);
+       /* Get the command name to be executed as setuid to root */
+       strcat((char *)Cmd_buffer, Path_name);
+       strcat((char *)Cmd_buffer, (const char *)"/../create_link ");
+
         /* Get the path of test file created under temporary directory */
         strcat(Path_name, "/" TEST_FILE1);
-       /* Get the command name to be executed as setuid to root */
-       strcat((char *)Cmd_buffer, main_test_dir);
-       strcat((char *)Cmd_buffer, (const char *)"/create_link ");
         strcat((char *)Cmd_buffer, Path_name);

         if (system((const char *)Cmd_buffer) != 0) {
Quoted 1 line

-Garrett

Signature · 14 lines
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#5 lore raw
Quoted 148 lines · Michal Simek
Quoted 44 lines · Garrett Cooper
Quoted 42 lines · Garrett Cooper
Quoted 39 lines · Jiri Palecek

Michal Simek napsal(a):

Quoted 2 lines

Hi,

Hi,

Quoted 22 lines

I have some problems with lchown02 test which is caused with this patch.
What is prep_create_link?

Thanks,
Michal

http://git.kernel.org/?p=linux/kernel/git/galak/ltp.git;a=commitdiff;h=ee1a022fc76076d7fc1b6b1797c195244414c038

runtest/syscalls +0 -0
index fbe8641..34631ed 100644 (file)
@@ -462,10 +462,10 @@ kill12 kill12
 

lchown01 lchown01
lchown01_16 lchown01_16

runtest/syscalls

Quoted 4 lines
runtest/syscalls +2 -2
-lchown02 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02
-lchown02_16 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02_16
+lchown02 prep_create_link; lchown02
+lchown02_16 prep_create_link; lchown02_16

IMHO it should do the same as the line above. But I think the whole thing
could be deleted without causing any grief:

http://repo.or.cz/w/ltp-debian.git?a=commit;h=a5499edcf368fa88df924f94ffcbe63c22b46e82

Quoted 7 lines
Quoted 4 lines

The test needs create_link in $TMP; that's why I scripted it as a one-liner (but stupid me probably forgot to add the script to CVS -_-).
Let me look and I'll get back to you shortly.

Fixed. The executable needed CAP_CHOWN capability and that's part of the point behind that script...

ok. I rerun the latest code and lchown02 testcases still failing. I added two printf messages (path:Path_name -  and buffer:Cmd_buffer) which you can see below. And remove tst_rmdir to see if file exist or not.

path /tmp/ltp-XXXX1ZaUjj/lch6m6mr0
buffer /mnt/4/ltp/build/testcases/bin/create_link /tmp/ltp-XXXX1ZaUjj/lch6m6mr0/tfile_1
change_owner: chown() of /tmp/ltp-XXXX1ZaUjj/lch6m6mr0/tfile_1 failed, error 1
lchown02    1  TBROK  :  Fail to modify tfile_1 ownership(s)! lchown02    2  TBROK  :  Remaining cases broken
lchown02    3  TBROK  :  Remaining cases broken
lchown02    4  TBROK  :  Remaining cases broken
lchown02    5  TBROK  :  Remaining cases broken
lchown02    6  TBROK  :  Remaining cases broken
lchown02    7  TBROK  :  Remaining cases broken
path /tmp/ltp-XXXX1ZaUjj/lchouwHqq
buffer /mnt/4/ltp/build/testcases/bin/create_link /tmp/ltp-XXXX1ZaUjj/lchouwHqq/tfile_1
change_owner: chown() of /tmp/ltp-XXXX1ZaUjj/lchouwHqq/tfile_1 failed, error 1
lchown02    1  TBROK  :  Fail to modify tfile_1 ownership(s)! lchown02    2  TBROK  :  Remaining cases broken
lchown02    3  TBROK  :  Remaining cases broken
lchown02    4  TBROK  :  Remaining cases broken
lchown02    5  TBROK  :  Remaining cases broken
lchown02    6  TBROK  :  Remaining cases broken
lchown02    7  TBROK  :  Remaining cases broken

The problem is at first with create_link because there is used /mnt/4/ltp/build/testcases/bin/create_link instead of /tmp/ltp-XXXX1ZaUjj/create_link which is setup by prep_create_link

Please test the patch below which run correct version on my system

Then I tried to run lchown02 test under user and I think that this line in prep_create_link is addtional
#chown root:root "$TMP/create_link"

lchown test must be run under root that's why create_link will have root rights and under user test reports that must be run as root.

lchown02    1  TBROK  :  Test must be run as root
lchown02    2  TBROK  :  Remaining cases broken
lchown02    3  TBROK  :  Remaining cases broken
lchown02    4  TBROK  :  Remaining cases broken
lchown02    5  TBROK  :  Remaining cases broken
lchown02    6  TBROK  :  Remaining cases broken
lchown02    7  TBROK  :  Remaining cases broken
lchown02    1  TBROK  :  Test must be run as root
lchown02    2  TBROK  :  Remaining cases broken
lchown02    3  TBROK  :  Remaining cases broken
lchown02    4  TBROK  :  Remaining cases broken
lchown02    5  TBROK  :  Remaining cases broken
lchown02    6  TBROK  :  Remaining cases broken
lchown02    7  TBROK  :  Remaining cases broken

Thanks for testing,
Michal

lchown02.c  2010-01-06 13:00:49.000000000 +0100 renamed from lchown02-old.c      2010-01-06 12:59:32.000000000 +0100 +0 -1
@@ -112,7 +112,6 @@
  char Longpathname[PATH_MAX + 2];
  char High_address_node[64];
  char EXEC_DIR[PATH_MAX];
-char main_test_dir[PATH_MAX + 2];
 

 struct test_case_t {           /* test case struct. to hold ref. test cond's */
       char *pathname;

lchown02.c  2010-01-06 13:00:49.000000000 +0100 renamed from lchown02-old.c      2010-01-06 12:59:32.000000000 +0100 +3 -6
@@ -265,12 +264,6 @@
        /* Pause if that option was specified */
        TEST_PAUSE;
 
-       /* remember current dir, because create_link has been copied here */
-       if (getcwd(main_test_dir, sizeof(main_test_dir)) == NULL) {
-               tst_brkm(TBROK | TERRNO, cleanup,
-                        "failed to get the current working directory.");
-       }
-
        /* Make a temp dir and cd to it */
        tst_tmpdir();
 
@@ -339,12 +332,13 @@
 
        strcpy(Path2_name, Path_name);
 
+       /* Get the command name to be executed as setuid to root */
+       strcat((char *)Cmd_buffer, Path_name);
+       strcat((char *)Cmd_buffer, (const char *)"/../create_link ");

lchown02.c  2010-01-06 13:00:49.000000000 +0100 line 344

Quoted 10 lines
lchown02.c  2010-01-06 13:00:49.000000000 +0100 renamed from lchown02-old.c      2010-01-06 12:59:32.000000000 +0100 +1 -3
+
        /* Get the path of test file created under temporary directory */
        strcat(Path_name, "/" TEST_FILE1);
 
-       /* Get the command name to be executed as setuid to root */
-       strcat((char *)Cmd_buffer, main_test_dir);
-       strcat((char *)Cmd_buffer, (const char *)"/create_link ");
        strcat((char *)Cmd_buffer, Path_name);
 
        if (system((const char *)Cmd_buffer) != 0) {

I'll look at this and resolve it tonight, but I think your
solution is correct... I just need to look at the source a bit better...
Thanks,
-Garrett

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#6 lore raw
In reply to Garrett Cooper

Garrett Cooper napsal(a):

Quoted 37 lines · Garrett Cooper
Quoted 36 lines · Jiri Palecek
Quoted 34 lines

Michal Simek napsal(a):

Quoted 2 lines

Hi,

Hi,

Quoted 20 lines

I have some problems with lchown02 test which is caused with this patch. What is prep_create_link?

Thanks,
Michal

http://git.kernel.org/?p=linux/kernel/git/galak/ltp.git;a=commitdiff;h=ee1a022fc76076d7fc1b6b1797c195244414c038

runtest/syscalls +0 -0
index fbe8641..34631ed 100644 (file)
@@ -462,10 +462,10 @@ kill12 kill12
 

lchown01 lchown01
lchown01_16 lchown01_16

runtest/syscalls kill12 kill12 · line 466

Quoted 4 lines
runtest/syscalls +2 -2
-lchown02 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02
-lchown02_16 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02_16
+lchown02 prep_create_link; lchown02
+lchown02_16 prep_create_link; lchown02_16

IMHO it should do the same as the line above. But I think the whole thing could be deleted without causing any grief:

http://repo.or.cz/w/ltp-debian.git?a=commit;h=a5499edcf368fa88df924f94ffcbe63c22b46e82

Quoted 7 lines
Quoted 4 lines

The test needs create_link in $TMP; that's why I scripted it as a one-liner (but stupid me probably forgot to add the script to CVS -_-).
Let me look and I'll get back to you shortly.

Fixed. The executable needed CAP_CHOWN capability and that's part of the point behind that script...

Couldn't the executable just get CAP_CHOWN with cap_set_proc in case it is running under root with restricted capabilities?

I'm not sure it wouldn't fail even with the suid-root executable under such condition - are you really sure it doesn't (esp. in the face of lchown01, which would fail almost surely and doesn't have this hack)?

Regards
Jiri Palecek

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#7 lore raw
Quoted 53 lines · Jiri Palecek

Garrett Cooper napsal(a):

Quoted 44 lines · Garrett Cooper
Quoted 42 lines · Jiri Palecek
Quoted 39 lines

Michal Simek napsal(a):

Quoted 2 lines

Hi,

Hi,

Quoted 22 lines

I have some problems with lchown02 test which is caused with this patch.
What is prep_create_link?

Thanks,
Michal

http://git.kernel.org/?p=linux/kernel/git/galak/ltp.git;a=commitdiff;h=ee1a022fc76076d7fc1b6b1797c195244414c038

runtest/syscalls +0 -0
index fbe8641..34631ed 100644 (file)
@@ -462,10 +462,10 @@ kill12 kill12
 

lchown01 lchown01
lchown01_16 lchown01_16

runtest/syscalls kill12 kill12 · line 466

Quoted 4 lines
runtest/syscalls +2 -2
-lchown02 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02
-lchown02_16 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02_16
+lchown02 prep_create_link; lchown02
+lchown02_16 prep_create_link; lchown02_16

IMHO it should do the same as the line above. But I think the whole thing
could be deleted without causing any grief:

http://repo.or.cz/w/ltp-debian.git?a=commit;h=a5499edcf368fa88df924f94ffcbe63c22b46e82

Quoted 7 lines
Quoted 4 lines

The test needs create_link in $TMP; that's why I scripted it as a one-liner (but stupid me probably forgot to add the script to CVS -_-).
Let me look and I'll get back to you shortly.

Fixed. The executable needed CAP_CHOWN capability and that's part of the point behind that script...

Quoted 6 lines

Couldn't the executable just get CAP_CHOWN with cap_set_proc in case it is running under root with restricted capabilities?

I'm not sure it wouldn't fail even with the suid-root executable under such condition - are you really sure it doesn't (esp. in the face of lchown01, which would fail almost surely and doesn't have this hack)?

This requires libcap though, which means that any system under
test without it would fail the test:

NAME
cap_get_proc, cap_set_proc, capgetp - capability manipulation on pro- cesses

SYNOPSIS

       #include <sys/capability.h>

       cap_t cap_get_proc(void);

       int cap_set_proc(cap_t cap_p);

       #include <sys/types.h>

       cap_t cap_get_pid(pid_t pid);

       Link with -lcap.

    I agree though, this is the best / cleanest solution...

Thanks,
-Garrett

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#8 lore raw
Quoted 59 lines · Garrett Cooper
Quoted 41 lines · Jiri Palecek

Garrett Cooper napsal(a):

Quoted 40 lines · Garrett Cooper
Quoted 39 lines · Jiri Palecek
Quoted 33 lines

Michal Simek napsal(a):

Quoted 1 line

Hi,

Hi,

Quoted 21 lines

I have some problems with lchown02 test which is caused with this patch.
What is prep_create_link?

Thanks,
Michal

http://git.kernel.org/?p=linux/kernel/git/galak/ltp.git;a=commitdiff;h=ee1a022fc76076d7fc1b6b1797c195244414c038

runtest/syscalls +0 -0
index fbe8641..34631ed 100644 (file)
@@ -462,10 +462,10 @@ kill12 kill12
 

lchown01 lchown01
lchown01_16 lchown01_16

runtest/syscalls kill12 kill12 · line 466

Quoted 4 lines
runtest/syscalls +2 -2
-lchown02 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02
-lchown02_16 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02_16
+lchown02 prep_create_link; lchown02
+lchown02_16 prep_create_link; lchown02_16

IMHO it should do the same as the line above. But I think the whole thing
could be deleted without causing any grief:

Quoted 1 line

http://repo.or.cz/w/ltp-debian.git?a=commit;h=a5499edcf368fa88df924f94ffcbe63c22b46e82

The test needs create_link in $TMP; that's why I scripted it as a one-liner (but stupid me probably forgot to add the script to CVS -_-).
Let me look and I'll get back to you shortly.

Quoted 8 lines
Quoted 2 lines

Fixed. The executable needed CAP_CHOWN capability and that's part of the point behind that script...

Couldn't the executable just get CAP_CHOWN with cap_set_proc in case it is running under root with restricted capabilities?

I'm not sure it wouldn't fail even with the suid-root executable under such condition - are you really sure it doesn't (esp. in the face of lchown01, which would fail almost surely and doesn't have this hack)?

This requires libcap though, which means that any system under
test without it would fail the test:

NAME
cap_get_proc, cap_set_proc, capgetp - capability manipulation on pro- cesses

SYNOPSIS

Quoted 13 lines
       #include <sys/capability.h>

       cap_t cap_get_proc(void);

       int cap_set_proc(cap_t cap_p);

       #include <sys/types.h>

       cap_t cap_get_pid(pid_t pid);

       Link with -lcap.

    I agree though, this is the best / cleanest solution...

Please keep in your mind that not everybody has capability.h in toolchain. For example we don't have it. I can imagine that this could be one option. You can check if is capability.h and then use it. But if is not there still should be able to run that tests.

Michal

Quoted 2 lines

Thanks,
-Garrett

Signature · 14 lines
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#9 lore raw
Quoted 68 lines · Michal Simek
Quoted 58 lines · Garrett Cooper
Quoted 42 lines · Jiri Palecek

Garrett Cooper napsal(a):

Quoted 41 lines · Garrett Cooper
Quoted 40 lines · Jiri Palecek
Quoted 34 lines

Michal Simek napsal(a):

Quoted 1 line

Hi,

Hi,

Quoted 24 lines

I have some problems with lchown02 test which is caused with this patch.
What is prep_create_link?

Thanks,
Michal

http://git.kernel.org/?p=linux/kernel/git/galak/ltp.git;a=commitdiff;h=ee1a022fc76076d7fc1b6b1797c195244414c038

runtest/syscalls +0 -0
index fbe8641..34631ed 100644 (file)
@@ -462,10 +462,10 @@ kill12 kill12
 

lchown01 lchown01
lchown01_16 lchown01_16

runtest/syscalls +0 -2
-lchown02 cp -p $LTPROOT/testcases/bin/create_link $TMP; lchown02
-lchown02_16 cp -p $LTPROOT/testcases/bin/create_link $TMP;  

lchown02_16

runtest/syscalls

Quoted 2 lines
runtest/syscalls +2 -0
+lchown02 prep_create_link; lchown02
+lchown02_16 prep_create_link; lchown02_16

IMHO it should do the same as the line above. But I think the whole thing
could be deleted without causing any grief:

Quoted 1 line

http://repo.or.cz/w/ltp-debian.git?a=commit;h=a5499edcf368fa88df924f94ffcbe63c22b46e82

The test needs create_link in $TMP; that's why I scripted it as a one-liner (but stupid me probably forgot to add the script to CVS -_-).
Let me look and I'll get back to you shortly.

Quoted 8 lines
Quoted 2 lines

Fixed. The executable needed CAP_CHOWN capability and that's part of the point behind that script...

Couldn't the executable just get CAP_CHOWN with cap_set_proc in case it is running under root with restricted capabilities?

I'm not sure it wouldn't fail even with the suid-root executable under such condition - are you really sure it doesn't (esp. in the face of lchown01, which would fail almost surely and doesn't have this hack)?

This requires libcap though, which means that any system under
test without it would fail the test:
NAME
cap_get_proc, cap_set_proc, capgetp - capability manipulation
on pro-
cesses
SYNOPSIS

Quoted 7 lines
       #include <sys/capability.h>
        cap_t cap_get_proc(void);
        int cap_set_proc(cap_t cap_p);
        #include <sys/types.h>
        cap_t cap_get_pid(pid_t pid);
        Link with -lcap.
     I agree though, this is the best / cleanest solution...
Quoted 1 line

Please keep in your mind that not everybody has capability.h in toolchain. For example we don't have it. I can imagine that this could

True, but do you have a capability restricted root and NOT have capability.h.

Quoted 1 line

be one option. You can check if is capability.h and then use it. But if is not there still should be able to run that tests.

Yet I'm still unconviced about the motivation behind this. I tried running the *chown* tests under root with CAP_CHOWN dropped. As you can see in the attachment, all the tests failed (except for chown01, which is because this test doesn't actually test the functionality of chown). But, only lchown02 has this prep_create_link hack (and I'm actually unsure it would help in this case). So I don't know if these tests are actually meant to be working under these conditions, and if not, I can't see the reason of this prep_create_link script.

Regards
Jiri Palecek

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev

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