From patchwork Wed Nov 21 17:20:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 1001266 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=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="l0Dx4U5x"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 430Tr42KKgz9s4s for ; Thu, 22 Nov 2018 04:21:07 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 2BD5A3E6FE2 for ; Wed, 21 Nov 2018 18:21:05 +0100 (CET) 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 06ADB3E6F8E for ; Wed, 21 Nov 2018 18:21:04 +0100 (CET) Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 9CE7A1A010FE for ; Wed, 21 Nov 2018 18:21:03 +0100 (CET) Received: by mail-wm1-x341.google.com with SMTP id w7-v6so6309319wmc.1 for ; Wed, 21 Nov 2018 09:21:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=t0pnjmPAVexdD26a6cjQ2wknFdCltp6527f34xfShfs=; b=l0Dx4U5xmKO74HAxpHdk+NeE6roMlvjnjSQW+Xhg4AqOL61zM8DsT00G/bs2gMXM/q rd5oKL7WRafCZ9XS4rAsPUrOgpofuuarDKpi3xEDTaISkUaI3eOEDFurm5+ARS3i87m5 Ew/THYAsGikuqJh7vaQ9GPIIiiTcomPS9iqUq/4rWgpvQxtFRPY0Bm91M9Oc4CecKrXd 8ijkWE1xn5O8JL4CU+EvQCt7y1oebMxKEg4DewSLqc/+gSrIVHlAyTtWEWS0TLTfW3fJ LQdaVJ1D62v1eaHftGtHT7fau4XHwR8jAO7Pe0PeszBgOzLcNLeGdHn09B+jSyfc3Kmo Dpcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=t0pnjmPAVexdD26a6cjQ2wknFdCltp6527f34xfShfs=; b=kYV5UgxraWs5P0LBjTuAsz/Ijqfy1eAZ8VcWn8tnPTrEVX8U88/G6+UgCeUpFVed3X WrBzoBndkAssHni9now282jsPXWrXp0WfUnsf+132f/1A43sZm7XZd4j/03mDaXIHKkz SbD4Yieb9DJaBdo8TxNuTwBPLcbOjR8xhoO9xGEv51tlAcpcCCRen1NxiLzHQhnuDa/Y awQjllFI0pMghwCDeq4zEjKC7l0iol49b7ZvkkOfYp8x0FqfvKXGQJHWnqtXhT/LUC1o 3pPF6heAj2655cDwSuaMXhRFGMdWMI6Qh9LiwpIraRedKeEVxsUp8wyUnTXzrRdB3G4b tTVQ== X-Gm-Message-State: AGRZ1gKcenRJ326SxAplxY7SbdVERwcykRHwurmzG0eklBwMZVcBeUOr bcEKqEx0INE3/5RkYnLwIiw= X-Google-Smtp-Source: AFSGD/XnpZrAiU0qitxYwyWX7W4p758rWIxEoXI0FvpOw+KkbP+FCaUFBCTXxgdVPARtjU2ljEpiZQ== X-Received: by 2002:a1c:3e84:: with SMTP id l126-v6mr6504949wma.57.1542820862986; Wed, 21 Nov 2018 09:21:02 -0800 (PST) Received: from localhost.localdomain ([37.46.46.74]) by smtp.gmail.com with ESMTPSA id j199sm2690621wmf.13.2018.11.21.09.21.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Nov 2018 09:21:02 -0800 (PST) From: Amir Goldstein To: Cyril Hrubis Date: Wed, 21 Nov 2018 19:20:55 +0200 Message-Id: <20181121172055.13825-1-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: clamav-milter 0.99.2 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, 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 Cc: Jan Kara , ltp@lists.linux.it Subject: [LTP] [PATCH v2] syscalls/fanotify03: add test for FAN_MARK_FILESYSTEM permission events 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: Amir Goldstein --- Changes from v1: - Remove support_perm_events logic testcases/kernel/syscalls/fanotify/fanotify03.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/testcases/kernel/syscalls/fanotify/fanotify03.c b/testcases/kernel/syscalls/fanotify/fanotify03.c index 19daf57ef..4991e1274 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify03.c +++ b/testcases/kernel/syscalls/fanotify/fanotify03.c @@ -59,6 +59,10 @@ static struct tcase { "mount mark permission events", INIT_FANOTIFY_MARK_TYPE(MOUNT), }, + { + "filesystem mark permission events", + INIT_FANOTIFY_MARK_TYPE(FILESYSTEM), + }, }; static void generate_events(void) @@ -134,7 +138,7 @@ static void check_child(void) tst_res(TFAIL, "child %s", tst_strstatus(child_ret)); } -static void setup_mark(unsigned int n) +static int setup_mark(unsigned int n) { struct tcase *tc = &tcases[n]; struct fanotify_mark_type *mark = &tc->mark; @@ -144,7 +148,11 @@ static void setup_mark(unsigned int n) if (fanotify_mark(fd_notify, FAN_MARK_ADD | mark->flag, FAN_ACCESS_PERM | FAN_OPEN_PERM, AT_FDCWD, fname) < 0) { - if (errno == EINVAL) { + if (errno == EINVAL && mark->flag == FAN_MARK_FILESYSTEM) { + tst_res(TCONF, + "FAN_MARK_FILESYSTEM not supported in kernel?"); + return -1; + } else if (errno == EINVAL) { tst_brk(TCONF | TERRNO, "CONFIG_FANOTIFY_ACCESS_PERMISSIONS not " "configured in kernel?"); @@ -158,6 +166,7 @@ static void setup_mark(unsigned int n) } tst_res(TINFO, "Test #%d: %s", n, tc->tname); + return 0; } static void test_fanotify(unsigned int n) @@ -165,7 +174,9 @@ static void test_fanotify(unsigned int n) int tst_count; int ret, len = 0, i = 0, test_num = 0; - setup_mark(n); + if (setup_mark(n) != 0) + return; + run_child(); tst_count = 0;