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: <20230725055434.GM11388@unreal>
Date: Tue, 25 Jul 2023 08:54:34 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Lin Ma <linma@....edu.cn>
Cc: kuba@...nel.org, davem@...emloft.net, edumazet@...gle.com,
	pabeni@...hat.com, ast@...nel.org, martin.lau@...nel.org,
	yhs@...com, void@...ifault.com, andrii@...nel.org,
	houtao1@...wei.com, inwardvessel@...il.com, kuniyu@...zon.com,
	songliubraving@...com, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH v2] bpf: Add length check for
 SK_DIAG_BPF_STORAGE_REQ_MAP_FD parsing

On Tue, Jul 25, 2023 at 01:24:38PM +0800, Lin Ma wrote:
> Hello Leon,
> 
> > 
> > Jakub, it seems like Lin adds this check to all nla_for_each_nested() loops.
> > IMHO, the better change will be to change nla_for_each_nested() skip empty/not valid NLAs.
> > 
> > Thanks
> 
> I guess you just get these fixes misunderstood. I do not add the nla_len check
> to  **all nla_for_each_nested** :(. I only add checks to those who do not access 
> the attributes without verifying the length, which is buggy.
> 
> The others, either do a similar nla_len check already or just do nla_validate
> somewhere else. That is to say, they **validate** the relevant attributes.
> 
> In short, nla_for_each_nested is just a loop macro that iterates the nlattrs,
> like nla_for_each macro. It is weird for them to do nlattr validation as there
> could have already been a call to nla_validate to ensure those attributes are
> correct. That is, for those who do not, a simple nla_len check is the simplest
> and most efficient choice.

My concern is related to maintainability in long run. Your check adds
another layer of cabal knowledge which will be copied/pasted in other
places.

Thanks

> 
> Regards
> Lin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ