* [PATCH] rust_binder: unfreeze process before returning on allocation failure
@ 2026-11-28 15:44 Adhyansh Verma
2026-11-28 17:56 ` [PATCH v2] " Adhyansh Verma
0 siblings, 1 reply; 7+ messages in thread
From: Adhyansh Verma @ 2026-11-28 15:44 UTC (permalink / raw)
To: Alice Ryhl; +Cc: Carlos Llamas, Greg Kroah-Hartman, rust-for-linux
In Process::ioctl_freeze(), when info.enable == 0 (unfreeze request),
the driver calls self.prepare_freeze_messages()? before acquiring
self.inner.lock() to reset inner.is_frozen = IsFrozen::No.
If prepare_freeze_messages() fails due to memory allocation failure
(AllocError), the ? operator immediately returns Err(ENOMEM).
Consequently, inner.is_frozen is never updated to IsFrozen::No, leaving
the target process permanently frozen.
Unfreezing the process itself is a zero-allocation operation and must
succeed so that incoming transactions are not blocked. In C Binder
(binder_ioctl_freeze), unfreezing a process never fails.
Update ioctl_freeze() to reset inner.is_frozen = IsFrozen::No regardless
of whether notification message allocation succeeds. If
prepare_freeze_messages() fails, return Err(ENOMEM) after ensuring the
process has been unfrozen.
Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
Signed-off-by: Adhyansh Verma <adhyanshverma2010@gmail.com>
---
drivers/android/binder/process.rs | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/android/binder/process.rs b/drivers/android/binder/process.rs
index 1f4cb43f1de..e4d5be79d9f 100644
--- a/drivers/android/binder/process.rs
+++ b/drivers/android/binder/process.rs
@@ -1536,14 +1536,19 @@ pub(crate) fn drop_outstanding_txn(&self) {
#[export_name = "rust_binder_freeze"]
pub(crate) fn ioctl_freeze(&self, info: &BinderFreezeInfo) -> Result {
if info.enable == 0 {
- let msgs = self.prepare_freeze_messages()?;
+ let msgs = self.prepare_freeze_messages();
let mut inner = self.inner.lock();
inner.sync_recv = false;
inner.async_recv = false;
inner.is_frozen = IsFrozen::No;
drop(inner);
- msgs.send_messages();
- return Ok(());
+ return match msgs {
+ Ok(msgs) => {
+ msgs.send_messages();
+ Ok(())
+ }
+ Err(kernel::alloc::AllocError) => Err(ENOMEM),
+ };
}
let mut inner = self.inner.lock();
--
2.56.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2] rust_binder: unfreeze process before returning on allocation failure
2026-11-28 15:44 [PATCH] rust_binder: unfreeze process before returning on allocation failure Adhyansh Verma
@ 2026-11-28 17:56 ` Adhyansh Verma
2026-11-28 19:49 ` [PATCH v3] " Adhyansh Verma
0 siblings, 1 reply; 7+ messages in thread
From: Adhyansh Verma @ 2026-11-28 17:56 UTC (permalink / raw)
To: Alice Ryhl; +Cc: Carlos Llamas, Greg Kroah-Hartman, rust-for-linux
In Process::ioctl_freeze(), when info.enable == 0 (unfreeze request),
the driver calls self.prepare_freeze_messages()? before acquiring
self.inner.lock() to reset inner.is_frozen = IsFrozen::No.
If prepare_freeze_messages() fails due to memory allocation failure
(AllocError), the ? operator immediately returns Err(ENOMEM).
Consequently, inner.is_frozen is never updated to IsFrozen::No, leaving
the target process permanently frozen. Furthermore, preparing messages
with GFP_KERNEL before clearing is_frozen leaves a window where
concurrent operations observe stale IsFrozen::Yes, and failing early in
top-level ioctl_freeze() leaves other binder contexts of the process
frozen.
Unfreezing the process itself is a zero-allocation operation and must
succeed so that incoming transactions are not blocked.
Update ioctl_freeze() to:
- Reset inner.is_frozen = IsFrozen::No, inner.sync_recv = false, and
inner.async_recv = false under lock before calling
prepare_freeze_messages(), avoiding race windows with concurrent
operations.
- Continue unfreezing all matching process contexts in top-level
ioctl_freeze() even if message preparation on one context fails.
- Return Err(ENOMEM) after ensuring processes have been unfrozen if
prepare_freeze_messages() fails.
Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
Signed-off-by: Adhyansh Verma <adhyanshverma2010@gmail.com>
---
v1 -> v2:
- Clear inner.is_frozen, sync_recv, and async_recv under lock before
calling prepare_freeze_messages() to prevent concurrent callers from
observing stale IsFrozen::Yes state
- Iterate through all matching process contexts in top-level
ioctl_freeze() during unfreeze, ensuring all contexts are unfrozen even
if one hits an allocation error
drivers/android/binder/process.rs | 33 +++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/drivers/android/binder/process.rs b/drivers/android/binder/process.rs
index 1f4cb43f1de..a0fd5538fab 100644
--- a/drivers/android/binder/process.rs
+++ b/drivers/android/binder/process.rs
@@ -1536,14 +1536,20 @@ pub(crate) fn drop_outstanding_txn(&self) {
#[export_name = "rust_binder_freeze"]
pub(crate) fn ioctl_freeze(&self, info: &BinderFreezeInfo) -> Result {
if info.enable == 0 {
- let msgs = self.prepare_freeze_messages()?;
- let mut inner = self.inner.lock();
- inner.sync_recv = false;
- inner.async_recv = false;
- inner.is_frozen = IsFrozen::No;
- drop(inner);
- msgs.send_messages();
- return Ok(());
+ {
+ let mut inner = self.inner.lock();
+ inner.sync_recv = false;
+ inner.async_recv = false;
+ inner.is_frozen = IsFrozen::No;
+ }
+ let msgs = self.prepare_freeze_messages();
+ return match msgs {
+ Ok(msgs) => {
+ msgs.send_messages();
+ Ok(())
+ }
+ Err(kernel::alloc::AllocError) => Err(ENOMEM),
+ };
}
let mut inner = self.inner.lock();
@@ -1648,10 +1654,17 @@ fn ioctl_freeze(reader: &mut UserSliceReader) -> Result {
}
}
+ let mut unfreeze_res = Ok(());
for proc in procs {
- proc.ioctl_freeze(&info)?;
+ if let Err(err) = proc.ioctl_freeze(&info) {
+ if info.enable == 0 {
+ unfreeze_res = Err(err);
+ } else {
+ return Err(err);
+ }
+ }
}
- Ok(())
+ unfreeze_res
}
/// The ioctl handler.
--
2.56.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3] rust_binder: unfreeze process before returning on allocation failure
2026-11-28 17:56 ` [PATCH v2] " Adhyansh Verma
@ 2026-11-28 19:49 ` Adhyansh Verma
2026-11-29 11:07 ` Alice Ryhl
2026-11-29 12:25 ` Greg Kroah-Hartman
0 siblings, 2 replies; 7+ messages in thread
From: Adhyansh Verma @ 2026-11-28 19:49 UTC (permalink / raw)
To: Alice Ryhl; +Cc: Carlos Llamas, Greg Kroah-Hartman, rust-for-linux
In Process::ioctl_freeze(), when info.enable == 0 (unfreeze request),
the driver calls self.prepare_freeze_messages()? before acquiring
self.inner.lock() to reset inner.is_frozen = IsFrozen::No.
If prepare_freeze_messages() fails due to memory allocation failure
(AllocError), the ? operator immediately returns Err(ENOMEM).
Consequently, inner.is_frozen is never updated to IsFrozen::No, leaving
the target process permanently frozen. Furthermore, preparing messages
with GFP_KERNEL before clearing is_frozen leaves a window where
concurrent operations observe stale IsFrozen::Yes, failing early in
top-level ioctl_freeze() leaves other binder contexts of the process
frozen, and dropping unfreeze notifications on allocation failure leaves
freeze listeners out of sync.
Unfreezing the process itself is a zero-allocation operation and must
succeed so that incoming transactions are not blocked.
Update ioctl_freeze() to:
- Reset inner.is_frozen = IsFrozen::No, inner.sync_recv = false, and
inner.async_recv = false under lock before calling
prepare_freeze_messages(), avoiding race windows with concurrent
operations.
- Maintain a freeze_version counter on ProcessInner incremented on every
is_frozen transition, allowing FreezeListener instances to detect state
changes and avoid suppressing notifications even if an intermediate
notification could not be allocated due to OOM.
- Continue unfreezing all matching process contexts in top-level
ioctl_freeze() even if message preparation on one context fails.
- Return Err(ENOMEM) after ensuring processes have been unfrozen if
prepare_freeze_messages() fails.
Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
Signed-off-by: Adhyansh Verma <adhyanshverma2010@gmail.com>
---
v2 -> v3:
- Add freeze_version counter to ProcessInner and track last_freeze_version
on FreezeListener so that listeners detect state transitions even if
unfreeze notification allocation fails under OOM
v1 -> v2:
- Clear inner.is_frozen, sync_recv, and async_recv under lock before
calling prepare_freeze_messages() to prevent concurrent callers from
observing stale IsFrozen::Yes state
- Iterate through all matching process contexts in top-level
ioctl_freeze() during unfreeze, ensuring all contexts are unfrozen even
if one hits an allocation error
drivers/android/binder/freeze.rs | 22 ++++++++++++---
drivers/android/binder/process.rs | 47 +++++++++++++++++++++++--------
2 files changed, 53 insertions(+), 16 deletions(-)
diff --git a/drivers/android/binder/freeze.rs b/drivers/android/binder/freeze.rs
index 69e058e6d81..5f871963bce 100644
--- a/drivers/android/binder/freeze.rs
+++ b/drivers/android/binder/freeze.rs
@@ -29,6 +29,8 @@ pub(crate) struct FreezeListener {
cookie: FreezeCookie,
/// What value of `is_frozen` did we most recently tell userspace about?
last_is_frozen: Option<bool>,
+ /// The owner's freeze_version that was last reported to userspace.
+ last_freeze_version: u64,
/// We sent a `BR_FROZEN_BINDER` and we are waiting for `BC_FREEZE_NOTIFICATION_DONE` before
/// sending any other commands.
is_pending: bool,
@@ -120,8 +122,11 @@ fn do_work(
writer.write_payload(&self.cookie.0)?;
Ok(true)
} else {
- let is_frozen = freeze.node.owner.inner.lock().is_frozen.is_fully_frozen();
- if freeze.last_is_frozen == Some(is_frozen) {
+ let (is_frozen, owner_version) = {
+ let inner = freeze.node.owner.inner.lock();
+ (inner.is_frozen.is_fully_frozen(), inner.freeze_version)
+ };
+ if freeze.last_freeze_version == owner_version {
return Ok(true);
}
@@ -130,6 +135,7 @@ fn do_work(
state_info.cookie = freeze.cookie.0;
freeze.is_pending = true;
freeze.last_is_frozen = Some(is_frozen);
+ freeze.last_freeze_version = owner_version;
drop(node_refs);
writer.write_code(BR_FROZEN_BINDER)?;
@@ -239,6 +245,7 @@ pub(crate) fn request_freeze_notif(self: &Arc<Self>, reader: &mut UserSliceReade
cookie,
node: info.node_ref().node.clone(),
last_is_frozen: None,
+ last_freeze_version: 0,
is_pending: false,
is_clearing: false,
num_pending_duplicates: 0,
@@ -255,6 +262,7 @@ pub(crate) fn request_freeze_notif(self: &Arc<Self>, reader: &mut UserSliceReade
dupe.num_cleared_duplicates += 1;
}
dupe.last_is_frozen = None;
+ dupe.last_freeze_version = 0;
dupe.is_pending = false;
dupe.is_clearing = false;
}
@@ -294,8 +302,14 @@ pub(crate) fn freeze_notif_done(self: &Arc<Self>, reader: &mut UserSliceReader)
);
return Err(EINVAL);
}
- let is_frozen = freeze.node.owner.inner.lock().is_frozen.is_fully_frozen();
- if freeze.is_clearing || freeze.last_is_frozen != Some(is_frozen) {
+ let (is_frozen, owner_version) = {
+ let inner = freeze.node.owner.inner.lock();
+ (inner.is_frozen.is_fully_frozen(), inner.freeze_version)
+ };
+ if freeze.is_clearing
+ || freeze.last_freeze_version != owner_version
+ || freeze.last_is_frozen != Some(is_frozen)
+ {
// Immediately send another FreezeMessage.
clear_msg = Some(FreezeMessage::init(alloc, cookie, self.task.pid()));
}
diff --git a/drivers/android/binder/process.rs b/drivers/android/binder/process.rs
index 1f4cb43f1de..12fcee397b9 100644
--- a/drivers/android/binder/process.rs
+++ b/drivers/android/binder/process.rs
@@ -139,6 +139,9 @@ pub(crate) struct ProcessInner {
outstanding_txns: u32,
/// Process is frozen and unable to service binder transactions.
pub(crate) is_frozen: IsFrozen,
+ /// Version counter incremented on every change to `is_frozen` to ensure freeze listeners
/// detect state transitions even if message allocation fails under OOM.
+ pub(crate) freeze_version: u64,
/// Process received sync transactions since last frozen.
pub(crate) sync_recv: bool,
/// Process received async transactions since last frozen.
@@ -165,6 +168,7 @@ fn new() -> Self {
defer_work: DeferWorks::default(),
outstanding_txns: 0,
is_frozen: IsFrozen::No,
+ freeze_version: 0,
sync_recv: false,
async_recv: false,
binderfs_file: None,
@@ -1536,14 +1540,21 @@ pub(crate) fn drop_outstanding_txn(&self) {
#[export_name = "rust_binder_freeze"]
pub(crate) fn ioctl_freeze(&self, info: &BinderFreezeInfo) -> Result {
if info.enable == 0 {
- let msgs = self.prepare_freeze_messages()?;
- let mut inner = self.inner.lock();
- inner.sync_recv = false;
- inner.async_recv = false;
- inner.is_frozen = IsFrozen::No;
- drop(inner);
- msgs.send_messages();
- return Ok(());
+ {
+ let mut inner = self.inner.lock();
+ inner.sync_recv = false;
+ inner.async_recv = false;
+ inner.is_frozen = IsFrozen::No;
+ inner.freeze_version = inner.freeze_version.wrapping_add(1);
+ }
+ let msgs = self.prepare_freeze_messages();
+ return match msgs {
+ Ok(msgs) => {
+ msgs.send_messages();
+ Ok(())
+ }
+ Err(kernel::alloc::AllocError) => Err(ENOMEM),
+ };
}
let mut inner = self.inner.lock();
@@ -1583,12 +1594,17 @@ pub(crate) fn ioctl_freeze(&self, info: &BinderFreezeInfo) -> Result {
drop(inner);
match self.prepare_freeze_messages() {
Ok(batch) => {
- self.inner.lock().is_frozen = IsFrozen::Yes;
+ let mut inner = self.inner.lock();
+ inner.is_frozen = IsFrozen::Yes;
+ inner.freeze_version = inner.freeze_version.wrapping_add(1);
+ drop(inner);
batch.send_messages();
Ok(())
}
Err(kernel::alloc::AllocError) => {
- self.inner.lock().is_frozen = IsFrozen::No;
+ let mut inner = self.inner.lock();
+ inner.is_frozen = IsFrozen::No;
+ inner.freeze_version = inner.freeze_version.wrapping_add(1);
Err(ENOMEM)
}
}
@@ -1648,10 +1664,17 @@ fn ioctl_freeze(reader: &mut UserSliceReader) -> Result {
}
}
+ let mut unfreeze_res = Ok(());
for proc in procs {
- proc.ioctl_freeze(&info)?;
+ if let Err(err) = proc.ioctl_freeze(&info) {
+ if info.enable == 0 {
+ unfreeze_res = Err(err);
+ } else {
+ return Err(err);
+ }
+ }
}
- Ok(())
+ unfreeze_res
}
/// The ioctl handler.
--
2.56.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3] rust_binder: unfreeze process before returning on allocation failure
2026-11-28 19:49 ` [PATCH v3] " Adhyansh Verma
@ 2026-11-29 11:07 ` Alice Ryhl
2026-11-29 12:25 ` Greg Kroah-Hartman
1 sibling, 0 replies; 7+ messages in thread
From: Alice Ryhl @ 2026-11-29 11:07 UTC (permalink / raw)
To: Adhyansh Verma
Cc: Alice Ryhl, Carlos Llamas, Greg Kroah-Hartman, rust-for-linux
On Sun, Nov 29, 2026 at 01:19:24AM +0530, Adhyansh Verma wrote:
> In Process::ioctl_freeze(), when info.enable == 0 (unfreeze request),
> the driver calls self.prepare_freeze_messages()? before acquiring
> self.inner.lock() to reset inner.is_frozen = IsFrozen::No.
>
> If prepare_freeze_messages() fails due to memory allocation failure
> (AllocError), the ? operator immediately returns Err(ENOMEM).
> Consequently, inner.is_frozen is never updated to IsFrozen::No, leaving
> the target process permanently frozen. Furthermore, preparing messages
> with GFP_KERNEL before clearing is_frozen leaves a window where
> concurrent operations observe stale IsFrozen::Yes, failing early in
> top-level ioctl_freeze() leaves other binder contexts of the process
> frozen, and dropping unfreeze notifications on allocation failure leaves
> freeze listeners out of sync.
>
> Unfreezing the process itself is a zero-allocation operation and must
> succeed so that incoming transactions are not blocked.
>
> Update ioctl_freeze() to:
> - Reset inner.is_frozen = IsFrozen::No, inner.sync_recv = false, and
> inner.async_recv = false under lock before calling
> prepare_freeze_messages(), avoiding race windows with concurrent
> operations.
> - Maintain a freeze_version counter on ProcessInner incremented on every
> is_frozen transition, allowing FreezeListener instances to detect state
> changes and avoid suppressing notifications even if an intermediate
> notification could not be allocated due to OOM.
> - Continue unfreezing all matching process contexts in top-level
> ioctl_freeze() even if message preparation on one context fails.
> - Return Err(ENOMEM) after ensuring processes have been unfrozen if
> prepare_freeze_messages() fails.
>
> Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
> Signed-off-by: Adhyansh Verma <adhyanshverma2010@gmail.com>
I don't think we should take this patch. If we can't allocate and send
the freeze notifications, then we haven't properly unfrozen the process
either -- unfreezing before prepare_freeze_messages() would leave the
process unfrozen while freeze listeners still think it is frozen.
Keeping the allocation before setting is_frozen = IsFrozen::No is
intentional and symmetric with the freeze path (which rolls back
is_frozen = IsFrozen::No if prepare_freeze_messages() returns ENOMEM):
on ENOMEM the ioctl fails cleanly without leaving state half-updated,
and userspace can retry.
Alice
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3] rust_binder: unfreeze process before returning on allocation failure
2026-11-28 19:49 ` [PATCH v3] " Adhyansh Verma
2026-11-29 11:07 ` Alice Ryhl
@ 2026-11-29 12:25 ` Greg Kroah-Hartman
2026-11-29 13:54 ` Adhyansh Verma
1 sibling, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-29 12:25 UTC (permalink / raw)
To: Adhyansh Verma; +Cc: Alice Ryhl, Carlos Llamas, rust-for-linux
On Sun, Nov 29, 2026 at 01:19:24AM +0530, Adhyansh Verma wrote:
> In Process::ioctl_freeze(), when info.enable == 0 (unfreeze request),
> the driver calls self.prepare_freeze_messages()? before acquiring
> self.inner.lock() to reset inner.is_frozen = IsFrozen::No.
>
> If prepare_freeze_messages() fails due to memory allocation failure
> (AllocError), the ? operator immediately returns Err(ENOMEM).
> Consequently, inner.is_frozen is never updated to IsFrozen::No, leaving
> the target process permanently frozen. Furthermore, preparing messages
> with GFP_KERNEL before clearing is_frozen leaves a window where
> concurrent operations observe stale IsFrozen::Yes, failing early in
> top-level ioctl_freeze() leaves other binder contexts of the process
> frozen, and dropping unfreeze notifications on allocation failure leaves
> freeze listeners out of sync.
>
> Unfreezing the process itself is a zero-allocation operation and must
> succeed so that incoming transactions are not blocked.
>
> Update ioctl_freeze() to:
> - Reset inner.is_frozen = IsFrozen::No, inner.sync_recv = false, and
> inner.async_recv = false under lock before calling
> prepare_freeze_messages(), avoiding race windows with concurrent
> operations.
> - Maintain a freeze_version counter on ProcessInner incremented on every
> is_frozen transition, allowing FreezeListener instances to detect state
> changes and avoid suppressing notifications even if an intermediate
> notification could not be allocated due to OOM.
> - Continue unfreezing all matching process contexts in top-level
> ioctl_freeze() even if message preparation on one context fails.
> - Return Err(ENOMEM) after ensuring processes have been unfrozen if
> prepare_freeze_messages() fails.
>
> Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
> Signed-off-by: Adhyansh Verma <adhyanshverma2010@gmail.com>
> ---
> v2 -> v3:
> - Add freeze_version counter to ProcessInner and track last_freeze_version
> on FreezeListener so that listeners detect state transitions even if
> unfreeze notification allocation fails under OOM
> v1 -> v2:
> - Clear inner.is_frozen, sync_recv, and async_recv under lock before
> calling prepare_freeze_messages() to prevent concurrent callers from
> observing stale IsFrozen::Yes state
> - Iterate through all matching process contexts in top-level
> ioctl_freeze() during unfreeze, ensuring all contexts are unfrozen even
> if one hits an allocation error
Please slow down. Worst case, wait 24 hours between patches. There is
no rush here.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3] rust_binder: unfreeze process before returning on allocation failure
2026-11-29 12:25 ` Greg Kroah-Hartman
@ 2026-11-29 13:54 ` Adhyansh Verma
2026-11-29 14:05 ` Miguel Ojeda
0 siblings, 1 reply; 7+ messages in thread
From: Adhyansh Verma @ 2026-11-29 13:54 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Alice Ryhl, Carlos Llamas, rust-for-linux
Understood. My mail to vger had been rate-limited for few hours,
so patches piled up and I sent them all in one burst once it cleared.
I'll space submissions out from now on.
Sorry for the flood, and thanks for the patience and mentorship to me,
being new.
Once again,
-Thank You
-Adhyansh Verma
On Sun, Nov 29, 2026 at 5:55 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Sun, Nov 29, 2026 at 01:19:24AM +0530, Adhyansh Verma wrote:
> > In Process::ioctl_freeze(), when info.enable == 0 (unfreeze request),
> > the driver calls self.prepare_freeze_messages()? before acquiring
> > self.inner.lock() to reset inner.is_frozen = IsFrozen::No.
> >
> > If prepare_freeze_messages() fails due to memory allocation failure
> > (AllocError), the ? operator immediately returns Err(ENOMEM).
> > Consequently, inner.is_frozen is never updated to IsFrozen::No, leaving
> > the target process permanently frozen. Furthermore, preparing messages
> > with GFP_KERNEL before clearing is_frozen leaves a window where
> > concurrent operations observe stale IsFrozen::Yes, failing early in
> > top-level ioctl_freeze() leaves other binder contexts of the process
> > frozen, and dropping unfreeze notifications on allocation failure leaves
> > freeze listeners out of sync.
> >
> > Unfreezing the process itself is a zero-allocation operation and must
> > succeed so that incoming transactions are not blocked.
> >
> > Update ioctl_freeze() to:
> > - Reset inner.is_frozen = IsFrozen::No, inner.sync_recv = false, and
> > inner.async_recv = false under lock before calling
> > prepare_freeze_messages(), avoiding race windows with concurrent
> > operations.
> > - Maintain a freeze_version counter on ProcessInner incremented on every
> > is_frozen transition, allowing FreezeListener instances to detect state
> > changes and avoid suppressing notifications even if an intermediate
> > notification could not be allocated due to OOM.
> > - Continue unfreezing all matching process contexts in top-level
> > ioctl_freeze() even if message preparation on one context fails.
> > - Return Err(ENOMEM) after ensuring processes have been unfrozen if
> > prepare_freeze_messages() fails.
> >
> > Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
> > Signed-off-by: Adhyansh Verma <adhyanshverma2010@gmail.com>
> > ---
> > v2 -> v3:
> > - Add freeze_version counter to ProcessInner and track last_freeze_version
> > on FreezeListener so that listeners detect state transitions even if
> > unfreeze notification allocation fails under OOM
> > v1 -> v2:
> > - Clear inner.is_frozen, sync_recv, and async_recv under lock before
> > calling prepare_freeze_messages() to prevent concurrent callers from
> > observing stale IsFrozen::Yes state
> > - Iterate through all matching process contexts in top-level
> > ioctl_freeze() during unfreeze, ensuring all contexts are unfrozen even
> > if one hits an allocation error
>
> Please slow down. Worst case, wait 24 hours between patches. There is
> no rush here.
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3] rust_binder: unfreeze process before returning on allocation failure
2026-11-29 13:54 ` Adhyansh Verma
@ 2026-11-29 14:05 ` Miguel Ojeda
0 siblings, 0 replies; 7+ messages in thread
From: Miguel Ojeda @ 2026-11-29 14:05 UTC (permalink / raw)
To: Adhyansh Verma
Cc: Greg Kroah-Hartman, Alice Ryhl, Carlos Llamas, rust-for-linux
On Sun, Nov 29, 2026 at 2:54 PM Adhyansh Verma
<adhyanshverma2010@gmail.com> wrote:
>
> Understood. My mail to vger had been rate-limited for few hours,
> so patches piled up and I sent them all in one burst once it cleared.
I think Greg is referring to the repeated versions for the same patch,
not to the independent patches (i.e. it is fine sending 4 different
patches in a row).
For instance, there were 4 versions of the `BR_FROZEN_BINDER` one in
~20 hours. I assume it is due to the Sashiko feedback, but please give
time for maintainers to look at the patch, because it may be that the
patch is not needed, and thus all the versions not needed either.
Each version submitted is essentially a row in someone's spreadsheet... :)
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-29 14:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 15:44 [PATCH] rust_binder: unfreeze process before returning on allocation failure Adhyansh Verma
2026-11-28 17:56 ` [PATCH v2] " Adhyansh Verma
2026-11-28 19:49 ` [PATCH v3] " Adhyansh Verma
2026-11-29 11:07 ` Alice Ryhl
2026-11-29 12:25 ` Greg Kroah-Hartman
2026-11-29 13:54 ` Adhyansh Verma
2026-11-29 14:05 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox