From patchwork Tue Sep 18 10:44:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10604079 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B4292112B for ; Tue, 18 Sep 2018 10:45:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A41AD29A8A for ; Tue, 18 Sep 2018 10:45:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9838E29F5B; Tue, 18 Sep 2018 10:45:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4300029A8A for ; Tue, 18 Sep 2018 10:45:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727161AbeIRQRE (ORCPT ); Tue, 18 Sep 2018 12:17:04 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33290 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728842AbeIRQRE (ORCPT ); Tue, 18 Sep 2018 12:17:04 -0400 Received: by mail-wr1-f65.google.com with SMTP id v90-v6so1568757wrc.0 for ; Tue, 18 Sep 2018 03:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=fHEMApzH614419zgu2dZ4qvhEeBGec8Qk4bWF7JgbCw=; b=AEGGetD16QEsQe6g3bHsvKeZkDCLhKWzzQzvt1+MsFcJADQc/0jdZYPWqO2zgUtirF EB+hfcPy9tgkNKS64KhNAcwfOdtzCpPyBv4rJ0y20c/JU+ZwFXWoQLkIdpYwavnf5gwV v5Yfrpdi26T8s7R2z4TXl2Hh+R7WKGLmvrauqZHXOCn5U7rUaZYf+7yzOOvH2+4LMas3 6FFdC3GNU4JOAauUr6hW4duYsPOTDq0WbAsQbZd5lc9Cts1VRUIhBd8fyrhCgVFxIQDk WKzzOBFCL2TbsNBEqhGD7h/iCVlNbTtZlNZ1PAB2lskXUjU6UCcj9c+1AdAJ8AIGkcO8 37Gw== 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=fHEMApzH614419zgu2dZ4qvhEeBGec8Qk4bWF7JgbCw=; b=s0rckk6/Gg0qIXOr1UqAHh6TEAanYrTXsFjBNAIbPxjkuDXtyDhxyDx9CmEvmqSdj+ XW/1RI1BxZYJjJa1uyiBA47QM/e3FpU/brSO4hgCFPzDUtrMilDqC+yZAvMMjaGJcR1t v3skTtG3wU0L4bXj7733cw4hoYijJUEzVqmFYxo0gRxL5zKBRqhLqFzasJJLjDPxwUW0 SGgDje0rWFSoh+8ubZfLtDGymGSiT32dKzMX2FMo0br07ycM3Ni8bRhDnkaDXWDG2RQs R94BeWaFhFUAU7hto1B9TZrq12jJWMi8RhS2kbsiB/gI/NLI0DDKWQxY8v8nX4GJlyfV UE6g== X-Gm-Message-State: APzg51BUKp0IJVUJQAoDicwTGtEOTLbAh6mvL9PWK4zTHRS2p+C2/3HT R276sQwVNOjiFwtyBYEfnj1Ogmzc X-Google-Smtp-Source: ANB0Vdb3PDiBcDWpcDQBwLS8BrfCJJ0Z2IcgC3QwWHrFNAjqiYZFcKSIJLNBCYNQTVGERIT93iI9Dg== X-Received: by 2002:a5d:4089:: with SMTP id o9-v6mr23304714wrp.133.1537267501983; Tue, 18 Sep 2018 03:45:01 -0700 (PDT) Received: from localhost.localdomain ([141.226.14.107]) by smtp.gmail.com with ESMTPSA id z11-v6sm19747767wrm.94.2018.09.18.03.45.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Sep 2018 03:45:01 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: fstests@vger.kernel.org Subject: [PATCH][BROKEN] common/rc: fix check for disabled kmemleak Date: Tue, 18 Sep 2018 13:44:56 +0300 Message-Id: <20180918104456.12778-1-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With kernel commit b353756b2b71 ("kmemleak: always register debugfs file") that was merged to v4.19-rc3, the kmemleak debugfs knob exists even if kmemleak is disabled, but returns EBUSY on write. Suppress EBUSY errors from _check_kmemleak() by removing write permission from knob on failure to initialize kmemleak. Signed-off-by: Amir Goldstein Reviewed-by: Darrick J. Wong --- Guys, With kernel v4.19-rc3, tests started printing noisy messages about failure to write to kmemleak knob. Problem is that kmemleak was disabled on my system but the test for kmemleak enabled we have in place was broken by the kernel change. I tried this patch to hack around the new kernel behavior, but something is broken in this patch as it doesn't suppress all errors. For me, I prefer to have kmemleak enabled anyway, so I gave up on this hack and enabled kmemleak. If someone is interested in taking over, be my guest. FYI, to enable kmemleak on kvm-xfstests I needed to configure CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=5000 # CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF is not set Thanks, Amir. common/rc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/rc b/common/rc index ec631ad9..cafc83b4 100644 --- a/common/rc +++ b/common/rc @@ -3514,8 +3514,14 @@ _init_kmemleak() # Disable the automatic scan so that we can control it completely, # then dump all the leaks recorded so far. - echo "scan=off" > "$kern_knob" - _capture_kmemleak /dev/null + if echo "scan=off" > "$kern_knob" 2>/dev/null; then + _capture_kmemleak /dev/null + else + # Since kernel v4.19-rc3, the knob exists even if kmemleak is + # disabled, but returns EBUSY on write. Suppress EBUSY errors + # from _check_kmemleak() by removing write permission from knob + chmod a-w "$kern_knob" + fi } # check kmemleak log