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: <d5c34a1f-8538-47ab-80e4-6d54b96d5b2e@gmail.com>
Date: Tue, 10 Feb 2026 23:12:30 +0530
From: Shivam Kalra <shivamkalra98@...il.com>
To: Danilo Krummrich <dakr@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
 Vlastimil Babka <vbabka@...e.cz>, "Liam R. Howlett"
 <Liam.Howlett@...cle.com>, Uladzislau Rezki <urezki@...il.com>,
 Miguel Ojeda <ojeda@...nel.org>, Boqun Feng <boqun.feng@...il.com>,
 Gary Guo <gary@...yguo.net>, Björn Roy Baron
 <bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>,
 Andreas Hindborg <a.hindborg@...nel.org>, Trevor Gross <tmgross@...ch.edu>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 Arve Hjønnevåg <arve@...roid.com>,
 Todd Kjos <tkjos@...roid.com>, Christian Brauner <brauner@...nel.org>,
 Carlos Llamas <cmllamas@...gle.com>, rust-for-linux@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 0/4] rust: alloc: add Vec shrinking methods

On 10/02/26 20:35, Danilo Krummrich wrote:
> On Tue Feb 10, 2026 at 2:57 PM CET, Alice Ryhl wrote:
>> On Tue, Feb 10, 2026 at 07:08:09PM +0530, Shivam Kalra wrote:
>>> This is a follow-up to my v3 series:
>>> https://lore.kernel.org/rust-for-linux/20260207-binder-shrink-vec-v3-v3-0-8ff388563427@cock.li/
>>>
>>> Hi all,
>>>
>>> Thanks for the feedback on v3. Before I respin, I want to confirm
>>> the direction for v4 to avoid unnecessary iterations.
>>>
>>> Proposed changes for v4:
>>>
>>> 1. Drop the Shrinkable trait entirely. Make shrink_to() a normal
>>>    method on Vec<T, A> that calls A::realloc(). (Danilo)
>>>
>>> 2. Add a temporary ShrinkQuirk trait to handle the vmalloc workaround
>>>    (page-boundary check + manual alloc+copy+free) until vrealloc
>>>    gains in-place shrinking support. (Danilo)
>>
>> I don't think you want any new traits at all. What types would even
>> implement the trait? The special code can go in the realloc() method of
>> Vmalloc struct in rust/kernel/alloc/allocator.rs.
> 
> I did not propose to move this into the realloc() functions of the corresponding
> allocators intentionally, as there is a difference between calling realloc() and
> shrink_to().
> 
> I don't want that some user of e.g. Vmalloc::realloc() experiences page wise
> shrinking by copy. This is acceptable for Vec::shrink_to(), but not for
> realloc() in general.
I think this aligns with the reasoning behind the Shrinkable trait
in v3- keeping the shrink workaround separate from realloc() so
that other users of realloc() (like IntoIter) don't unexpectedly
get alloc+copy+free behavior.
Happy to implement whichever approach you both agree on.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ