From patchwork Mon May 14 09:26:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Wang X-Patchwork-Id: 912793 X-Patchwork-Delegate: petr.vorel@gmail.com 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=213.254.12.146; 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=redhat.com Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40kwLx69xHz9ryk for ; Mon, 14 May 2018 19:26:49 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 320BD3E75D0 for ; Mon, 14 May 2018 11:26:47 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) by picard.linux.it (Postfix) with ESMTP id 064183E602A for ; Mon, 14 May 2018 11:26:45 +0200 (CEST) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 58FE31A01179 for ; Mon, 14 May 2018 11:26:42 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ABAAF8D68B for ; Mon, 14 May 2018 09:26:40 +0000 (UTC) Received: from dhcp-12-102.nay.redhat.com (unknown [10.66.12.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id C802D1102E30 for ; Mon, 14 May 2018 09:26:39 +0000 (UTC) From: Li Wang To: ltp@lists.linux.it Date: Mon, 14 May 2018 17:26:34 +0800 Message-Id: <20180514092635.26100-1-liwang@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 14 May 2018 09:26:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 14 May 2018 09:26:40 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'liwang@redhat.com' RCPT:'' X-Virus-Scanned: clamav-milter 0.99.2 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-3.smtp.seeweb.it Subject: [LTP] [PATCH 1/2] madvise: add MADV_WIPEONFORK/MADV_KEEPONFORK in madvise() 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: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" The kernel commit (d2cd9ed mm,fork: introduce MADV_WIPEONFORK) introduces two new advices for madvise() in kernel-v4.14. Here making LTP cover that test accordingly. Signed-off-by: Li Wang --- include/lapi/mmap.h | 5 +++++ testcases/kernel/syscalls/madvise/madvise01.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/include/lapi/mmap.h b/include/lapi/mmap.h index 7a55800..18547c0 100644 --- a/include/lapi/mmap.h +++ b/include/lapi/mmap.h @@ -71,6 +71,11 @@ # define MADV_FREE 8 #endif +#ifndef MADV_WIPEONFORK +# define MADV_WIPEONFORK 18 +# define MADV_KEEPONFORK 19 +#endif + #ifdef HAVE_SYS_SHM_H # include # define MMAP_GRANULARITY SHMLBA diff --git a/testcases/kernel/syscalls/madvise/madvise01.c b/testcases/kernel/syscalls/madvise/madvise01.c index 4b18a21..8d1d787 100644 --- a/testcases/kernel/syscalls/madvise/madvise01.c +++ b/testcases/kernel/syscalls/madvise/madvise01.c @@ -62,6 +62,9 @@ static struct tcase { {MADV_DONTDUMP, "MADV_DONTDUMP", &sfile}, /* since Linux 3.4 */ {MADV_DODUMP, "MADV_DODUMP", &sfile}, /* since Linux 3.4 */ {MADV_FREE, "MADV_FREE", &amem}, /* since Linux 4.5 */ + {MADV_WIPEONFORK, "MADV_WIPEONFORK", &amem}, /* since Linux 4.14 */ + {MADV_KEEPONFORK, "MADV_KEEPONFORK", &amem}, /* since Linux 4.14 */ + }; static void setup(void) From patchwork Mon May 14 09:26:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Wang X-Patchwork-Id: 912794 X-Patchwork-Delegate: petr.vorel@gmail.com 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=213.254.12.146; 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=redhat.com Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40kwMK3xRRz9ryk for ; Mon, 14 May 2018 19:27:09 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id F3B9D3E75D0 for ; Mon, 14 May 2018 11:27:05 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) by picard.linux.it (Postfix) with ESMTP id B9C953E602C for ; Mon, 14 May 2018 11:27:04 +0200 (CEST) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 5E4D8601623 for ; Mon, 14 May 2018 11:26:43 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 24EBE818A6A8 for ; Mon, 14 May 2018 09:26:42 +0000 (UTC) Received: from dhcp-12-102.nay.redhat.com (unknown [10.66.12.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 412091102E30 for ; Mon, 14 May 2018 09:26:40 +0000 (UTC) From: Li Wang To: ltp@lists.linux.it Date: Mon, 14 May 2018 17:26:35 +0800 Message-Id: <20180514092635.26100-2-liwang@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 14 May 2018 09:26:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 14 May 2018 09:26:42 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'liwang@redhat.com' RCPT:'' X-Virus-Scanned: clamav-milter 0.99.2 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH 2/2] madvise: add ERRORS check for MADV_REMOVE/MADV_FREE/MADV_WIPEONFORK 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: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Li Wang --- testcases/kernel/syscalls/madvise/madvise02.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/testcases/kernel/syscalls/madvise/madvise02.c b/testcases/kernel/syscalls/madvise/madvise02.c index b773efd..af52741 100644 --- a/testcases/kernel/syscalls/madvise/madvise02.c +++ b/testcases/kernel/syscalls/madvise/madvise02.c @@ -72,12 +72,15 @@ static struct tcase { } tcases[] = { {MADV_NORMAL, "MADV_NORMAL", &nonalign, EINVAL, 0}, {1212, "MADV_NORMAL", &file1, EINVAL, 0}, + {MADV_REMOVE, "MADV_REMOVE", &file1, EINVAL, 0}, {MADV_DONTNEED, "MADV_DONTNEED", &file1, EINVAL, 1}, {MADV_MERGEABLE, "MADV_MERGEABLE", &file1, EINVAL, 0}, {MADV_UNMERGEABLE, "MADV_UNMERGEABLE", &file1, EINVAL, 0}, {MADV_NORMAL, "MADV_NORMAL", &file2, ENOMEM, 0}, {MADV_WILLNEED, "MADV_WILLNEED", &file2, ENOMEM, 0}, {MADV_WILLNEED, "MADV_WILLNEED", &tmp_addr, EBADF, 0}, + {MADV_FREE, "MADV_FREE", &file1, EINVAL, 0}, + {MADV_WIPEONFORK, "MADV_WIPEONFORK", &file1, EINVAL, 0}, }; static void tcases_filter(void) @@ -95,7 +98,10 @@ static void tcases_filter(void) tc->skip = 0; #endif /* if !defined(UCLINUX) */ break; - + case MADV_REMOVE: + if ((tst_kvercmp(2, 6, 16)) < 0) + tc->skip = 1; + break; case MADV_MERGEABLE: case MADV_UNMERGEABLE: if ((tst_kvercmp(2, 6, 32)) < 0) @@ -114,6 +120,14 @@ static void tcases_filter(void) tc->exp_errno == EBADF) tc->skip = 1; break; + case MADV_FREE: + if ((tst_kvercmp(4, 5, 0)) < 0) + tc->skip = 1; + break; + case MADV_WIPEONFORK: + if ((tst_kvercmp(4, 14, 0)) < 0) + tc->skip = 1; + break; default: break; }