[PATCH 1/2] liveupdate: luo_file: do not clear serialized_data on unfreeze

Pratyush Yadav posted 2 patches 1 week, 5 days ago
[PATCH 1/2] liveupdate: luo_file: do not clear serialized_data on unfreeze
Posted by Pratyush Yadav 1 week, 5 days ago
From: "Pratyush Yadav (Google)" <pratyush@kernel.org>

The unfreeze operation is supposed to undo the effects of the freeze
operation. serialized_data is not set by freeze, but by preserve.
Consequently, the unpreserve operation needs to access serialized_data
to undo the effects of the preserve operation. This includes freeing
the serialized data structures for example.

If a freeze callback fails, unfreeze is called for all frozen files.
This would clear serialized_data for them. Since live update has failed,
it can be expected that userspace aborts, releasing all sessions. When
the sessions are released, unpreserve will be called for all files. The
unfrozen files will see 0 in their serialized_data. This is not expected
by file handlers, and they might either fail, leaking data and state, or
might even crash or cause invalid memory access.

Do not clear serialized_data on unfreeze so it gets passed on to
unpreserve. There is no need to clear it on unpreserve since luo_file
will be freed immediately after.

Fixes: 7c722a7f44e0 ("liveupdate: luo_file: implement file systems callbacks")
Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>
---
 kernel/liveupdate/luo_file.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c
index a32a777f6df8..9f7283379ebc 100644
--- a/kernel/liveupdate/luo_file.c
+++ b/kernel/liveupdate/luo_file.c
@@ -402,8 +402,6 @@ static void luo_file_unfreeze_one(struct luo_file_set *file_set,
 
 		luo_file->fh->ops->unfreeze(&args);
 	}
-
-	luo_file->serialized_data = 0;
 }
 
 static void __luo_file_unfreeze(struct luo_file_set *file_set,
-- 
2.52.0.457.g6b5491de43-goog
Re: [PATCH 1/2] liveupdate: luo_file: do not clear serialized_data on unfreeze
Posted by Mike Rapoport 1 week, 3 days ago
On Tue, Jan 27, 2026 at 12:02:52AM +0100, Pratyush Yadav wrote:
> From: "Pratyush Yadav (Google)" <pratyush@kernel.org>
> 
> The unfreeze operation is supposed to undo the effects of the freeze
> operation. serialized_data is not set by freeze, but by preserve.
> Consequently, the unpreserve operation needs to access serialized_data
> to undo the effects of the preserve operation. This includes freeing
> the serialized data structures for example.
> 
> If a freeze callback fails, unfreeze is called for all frozen files.
> This would clear serialized_data for them. Since live update has failed,
> it can be expected that userspace aborts, releasing all sessions. When
> the sessions are released, unpreserve will be called for all files. The
> unfrozen files will see 0 in their serialized_data. This is not expected
> by file handlers, and they might either fail, leaking data and state, or
> might even crash or cause invalid memory access.
> 
> Do not clear serialized_data on unfreeze so it gets passed on to
> unpreserve. There is no need to clear it on unpreserve since luo_file
> will be freed immediately after.
> 
> Fixes: 7c722a7f44e0 ("liveupdate: luo_file: implement file systems callbacks")
> Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>

Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

> ---
>  kernel/liveupdate/luo_file.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c
> index a32a777f6df8..9f7283379ebc 100644
> --- a/kernel/liveupdate/luo_file.c
> +++ b/kernel/liveupdate/luo_file.c
> @@ -402,8 +402,6 @@ static void luo_file_unfreeze_one(struct luo_file_set *file_set,
>  
>  		luo_file->fh->ops->unfreeze(&args);
>  	}
> -
> -	luo_file->serialized_data = 0;
>  }
>  
>  static void __luo_file_unfreeze(struct luo_file_set *file_set,
> -- 
> 2.52.0.457.g6b5491de43-goog
> 

-- 
Sincerely yours,
Mike.
Re: [PATCH 1/2] liveupdate: luo_file: do not clear serialized_data on unfreeze
Posted by Pratyush Yadav 1 week, 1 day ago
On Wed, Jan 28 2026, Mike Rapoport wrote:

> On Tue, Jan 27, 2026 at 12:02:52AM +0100, Pratyush Yadav wrote:
>> From: "Pratyush Yadav (Google)" <pratyush@kernel.org>
>> 
>> The unfreeze operation is supposed to undo the effects of the freeze
>> operation. serialized_data is not set by freeze, but by preserve.
>> Consequently, the unpreserve operation needs to access serialized_data
>> to undo the effects of the preserve operation. This includes freeing
>> the serialized data structures for example.
>> 
>> If a freeze callback fails, unfreeze is called for all frozen files.
>> This would clear serialized_data for them. Since live update has failed,
>> it can be expected that userspace aborts, releasing all sessions. When
>> the sessions are released, unpreserve will be called for all files. The
>> unfrozen files will see 0 in their serialized_data. This is not expected
>> by file handlers, and they might either fail, leaking data and state, or
>> might even crash or cause invalid memory access.
>> 
>> Do not clear serialized_data on unfreeze so it gets passed on to
>> unpreserve. There is no need to clear it on unpreserve since luo_file
>> will be freed immediately after.
>> 
>> Fixes: 7c722a7f44e0 ("liveupdate: luo_file: implement file systems callbacks")
>> Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>
>
> Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

Thanks.

Andrew, do you mind taking this patch in v6.19-rc8/v6.19 hotfixes? The
second patch needs a re-roll and I don't think I would be able to do it
this week.

This is an independent fix and I see no reason to block this waiting for
the other one.

[...]

-- 
Regards,
Pratyush Yadav
Re: [PATCH 1/2] liveupdate: luo_file: do not clear serialized_data on unfreeze
Posted by Andrew Morton 1 week, 1 day ago
On Fri, 30 Jan 2026 19:56:28 +0100 Pratyush Yadav <pratyush@kernel.org> wrote:

> >> Fixes: 7c722a7f44e0 ("liveupdate: luo_file: implement file systems callbacks")
> >> Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>
> >
> > Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> 
> Thanks.
> 
> Andrew, do you mind taking this patch in v6.19-rc8/v6.19 hotfixes?

Yep, that's where it was.

> The
> second patch needs a re-roll and I don't think I would be able to do it
> this week.
> 
> This is an independent fix and I see no reason to block this waiting for
> the other one.

OK, I moved "liveupdate: luo_file: remember retrieve() status" to
tail-of-everything and added a note that a new version is expected.
Re: [PATCH 1/2] liveupdate: luo_file: do not clear serialized_data on unfreeze
Posted by Pratyush Yadav 5 days, 23 hours ago
On Fri, Jan 30 2026, Andrew Morton wrote:

> On Fri, 30 Jan 2026 19:56:28 +0100 Pratyush Yadav <pratyush@kernel.org> wrote:
>
>> >> Fixes: 7c722a7f44e0 ("liveupdate: luo_file: implement file systems callbacks")
>> >> Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>
>> >
>> > Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
>> 
>> Thanks.
>> 
>> Andrew, do you mind taking this patch in v6.19-rc8/v6.19 hotfixes?
>
> Yep, that's where it was.

Thanks. I didn't realize there was going to be an -rc8 and I didn't want
this patch to miss the final cut of v6.19 in case you were expecting a
re-roll of the whole series.

>
>> The
>> second patch needs a re-roll and I don't think I would be able to do it
>> this week.
>> 
>> This is an independent fix and I see no reason to block this waiting for
>> the other one.
>
> OK, I moved "liveupdate: luo_file: remember retrieve() status" to
> tail-of-everything and added a note that a new version is expected.

Sounds good. I'll try to send out the new version in the next couple
days so we can include it in v6.19 final.

-- 
Regards,
Pratyush Yadav