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]
Date:   Tue, 10 Mar 2020 15:38:20 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Artem Savkov <asavkov@...hat.com>
Cc:     linux-kernel@...r.kernel.org, live-patching@...r.kernel.org
Subject: Re: [PATCH v2] ftrace: return first found result in lookup_rec()

On Fri,  6 Mar 2020 18:43:17 +0100
Artem Savkov <asavkov@...hat.com> wrote:

> It appears that ip ranges can overlap so. In that case lookup_rec()
> returns whatever results it got last even if it found nothing in last
> searched page.
> 
> This breaks an obscure livepatch late module patching usecase:
>   - load livepatch
>   - load the patched module
>   - unload livepatch
>   - try to load livepatch again
> 
> To fix this return from lookup_rec() as soon as it found the record
> containing searched-for ip. This used to be this way prior lookup_rec()
> introduction.
> 
> v2: break instead of two returns

Thanks Artem, I applied your patch. But just an FYI, it's best to place the
"v2" statement below the three dashes "---" so that it doesn't get pulled
into the git commit when this patch is applied via a script.

-- Steve

> 
> Fixes: 7e16f581a817 ("ftrace: Separate out functionality from ftrace_location_range()")
> Signed-off-by: Artem Savkov <asavkov@...hat.com>
> ---
>  kernel/trace/ftrace.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 3f7ee102868a..fd81c7de77a7 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -1547,6 +1547,8 @@ static struct dyn_ftrace *lookup_rec(unsigned long start, unsigned long end)
>  		rec = bsearch(&key, pg->records, pg->index,
>  			      sizeof(struct dyn_ftrace),
>  			      ftrace_cmp_recs);
> +		if (rec)
> +			break;
>  	}
>  	return rec;
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ