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: <b1749989-ae58-4b1d-b228-62c996dfe87d@web.de>
Date: Mon, 31 Mar 2025 17:00:21 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Henry Martin <bsdhenrymartin@...il.com>,
 linux-perf-users@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Cc: LKML <linux-kernel@...r.kernel.org>, Mark Rutland <mark.rutland@....com>,
 Will Deacon <will@...nel.org>
Subject: Re: [PATCH v3] driver: tx2: Add NULL check in tx2_uncore_pmu_register

> devm_kasprintf() returns NULL if memory allocation fails.

                call                                 failed?


>                                                           Currently,
> tx2_uncore_pmu_register() does not check for this case, leading to a
> NULL pointer dereference.

This (temporary) view should be reconsidered in more detail.


> No automated tools were used;

Further development tools can help for such analysis attempts.


>                               this was found during manual code review.

This approach might be misleading so far.


…
> +++ b/drivers/perf/thunderx2_pmu.c
> @@ -738,7 +738,8 @@ static int tx2_uncore_pmu_register(
>
>  	tx2_pmu->pmu.name = devm_kasprintf(dev, GFP_KERNEL,
>  			"%s", name);
> -
> +	if (!tx2_pmu->pmu.name)
> +		return -ENOMEM;
>  	return perf_pmu_register(&tx2_pmu->pmu, tx2_pmu->pmu.name, -1);
>  }
…

Should your source code analysis approaches take further implementation details
better into account?

Example:
perf_pmu_register()
https://elixir.bootlin.com/linux/v6.14-rc6/source/kernel/events/core.c#L11859-L11862
…
	if (WARN_ONCE(!name, "Can not register anonymous pmu.\n")) {
		ret = -EINVAL;
…


Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ