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] [thread-next>] [day] [month] [year] [list]
Message-ID: <c63414d8-57e1-69d4-a180-746e415289c1@amd.com>
Date:   Thu, 29 Sep 2022 12:30:10 +0530
From:   Sandipan Das <sandipan.das@....com>
To:     Stephane Eranian <eranian@...gle.com>
Cc:     linux-kernel@...r.kernel.org, peterz@...radead.org,
        ananth.narayan@....com, ravi.bangoria@....com
Subject: Re: [PATCH 1/2] perf/x86/utils: fix uninitialized var in
 get_branch_type()

On 9/29/2022 12:10 AM, Stephane Eranian wrote:
> offset is passed as a pointer and on certain call path is not set by the
> function. If the caller does not re-initialize offset between calls, value
> could be inherited between calls. Prevent this by initializing offset on each
> call.
> This impacts the code in amd_pmu_lbr_filter() which does
>    for(i=0; ...) {
>        ret = get_branch_type_fused(..., &offset);
>        if (offset)
>           lbr_entries[i].from += offset;
>    }
> 
> Signed-off-by: Stephane Eranian <eranian@...gle.com>
> ---
>  arch/x86/events/utils.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/events/utils.c b/arch/x86/events/utils.c
> index 5f5617afde79..76b1f8bb0fd5 100644
> --- a/arch/x86/events/utils.c
> +++ b/arch/x86/events/utils.c
> @@ -94,6 +94,10 @@ static int get_branch_type(unsigned long from, unsigned long to, int abort,
>  	u8 buf[MAX_INSN_SIZE];
>  	int is64 = 0;
>  
> +	/* make sure we initialize offset */
> +	if (offset)
> +		*offset = 0;
> +
>  	to_plm = kernel_ip(to) ? X86_BR_KERNEL : X86_BR_USER;
>  	from_plm = kernel_ip(from) ? X86_BR_KERNEL : X86_BR_USER;
>  

Reviewed-by: Sandipan Das <sandipan.das@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ