lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20220120174717.26158-1-sj@kernel.org>
Date:   Thu, 20 Jan 2022 17:47:16 +0000
From:   SeongJae Park <sj@...nel.org>
To:     Xin Hao <xhao@...ux.alibaba.com>
Cc:     sj@...nel.org, akpm@...ux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH V1 1/2] mm/damon/dbgfs: Put "paddr" check into damon_pa_check() func

Hi Xin,

On Fri, 21 Jan 2022 00:04:27 +0800 Xin Hao <xhao@...ux.alibaba.com> wrote:

> The purpose of putting "paddr" check into damon_pa_check() func
> is to better solve "DAMON_DBGFS" dependency on both "DAMON_VADDR"
> and "DAMON_PADDR".

Syntax of "paddr" is dbgfs's own.  I don't think handling it in paddr is a
right thing to do.


Thanks,
SJ

> 
> Signed-off-by: Xin Hao <xhao@...ux.alibaba.com>
> ---
>  include/linux/damon.h | 1 +
>  mm/damon/dbgfs.c      | 2 +-
>  mm/damon/paddr.c      | 8 ++++++++
>  3 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/damon.h b/include/linux/damon.h
> index 5e1e3a128b77..794b5f453662 100644
> --- a/include/linux/damon.h
> +++ b/include/linux/damon.h
> @@ -504,6 +504,7 @@ void damon_va_set_primitives(struct damon_ctx *ctx);
>  #endif	/* CONFIG_DAMON_VADDR */
> 
>  #ifdef CONFIG_DAMON_PADDR
> +bool damon_pa_check(char *buf, size_t count);
>  bool damon_pa_target_valid(void *t);
>  void damon_pa_set_primitives(struct damon_ctx *ctx);
>  #endif	/* CONFIG_DAMON_PADDR */
> diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c
> index 5b899601e56c..cdb9c1e2ab29 100644
> --- a/mm/damon/dbgfs.c
> +++ b/mm/damon/dbgfs.c
> @@ -374,7 +374,7 @@ static ssize_t dbgfs_target_ids_write(struct file *file,
>  	if (IS_ERR(kbuf))
>  		return PTR_ERR(kbuf);
> 
> -	if (!strncmp(kbuf, "paddr\n", count)) {
> +	if (damon_pa_check(kbuf, count)) {
>  		id_is_pid = false;
>  		/* target id is meaningless here, but we set it just for fun */
>  		scnprintf(kbuf, count, "42    ");
> diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
> index 5e8244f65a1a..14a6bf2a2adb 100644
> --- a/mm/damon/paddr.c
> +++ b/mm/damon/paddr.c
> @@ -208,6 +208,14 @@ static unsigned int damon_pa_check_accesses(struct damon_ctx *ctx)
>  	return max_nr_accesses;
>  }
> 
> +bool damon_pa_check(char *buf, size_t count)
> +{
> +	if (!strncmp(buf, "paddr\n", count))
> +		return true;
> +
> +	return false;
> +}
> +
>  bool damon_pa_target_valid(void *t)
>  {
>  	return true;
> --
> 2.27.0
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ