From patchwork Mon Nov 14 18:29:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13042672 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 643B3C433FE for ; Mon, 14 Nov 2022 18:30:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 819596B0089; Mon, 14 Nov 2022 13:30:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7CA6F6B008A; Mon, 14 Nov 2022 13:30:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B8E96B008C; Mon, 14 Nov 2022 13:30:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5B8A66B0089 for ; Mon, 14 Nov 2022 13:30:06 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0896B14078A for ; Mon, 14 Nov 2022 18:30:06 +0000 (UTC) X-FDA: 80132887212.20.ECEA11E Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf05.hostedemail.com (Postfix) with ESMTP id 914DE100006 for ; Mon, 14 Nov 2022 18:30:05 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 911C1B810A9; Mon, 14 Nov 2022 18:30:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF8E6C433D6; Mon, 14 Nov 2022 18:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668450602; bh=DesiBTr9/Y2bxjKJkvSh2dQ7pBkdgYYbKWbCI7mjFjE=; h=From:To:Cc:Subject:Date:From; b=HBjvbAZYHVUrRyTg8VgWolacoYa1pyz4rOK6nKuR7KJhJDYa8wxpgLfxgg9j6/KCx pAQHYnLRoWf5fsqCG5KUMQs5TIcuzOE9TXGQERfKzOS/baUlJiOonoINM3hoGv6AXr NyfLtm+bG+K46sg7tlymX21vcwYM9+v18xD+tSDD8Pxermc1DLVNRb0Nkd8P+1YJtL viqBojQWypYg9sSqjiOmkqaIfUK1BRcez26ZQ+4Cbx2228VS2/b32Bvof0OdrH2Dda B4bIWJ/E3QgrTD77kSKZnTMtrijziJ3Z93f5/s4BqzwExg3sZVB7SY4LDa9mcdrgXi r0vRePOl5LpwQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH mm-unstable 0/2] mm/damon/sysfs-schemes: avoid updating Date: Mon, 14 Nov 2022 18:29:52 +0000 Message-Id: <20221114182954.4745-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668450605; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=2CBDuqI4UrXnEmA5+G6IidJnvjy0Jr7vA+CPz6togcY=; b=O1zx0I3AyU3JEEzbbzxw40EdIrsxUl9jPSzb/0ox+LAL46eE28quka2CB0SsKoJirzBeqn cZoGYBgi0K/xypBoNW78+jwjfT9GYtStWDrvYn98Dk/sFZHST9fRnC2sRtdSAduJ57I0HF YV7cCeA8i2AmVza2xMY3WAqi4LFAqEw= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HBjvbAZY; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf05.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668450605; a=rsa-sha256; cv=none; b=Yv+BzDRqO/FMAsOyLxjIhNyA8TGQRzaY7NN4WIN6fA2eKZSp308G61Tig4Sb9acCYqju7h XK6b7Zh5CAPdGhBXqVcDq/vRYlgttRQ8hkBn+EYVj8UwGaOL/Y9CqP4D5he1mOGi/oA+03 PJVh2FF4uwhE9PoDYkYbl2HEIGi9JRk= X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 914DE100006 X-Rspam-User: Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HBjvbAZY; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf05.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org X-Stat-Signature: fm7mmapfa7mpp8ege6becg6err5gay8o X-HE-Tag: 1668450605-912767 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: A DAMON sysfs interface user can start DAMON with a scheme, remove the sysfs directory for the scheme, and then ask clears/updates of the scheme's tried regions. Because the schemes tried regions clear/update logic doesn't aware of the situation, it results in an invalid memory access. Fix the bugs by checking if the scheme sysfs directory exists. This patchset is fixing commits in mm-unstable. Andrew, please meld the first patch into "mm/damon/sysfs: implement DAMOS tried regions update command"[1], and the second patch into "mm/damon/sysfs-schemes: implement DAMOS-tried regions clear command"[2]. [1] https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-sysfs-implement-damos-tried-regions-update-command.patch [2] https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-sysfs-schemes-implement-damos-tried-regions-clear-command.patch SeongJae Park (2): mm/damon/sysfs-schemes: skip tried regions update if the scheme directory has removed mm/damon/sysfs-schemes: skip schemes regions clearing if the scheme directory has removed mm/damon/sysfs-schemes.c | 9 +++++++++ 1 file changed, 9 insertions(+)