From patchwork Wed Aug 29 08:23:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Junchi Chen X-Patchwork-Id: 963188 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 420SXH22kqz9rvt for ; Wed, 29 Aug 2018 11:22:03 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 60C1E3E71C9 for ; Wed, 29 Aug 2018 03:22:00 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) by picard.linux.it (Postfix) with ESMTP id E65C73E607D for ; Wed, 29 Aug 2018 03:21:58 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id AA5B01000A6C for ; Wed, 29 Aug 2018 03:21:56 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Aug 2018 18:21:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,300,1531810800"; d="scan'208";a="228460146" Received: from lckqa-nuc7i5dnhe.sh.intel.com ([10.239.161.22]) by orsmga004.jf.intel.com with ESMTP; 28 Aug 2018 18:21:53 -0700 From: Junchi Chen To: ltp@lists.linux.it Date: Wed, 29 Aug 2018 16:23:20 +0800 Message-Id: <20180829082320.6903-1-junchi.chen@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=DATE_IN_FUTURE_06_12, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH v2 ltp] syscalls/munlockall02: remove deprecated test X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" ISSUE: This TCONF message: "Some distros... support non-superuser munlockall calls." has unnecessarily shown for years. REASON: The test is expecting EPERM error when calling munlockall with user nobody. However, the unprivileged calling of munlockall has been allowed at least since v2.6. Signed-off-by: Junchi Chen --- runtest/ltplite | 1 - runtest/stress.part3 | 1 - runtest/syscalls | 1 - .../kernel/syscalls/munlockall/.gitignore | 1 - .../kernel/syscalls/munlockall/munlockall02.c | 157 ------------------ 5 files changed, 161 deletions(-) delete mode 100644 testcases/kernel/syscalls/munlockall/munlockall02.c diff --git a/runtest/ltplite b/runtest/ltplite index 9ca6c421f..a3d4f54e0 100644 --- a/runtest/ltplite +++ b/runtest/ltplite @@ -510,7 +510,6 @@ munlock01 munlock01 munlock02 munlock02 munlockall01 munlockall01 -munlockall02 munlockall02 munmap01 munmap01 munmap02 munmap02 diff --git a/runtest/stress.part3 b/runtest/stress.part3 index ec18dcf73..f9eed15ed 100644 --- a/runtest/stress.part3 +++ b/runtest/stress.part3 @@ -427,7 +427,6 @@ munlock01 munlock01 munlock02 munlock02 munlockall01 munlockall01 -munlockall02 munlockall02 munmap01 munmap01 munmap02 munmap02 diff --git a/runtest/syscalls b/runtest/syscalls index ccc3eff59..eb1de2d30 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -730,7 +730,6 @@ munlock01 munlock01 munlock02 munlock02 munlockall01 munlockall01 -munlockall02 munlockall02 munmap01 munmap01 munmap02 munmap02 diff --git a/testcases/kernel/syscalls/munlockall/.gitignore b/testcases/kernel/syscalls/munlockall/.gitignore index 5fb852410..b45b4ad06 100644 --- a/testcases/kernel/syscalls/munlockall/.gitignore +++ b/testcases/kernel/syscalls/munlockall/.gitignore @@ -1,2 +1 @@ /munlockall01 -/munlockall02 diff --git a/testcases/kernel/syscalls/munlockall/munlockall02.c b/testcases/kernel/syscalls/munlockall/munlockall02.c deleted file mode 100644 index f97905473..000000000 --- a/testcases/kernel/syscalls/munlockall/munlockall02.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ -/************************************************************************** - * - * TEST IDENTIFIER : munlockall02 - * - * EXECUTED BY : root / superuser - * - * TEST TITLE : test for EPERM error value when run as non superuser - * - * TEST CASE TOTAL : 1 - * - * AUTHOR : sowmya adiga - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * DESCRIPTION - * Verify munlockall(2) returns -1 and sets errno to EPERM - * if the effective userid of the caller is not super-user. - * $ - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Change effective user id to "nobody" user - * $ - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) && - * (errno set == expected errno) - * Issue sys call pass with expected return value and errno. - * otherwise, - * Issue sys call fails with unexpected errno. - * - * - * Cleanup: - * change effective user id to root - * Print errno log and/or timing stats if options given - * - * USAGE: - * munlockall02 [-c n] [-e] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently - * -e : Turn on errno logging. - * -h : Show this help screen - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -p : Pause for SIGUSR1 before starting - * -P x : Pause for x seconds between iterations. - * t : Turn on syscall timing. - * - * - *****************************************************************************/ -#include -#include -#include -#include "test.h" -#include "safe_macros.h" - -void setup(); -void cleanup(); - -char *TCID = "munlockall02"; -int TST_TOTAL = 1; - -static char nobody_uid[] = "nobody"; -struct passwd *ltpuser; - -#if !defined(UCLINUX) - -int main(int ac, char **av) -{ - int lc; - - tst_parse_opts(ac, av, NULL, NULL); - - setup(); - - /* check looping state */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - tst_count = 0; - - TEST(munlockall()); - /* check return code */ - if ((TEST_RETURN == -1) && (TEST_ERRNO == EPERM)) { - tst_resm(TPASS, "munlockall() failed" - " as expected for non-superuser" ":GOT EPERM"); - } else { - tst_resm(TCONF, "munlockall() failed to produce " - "expected errno :%d Got : %d, %s. ***Some distros, such as Red Hat Enterprise Linux, support non-superuser munlockall calls.***", - EPERM, TEST_ERRNO, strerror(TEST_ERRNO)); - - } - } - - /* cleanup and exit */ - cleanup(); - tst_exit(); - -} - -/* setup() - performs all ONE TIME setup for this test. */ -void setup(void) -{ - tst_require_root(); - - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* switch to nobody user */ - if ((ltpuser = getpwnam(nobody_uid)) == NULL) { - tst_brkm(TBROK, NULL, "\"nobody\"user not present"); - } - - SAFE_SETEUID(NULL, ltpuser->pw_uid); - - TEST_PAUSE; -} - -#else - -int main(void) -{ - tst_resm(TINFO, "test is not available on uClinux"); - tst_exit(); -} - -#endif /* if !defined(UCLINUX) */ - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void cleanup(void) -{ - if (seteuid(0) == -1) { - tst_resm(TWARN, "seteuid failed to " - "to set the effective uid to root"); - perror("setuid"); - } - -}