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: <20230712083727.405920c4@gandalf.local.home>
Date:   Wed, 12 Jul 2023 08:37:27 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Zheng Yejian <zhengyejian1@...wei.com>
Cc:     <linux-kernel@...r.kernel.org>,
        <linux-trace-kernel@...r.kernel.org>, <mhiramat@...nel.org>
Subject: Re: [PATCH v5] ftrace: Fix possible warning on checking all pages
 used in ftrace_process_locs()

On Wed, 12 Jul 2023 14:04:52 +0800
Zheng Yejian <zhengyejian1@...wei.com> wrote:

> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -3305,6 +3305,22 @@ static int ftrace_allocate_records(struct ftrace_page *pg, int count)
>  	return cnt;
>  }
>  
> +static void ftrace_free_pages(struct ftrace_page *pages)
> +{
> +	struct ftrace_page *pg = pages;
> +
> +	while (pg) {
> +		if (pg->records) {
> +			free_pages((unsigned long)pg->records, pg->order);
> +			ftrace_number_of_pages -= 1 << pg->order;
> +		}
> +		pages = pg->next;
> +		kfree(pg);
> +		pg = pages;
> +		ftrace_number_of_groups--;
> +	}
> +}
> +
>  static struct ftrace_page *
>  ftrace_allocate_pages(unsigned long num_to_init)
>  {
> @@ -3343,17 +3359,7 @@ ftrace_allocate_pages(unsigned long num_to_init)
>  	return start_pg;
>  
>   free_pages:
> -	pg = start_pg;
> -	while (pg) {
> -		if (pg->records) {
> -			free_pages((unsigned long)pg->records, pg->order);
> -			ftrace_number_of_pages -= 1 << pg->order;
> -		}
> -		start_pg = pg->next;
> -		kfree(pg);
> -		pg = start_pg;
> -		ftrace_number_of_groups--;
> -	}
> +	ftrace_free_pages(start_pg);
>  	pr_info("ftrace: FAILED to allocate memory for functions\n");
>  	return NULL;
>  }

Nice little clean up. I had already started testing your previous patch,
but due to my test machine running out of disk space (perf doesn't clean up
its .debug directory :-p), I have to rerun it.

I'll apply this one for the new testing.

Thanks!

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ