From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Garrett Cooper <yanegomi@gmail.com>
Cc: Linus Test Project <ltp-list@lists.sourceforge.net>,
Sachin P Sant <ssant@in.ibm.com>,
Sharyathi Nagesh <sharyath@in.ibm.com>,
"SUZUKI K. POULOSE" <suzuki@in.ibm.com>,
B N Poornima <bnpoorni@in.ibm.com>
Subject: Re: [LTP] [04/12 FAILURE] LTP? sysctl03 test fails
Date: Thu, 6 May 2010 08:53:12 -0500 [thread overview]
Message-ID: <20100506135312.GA12072@us.ibm.com> (raw)
In-Reply-To: <0B5AF9FC-8DAA-4995-9166-8EB0FE42F98C@gmail.com>
Quoting Garrett Cooper (yanegomi@gmail.com):
> On May 5, 2010, at 11:56 PM, Subrata Modak wrote:
>
> > Subject: LTPś sysctl03 test fails
> >
> > Issues Description Below:
> > =====================================
> > # ./runltp -s sysctl03
> > <<<test_output>>>
> > sysctl03 1 TFAIL : Expected EPERM (1), got 13: Permission denied
> > sysctl03 2 TFAIL : Expected EPERM, got 13
> > sysctl03 1 TFAIL : Expected EPERM (1), got 13: Permission denied
> > <<<execution_status>>>
> > initiation_status="ok"
> > duration=0 termination_type=exited termination_id=1 corefile=no
> > cutime=0 cstime=0
> > <<<test_end>>>
>
> Already known and recently discussed.
Not only can things move glacially in kernel-land, but decisions not
yet implemented can be changed.
In the meantime, the sysctl's sit there as a potential subject for
exploitation.
So not meaning to be argumentative for its own sake, I nevertheless
think it's better to fix the test than either to ignore or remove
it. Two untested patches below - the one just replaces EPERM with
EACCESS. The other removes the (imo misuided) notion that we can
guess at the failing errno. An LSM could choose to return -EPERM
after all, or perhaps even something different. The thing that
should scare us is if the call succeeds. If we give any false
positives, then true positives will seem less scary.
-serge
From 2cf7797329275126cc3f80a24bfb8bb2e3f44747 Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <serue@us.ibm.com>
Date: Thu, 6 May 2010 08:30:52 -0500
Subject: [PATCH 1/1] sysctl: check for EACCES
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
---
testcases/kernel/syscalls/sysctl/sysctl03.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/testcases/kernel/syscalls/sysctl/sysctl03.c b/testcases/kernel/syscalls/sysctl/sysctl03.c
index f8e743b..e4477f7 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl03.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl03.c
@@ -22,15 +22,15 @@
* sysctl03.c
*
* DESCRIPTION
- * Testcase to check that sysctl(2) sets errno to EPERM correctly.
+ * Testcase to check that sysctl(2) sets errno to EACCES correctly.
*
* ALGORITHM
* a. Call sysctl(2) as a root user, and attempt to write data
* to the kernel_table[]. Since the table does not have write
- * permissions even for the root, it should fail EPERM.
+ * permissions even for the root, it should fail EACCES.
* b. Call sysctl(2) as a non-root user, and attempt to write data
* to the kernel_table[]. Since the table does not have write
- * permission for the regular user, it should fail with EPERM.
+ * permission for the regular user, it should fail with EACCES.
*
* USAGE: <for command-line>
* sysctl03 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
@@ -76,7 +76,7 @@ int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
void setup(void);
void cleanup(void);
-int exp_enos[] = { EPERM, 0 };
+int exp_enos[] = { EACCES, 0 };
int main(int ac, char **av)
{
@@ -114,13 +114,13 @@ int main(int ac, char **av)
} else {
TEST_ERROR_LOG(TEST_ERRNO);
- if (TEST_ERRNO != EPERM) {
+ if (TEST_ERRNO != EACCES) {
tst_resm(TFAIL,
- "Expected EPERM (%d), got %d: %s",
- EPERM, TEST_ERRNO,
+ "Expected EACCES (%d), got %d: %s",
+ EACCES, TEST_ERRNO,
strerror(TEST_ERRNO));
} else {
- tst_resm(TPASS, "Got expected EPERM error");
+ tst_resm(TPASS, "Got expected EACCES error");
}
}
@@ -147,11 +147,11 @@ int main(int ac, char **av)
} else {
TEST_ERROR_LOG(TEST_ERRNO);
- if (TEST_ERRNO != EPERM) {
- tst_resm(TFAIL, "Expected EPERM, got "
+ if (TEST_ERRNO != EACCES) {
+ tst_resm(TFAIL, "Expected EACCES, got "
"%d", TEST_ERRNO);
} else {
- tst_resm(TPASS, "Got expected EPERM "
+ tst_resm(TPASS, "Got expected EACCES "
"error");
}
}
--
1.6.3.3
From c290aeda205afc764f25515b0eaaf9ae05fe3365 Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <serue@us.ibm.com>
Date: Thu, 6 May 2010 08:51:00 -0500
Subject: [PATCH 1/1] accept any sysctl failure
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
---
testcases/kernel/syscalls/sysctl/sysctl03.c | 28 +++++---------------------
1 files changed, 6 insertions(+), 22 deletions(-)
diff --git a/testcases/kernel/syscalls/sysctl/sysctl03.c b/testcases/kernel/syscalls/sysctl/sysctl03.c
index f8e743b..fcd8635 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl03.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl03.c
@@ -22,15 +22,15 @@
* sysctl03.c
*
* DESCRIPTION
- * Testcase to check that sysctl(2) sets errno to EPERM correctly.
+ * Testcase to check that sysctl(2) fail correctly.
*
* ALGORITHM
* a. Call sysctl(2) as a root user, and attempt to write data
* to the kernel_table[]. Since the table does not have write
- * permissions even for the root, it should fail EPERM.
+ * permissions even for the root, it should fail.
* b. Call sysctl(2) as a non-root user, and attempt to write data
* to the kernel_table[]. Since the table does not have write
- * permission for the regular user, it should fail with EPERM.
+ * permission for the regular user, it should fail.
*
* USAGE: <for command-line>
* sysctl03 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
@@ -76,7 +76,7 @@ int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
void setup(void);
void cleanup(void);
-int exp_enos[] = { EPERM, 0 };
+int exp_enos[] = { EPERM, EACCES, 0 };
int main(int ac, char **av)
{
@@ -113,15 +113,7 @@ int main(int ac, char **av)
tst_resm(TFAIL, "sysctl(2) succeeded unexpectedly");
} else {
TEST_ERROR_LOG(TEST_ERRNO);
-
- if (TEST_ERRNO != EPERM) {
- tst_resm(TFAIL,
- "Expected EPERM (%d), got %d: %s",
- EPERM, TEST_ERRNO,
- strerror(TEST_ERRNO));
- } else {
- tst_resm(TPASS, "Got expected EPERM error");
- }
+ tst_resm(TPASS, "sysctl(2) failed as expected.");
}
osnamelth = SIZE(osname);
@@ -145,15 +137,7 @@ int main(int ac, char **av)
if (TEST_RETURN != -1) {
tst_resm(TFAIL, "call succeeded unexpectedly");
} else {
- TEST_ERROR_LOG(TEST_ERRNO);
-
- if (TEST_ERRNO != EPERM) {
- tst_resm(TFAIL, "Expected EPERM, got "
- "%d", TEST_ERRNO);
- } else {
- tst_resm(TPASS, "Got expected EPERM "
- "error");
- }
+ tst_resm(TPASS, "sysctl failed as expected");
}
cleanup();
--
1.6.3.3
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2010-05-06 13:53 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-06 6:55 [LTP] [00/12 FAILURE] Reporting LTP run issues on Fedora 13 ppc6 Subrata Modak
2010-05-06 6:56 ` [01/12 FAILURE] LTPX Memory CGROUP test creates Call Trace and Badness at mm/oom_kill.c:393 Subrata Modak
2010-05-06 6:56 ` [02/12 FAILURE] LTPX File Capabilities tests becomes defunct and does not complete beyond 12 hours Subrata Modak
2010-05-06 6:56 ` [03/12 FAILURE] LTPX Memory Conroller test fails and hangs system for more than " Subrata Modak
2010-05-06 6:56 ` [04/12 FAILURE] LTPX sysctl03 test fails Subrata Modak
2010-05-06 8:05 ` [LTP] [04/12 FAILURE] LTP? " Garrett Cooper
2010-05-06 13:53 ` Serge E. Hallyn [this message]
2010-05-06 17:38 ` Garrett Cooper
2010-05-06 17:55 ` Serge E. Hallyn
2010-05-06 17:59 ` Garrett Cooper
2010-05-06 18:39 ` Serge E. Hallyn
2010-05-07 9:05 ` Subrata Modak
2010-05-07 9:22 ` Garrett Cooper
2010-05-06 6:57 ` [05/12 FAILURE] LTPX proc01 " Subrata Modak
2010-05-06 8:04 ` [LTP] [05/12 FAILURE] LTP? " Garrett Cooper
2010-07-27 17:37 ` Subrata Modak
2010-07-27 17:38 ` Subrata Modak
2010-05-06 6:57 ` [LTP] [06/12 FAILURE] Many CONTAINER tests of LTP fail Subrata Modak
2010-05-06 17:53 ` Garrett Cooper
2010-05-06 17:59 ` Dan Smith
2010-07-27 17:40 ` Subrata Modak
2010-05-06 6:57 ` [07/12 FAILURE] LTPX MEMORY CGROUP FUNCTION tests fails Subrata Modak
2010-07-28 17:34 ` [LTP] [07/12 FAILURE] LTPE " Subrata Modak
2010-05-06 6:58 ` [08/12 FAILURE] LTPX clock gettime03 fails Subrata Modak
2010-05-06 7:04 ` [LTP] [08/12 FAILURE] LTPE " Suzuki Poulose
2010-05-06 7:55 ` Garrett Cooper
2010-05-06 9:03 ` Suzuki Poulose
2010-05-06 17:42 ` Garrett Cooper
2010-05-07 8:53 ` Subrata Modak
2010-06-01 15:40 ` Suzuki Poulose
2010-06-02 12:57 ` Subrata Modak
2010-07-27 18:03 ` Subrata Modak
2010-05-06 6:58 ` [09/12 FAILURE] LTPX timer create04 fails Subrata Modak
2010-05-07 2:12 ` [LTP] [09/12 FAILURE] LTP " Henry xu
2010-07-28 12:46 ` [LTP] [09/12 FAILURE] LTPE " Subrata Modak
2010-05-06 6:58 ` [10/12 FAILURE] LTPX ar01 fails Subrata Modak
2010-05-06 6:58 ` [11/12 FAILURE] LTPX file test fails Subrata Modak
2010-05-06 8:01 ` [LTP] [11/12 FAILURE] LTP? " Garrett Cooper
2010-05-06 6:59 ` [12/12 FAILURE] LTPX cron tests fails 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=20100506135312.GA12072@us.ibm.com \
--to=serue@us.ibm.com \
--cc=bnpoorni@in.ibm.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=sharyath@in.ibm.com \
--cc=ssant@in.ibm.com \
--cc=suzuki@in.ibm.com \
--cc=yanegomi@gmail.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