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: <2ue3ogwfxwmnhncikcuwuyon6fpr7nvsbe53zvamfla7phppd3@ydwm4rvb3h4a>
Date: Thu, 22 Aug 2024 20:45:10 -0400
From: Daniel Jordan <daniel.m.jordan@...cle.com>
To: Kamlesh Gurudasani <kamlesh@...com>
Cc: Herbert Xu <herbert@...dor.apana.org.au>, Waiman Long <longman@...hat.com>,
        steffen.klassert@...unet.com, akpm@...ux-foundation.org,
        linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] padata: Fix possible divide-by-0 panic in
 padata_mt_helper()

On Thu, Aug 22, 2024 at 02:40:57AM GMT, Kamlesh Gurudasani wrote:
> Kamlesh Gurudasani <kamlesh@...com> writes:
> 
> > Daniel Jordan <daniel.m.jordan@...cle.com> writes:
> >
> >> On Tue, Aug 20, 2024 at 12:06:47PM GMT, Herbert Xu wrote:
> >>> On Mon, Aug 19, 2024 at 06:29:52PM -0400, Daniel Jordan wrote:
> >>> >
> >>> > The DIV_ROUND_UP approach reads a bit nicer to me, but I can imagine
> >>> > oddball cases where rounding up is undesirable (say, near-zero values
> >>> > for size, min_chunk, and align; padata_work_alloc_mt returns many fewer
> >>> > works than requested; and a single unit of work is very expensive) so
> >>> > that rounding up makes a bigger difference.  So, the way it now is seems
> >>> > ok.
> >>> 
> >>> In that case let's do the max ahead of the align check:
> >>> 
> >>> 	ps.chunk_size = max(ps.chunk_size, 1ul);
> >>> 	ps.chunk_size = roundup(ps.chunk_size, job->align);
> >>> 
> >>> If we do it after then it may come out unaligned (e.g., job->align = 8
> >>> and ps.chunk_size = 1).
> >>
> >> Sure, I think Kamlesh was the first to suggest max, so maybe Kamlesh
> >> would like to make the change.  I'll send a patch otherwise.
> > Thanks for consideration, Daniel. I'll send a patch.
> Sent.
> 
> Just curious about one thing on line 495,
> 
> nworks = max(job->size / max(job->min_chunk, job->align), 1ul);
> 
> what happens if both min_chunk and align are 0.

That's a fair point.  It's another of those things that's not supposed
to happen, but it's worth making padata robust to it.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ