Skip to contentSkip to conversation

prot_hsymlinks: Fix failure on read-only machine

PATCH New [email protected] 2 participants 9 messages Apr 9, 2017 – May 11, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 prot_hsymlinks: Fix failure on read-only machine

Return 32 if /etc/passwd is read-only.
Fixes #88

---
 testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c | 5 +++++
 1 file changed, 5 insertions(+)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-prot_hsymlinks-Fix-failure-on-read-only-machine.patch
Type: text/x-patch
Size: 604 bytes
Desc: not available
URL: <http://lists.linux.it/pipermail/ltp/attachments/20170409/f21d355b/attachment.bin>

#1 lore raw

PATCH 1/1 setpriority01: Fix failure on read-only machine

Return 32 if /etc/passwd is read-only.
Fixes: #137
See also: #88

---
 testcases/kernel/syscalls/setpriority/setpriority01.c | 5 +++++
 1 file changed, 5 insertions(+)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-setpriority01-Fix-failure-on-read-only-machine.patch
Type: text/x-patch
Size: 600 bytes
Desc: not available
URL: <http://lists.linux.it/pipermail/ltp/attachments/20170409/2e4ae532/attachment.bin>

#2 lore raw

PATCH 1/1 setpriority01: Fix failure on read-only machine

Hi,

Quoted 3 lines · On 09.04.2017 11:38, [email protected] wrote:

Return 32 if /etc/passwd is read-only.
Fixes: #137
See also: #88

Applied both patches, thanks! Modified the last one a little bit:
added __GNU_SOURCE foreaccess() and renamed tst_brkm() to tst_brk() as the test converted to newer LTP API.

Thanks,
Alexey

author Applied
#3 lore raw

PATCH 1/1 setpriority01: Fix failure on read-only machine

Hi Alexey,
Thanks a lot for helping to merge patches.
Best regards,
Hoang

On Tue, Apr 11, 2017 at 16:46, Alexey Kodanev<[email protected]> wrote: Hi,

Quoted 3 lines · On 09.04.2017 11:38, [email protected] wrote:

Return 32 if /etc/passwd is read-only.
Fixes: #137
See also: #88

Applied both patches, thanks! Modified the last one a little bit:
added __GNU_SOURCE foreaccess() and renamed tst_brkm() to tst_brk() as the test converted to newer LTP API.

Thanks,
Alexey

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20170412/275cc14e/attachment-0001.html>

author Applied
#4 lore raw

PATCH 1/1 setpriority01: Fix failure on read-only machine

In reply to Alexey Kodanev

Hi Alexey
I've realized that tst_brk did not exist immediately and it makes the return value become 36, while we need 32. cleanup() does not need to run in this case.

root@mx6q:~# ./setpriority01

tst_test.c:847: INFO: Timeout per run is 0h 05m 00s

setpriority01.c:120: CONF: /etc/passwd is not accessible

userdel: user 'ltp_setpriority01' does not exist

setpriority01.c:133: WARN: 'userdel -r ltp_setpriority01' failed: ENOENT

Summary:

passed   0

failed   0

skipped  0

warnings 1

root@mx6q:~# echo $?

36

Could you please to check it again?
Thanks and regards,
Hoang

On Tue, Apr 11, 2017 at 16:46, Alexey Kodanev<[email protected]> wrote: Hi,

Quoted 3 lines · On 09.04.2017 11:38, [email protected] wrote:

Return 32 if /etc/passwd is read-only.
Fixes: #137
See also: #88

Applied both patches, thanks! Modified the last one a little bit:
added __GNU_SOURCE foreaccess() and renamed tst_brkm() to tst_brk() as the test converted to newer LTP API.

Thanks,
Alexey

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20170505/739f273c/attachment.html>

#5 lore raw

PATCH 1/1 setpriority01: check in cleanup that user was created

---

Could you try this patch?

 .../kernel/syscalls/setpriority/setpriority01.c    |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
testcases/kernel/syscalls/setpriority/setpriority01.c +5 -1
index 70e8264..df02bce 100644
@@ -31,7 +31,7 @@
 #include "tst_test.h"
 
 static const char *username = "ltp_setpriority01";
-static int pid, uid;
+static int pid, uid, user_added;
 
 static struct tcase {
 	int which;
@@ -120,6 +120,7 @@ static void setup(void)
 		tst_brk(TCONF, "/etc/passwd is not accessible");
 
 	tst_run_cmd(cmd_useradd, NULL, NULL, 0);
+	user_added = 1;
 
 	ltpuser = SAFE_GETPWNAM(username);
 	uid = ltpuser->pw_uid;
@@ -127,6 +128,9 @@ static void setup(void)
 
 static void cleanup(void)
 {
+	if (!user_added)
+		return;
+
 	const char *const cmd_userdel[] = {"userdel", "-r", username, NULL};
 
 	if (tst_run_cmd(cmd_userdel, NULL, NULL, 1))
Signature · 1 line
1.7.1
#6 lore raw

PATCH 1/1 setpriority01: check in cleanup that user was created

Hi Alexey,
Sorry I tried on a remote machine yesterday and forget to get $? value, but I guess it already worked. Could you help to push it? I'll ping you if I found any issues on Monday. Many thanks,
Hoang

root@mx6q:~# ./setpriority01

tst_test.c:847: INFO: Timeout per run is 0h 05m 00s

setpriority01.c:120: CONF: /etc/passwd is not accessible

Summary:

passed   0

failed   0

skipped  0

warnings 0
Sent from Yahoo Mail on Android

On Fri, May 5, 2017 at 17:38, Alexey Kodanev<[email protected]> wrote: Signed-off-by: Alexey Kodanev <[email protected]>
---

Could you try this patch?

 .../kernel/syscalls/setpriority/setpriority01.c    |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
testcases/kernel/syscalls/setpriority/setpriority01.c +5 -1
index 70e8264..df02bce 100644
@@ -31,7 +31,7 @@
 #include "tst_test.h"
 
 static const char *username = "ltp_setpriority01";
-static int pid, uid;
+static int pid, uid, user_added;
 
 static struct tcase {
     int which;
@@ -120,6 +120,7 @@ static void setup(void)
         tst_brk(TCONF, "/etc/passwd is not accessible");
 
     tst_run_cmd(cmd_useradd, NULL, NULL, 0);
+    user_added = 1;
 
     ltpuser = SAFE_GETPWNAM(username);
     uid = ltpuser->pw_uid;
@@ -127,6 +128,9 @@ static void setup(void)
 
 static void cleanup(void)
 {
+    if (!user_added)
+        return;
+
     const char *const cmd_userdel[] = {"userdel", "-r", username, NULL};
 
     if (tst_run_cmd(cmd_userdel, NULL, NULL, 1))
Signature · 6 lines
1.7.1

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20170506/e52a28e6/attachment-0001.html>
#7 lore raw

PATCH 1/1 setpriority01: check in cleanup that user was created

Hi again,
The return value is already 32 as expected. I think we can push the patch. Thanks and regards,
Hoang.

On Sat, May 6, 2017 at 10:14, Hoang Nguyen<[email protected]> wrote: Hi Alexey,
Sorry I tried on a remote machine yesterday and forget to get $? value, but I guess it already worked. Could you help to push it? I'll ping you if I found any issues on Monday. Many thanks,
Hoang

root@mx6q:~# ./setpriority01

tst_test.c:847: INFO: Timeout per run is 0h 05m 00s

setpriority01.c:120: CONF: /etc/passwd is not accessible

Summary:

passed   0

failed   0

skipped  0

warnings 0
Sent from Yahoo Mail on Android

On Fri, May 5, 2017 at 17:38, Alexey Kodanev<[email protected]> wrote: Signed-off-by: Alexey Kodanev <[email protected]>
---

Could you try this patch?

 .../kernel/syscalls/setpriority/setpriority01.c    |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
testcases/kernel/syscalls/setpriority/setpriority01.c +5 -1
index 70e8264..df02bce 100644
@@ -31,7 +31,7 @@
 #include "tst_test.h"
 
 static const char *username = "ltp_setpriority01";
-static int pid, uid;
+static int pid, uid, user_added;
 
 static struct tcase {
     int which;
@@ -120,6 +120,7 @@ static void setup(void)
         tst_brk(TCONF, "/etc/passwd is not accessible");
 
     tst_run_cmd(cmd_useradd, NULL, NULL, 0);
+    user_added = 1;
 
     ltpuser = SAFE_GETPWNAM(username);
     uid = ltpuser->pw_uid;
@@ -127,6 +128,9 @@ static void setup(void)
 
 static void cleanup(void)
 {
+    if (!user_added)
+        return;
+
     const char *const cmd_userdel[] = {"userdel", "-r", username, NULL};
 
     if (tst_run_cmd(cmd_userdel, NULL, NULL, 1))
Signature · 7 lines
1.7.1

  
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20170508/5991f366/attachment.html>