Re: [GIT PULL] ftrace: Check if pages were allocated before calling free_pages()

2021-04-01 Thread Steven Rostedt
On Thu, 1 Apr 2021 13:18:59 -0700 Linus Torvalds wrote: > On Thu, Apr 1, 2021 at 1:07 PM Steven Rostedt wrote: > > > > On Wed, 31 Mar 2021 11:03:21 -0700 > > Linus Torvalds wrote: > > > > > @@ -6231,7 +6231,8 @@ static int ftrace_process_locs(struct module *mod, > > > if (!addr) >

Re: [GIT PULL] ftrace: Check if pages were allocated before calling free_pages()

2021-04-01 Thread Steven Rostedt
On Thu, 1 Apr 2021 16:07:10 -0400 Steven Rostedt wrote: > > @@ -6231,7 +6231,8 @@ static int ftrace_process_locs(struct module *mod, > > if (!addr) > > continue; > > > > - if (pg->index == pg->size) { > > + end_offset = (pg->index+1) * sizeof(

Re: [GIT PULL] ftrace: Check if pages were allocated before calling free_pages()

2021-04-01 Thread Linus Torvalds
On Thu, Apr 1, 2021 at 1:07 PM Steven Rostedt wrote: > > On Wed, 31 Mar 2021 11:03:21 -0700 > Linus Torvalds wrote: > > > @@ -6231,7 +6231,8 @@ static int ftrace_process_locs(struct module *mod, > > if (!addr) > > continue; > > > > - if (pg->index =

Re: [GIT PULL] ftrace: Check if pages were allocated before calling free_pages()

2021-04-01 Thread Steven Rostedt
On Wed, 31 Mar 2021 11:03:21 -0700 Linus Torvalds wrote: > @@ -6231,7 +6231,8 @@ static int ftrace_process_locs(struct module *mod, > if (!addr) > continue; > > - if (pg->index == pg->size) { > + end_offset = (pg->index+1) * sizeof(pg-

Re: [GIT PULL] ftrace: Check if pages were allocated before calling free_pages()

2021-03-31 Thread Steven Rostedt
On Wed, 31 Mar 2021 11:03:21 -0700 Linus Torvalds wrote: > I found another bug in there, for example: > > ftrace_number_of_pages -= 1 << order; > > is also wrong if order is negative. True, but ftrace_number_of_pages is only used for accounting (used to display the number of pa

Re: [GIT PULL] ftrace: Check if pages were allocated before calling free_pages()

2021-03-31 Thread Linus Torvalds
On Wed, Mar 31, 2021 at 11:51 AM Steven Rostedt wrote: > > Your fls() trick might work too (have to gawk at it more). And I should fix > the comments. But any work on that would be for the next merge window, and > doesn't affect that this patch fixes a possible issue. See my second email. It does

Re: [GIT PULL] ftrace: Check if pages were allocated before calling free_pages()

2021-03-31 Thread Steven Rostedt
On Wed, 31 Mar 2021 10:45:01 -0700 Linus Torvalds wrote: > On Wed, Mar 31, 2021 at 6:27 AM Steven Rostedt wrote: > > > > order = get_count_order(pg->size / ENTRIES_PER_PAGE); > > - free_pages((unsigned long)pg->records, order); > > + if (order >= 0) >

Re: [GIT PULL] ftrace: Check if pages were allocated before calling free_pages()

2021-03-31 Thread pr-tracker-bot
The pull request you sent on Wed, 31 Mar 2021 09:27:11 -0400: > git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git > trace-v5.12-rc5 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/d19cc4bfbff1ae72c3505a00fb8ce0d3fa519e6c Thank you! -- Deet-doot-d

Re: [GIT PULL] ftrace: Check if pages were allocated before calling free_pages()

2021-03-31 Thread Linus Torvalds
On Wed, Mar 31, 2021 at 10:45 AM Linus Torvalds wrote: > > Honestly, looking at that code, every single use of > "get_count_order()" seems really really confusing. Side note: I've pulled your fix, but I really think that the bug is almost entirely due to the code being so opaque and crazy hard to

Re: [GIT PULL] ftrace: Check if pages were allocated before calling free_pages()

2021-03-31 Thread Linus Torvalds
On Wed, Mar 31, 2021 at 6:27 AM Steven Rostedt wrote: > > order = get_count_order(pg->size / ENTRIES_PER_PAGE); > - free_pages((unsigned long)pg->records, order); > + if (order >= 0) > + free_pages((unsigned long)pg->records, order)

[GIT PULL] ftrace: Check if pages were allocated before calling free_pages()

2021-03-31 Thread Steven Rostedt
Linus, Add check of order < 0 before calling free_pages() The function addresses that are traced by ftrace are stored in pages, and the size is held in a variable. If there's some error in creating them, the allocate ones will be freed. In this case, it is possible that the order of pages to be