From: Rik van Riel <riel@surriel.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
kernel-team@fb.com, Jiri Kosina <jikos@kernel.org>,
Miroslav Benes <mbenes@suse.cz>,
Joe Lawrence <joe.lawrence@redhat.com>,
Breno Leitao <leitao@debian.org>
Subject: Re: [PATCH v4] livepatch: fix race between fork and KLP transition
Date: Tue, 02 Aug 2022 16:07:08 -0400 [thread overview]
Message-ID: <c04f97fc29c4618f137b27ce6537800b53f1d95f.camel@surriel.com> (raw)
In-Reply-To: <YuKtNtOshtRfeMn7@alley>
[-- Attachment #1: Type: text/plain, Size: 1266 bytes --]
On Thu, 2022-07-28 at 17:37 +0200, Petr Mladek wrote:
> On Wed 2022-07-27 10:24:37, Rik van Riel wrote:
> > v4: address changelog comments by Josh (thank you)
> >
> > ---8<---
> > When a KLP fails to apply, klp_reverse_transition will clear the
> > TIF_PATCH_PENDING flag on all tasks, except for newly created tasks
> > which are not on the task list yet.
>
> It actually is not true. klp_reverse_transtion() clears
> TIF_PATCH_FLAG only
> temporary when it waits until all processes leave the ftrace
> handler. It sets TIF_PATCH_FLAG once again for all tasks by calling
> klp_start_transition().
>
> The difference is important. The WARN_ON_ONCE() in
> klp_complete_transition() will be printed when fork() copied
> TIF_PATCH_FLAG before it was set again.
>
> Anyway, the important thing is that TIF_PATCH_FLAG and task-
> >patch_state
> might be incompatible because fork() copies them at different times.
>
> klp_copy_process() must make sure that they are in sync. And
> it must be done under tasklist_lock when the child is added
> to the global task list.
Hmmm, how should this be addressed in the changelog?
Should I just remove most of that paragraph and leave it
at "there can be a race"?
--
All Rights Reversed.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-08-02 20:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-20 16:10 [PATCH,RFC] livepatch: fix race between fork and klp_reverse_transition Rik van Riel
2022-07-21 23:23 ` Song Liu
2022-07-22 15:30 ` Petr Mladek
2022-07-22 19:01 ` [PATCH v2] " Rik van Riel
2022-07-25 13:32 ` Petr Mladek
2022-07-25 13:49 ` [PATCH v3] " Rik van Riel
2022-07-27 0:10 ` Josh Poimboeuf
2022-07-27 0:26 ` Rik van Riel
2022-07-28 15:20 ` Petr Mladek
2022-07-27 14:24 ` [PATCH v4] livepatch: fix race between fork and KLP transition Rik van Riel
2022-07-28 15:37 ` Petr Mladek
2022-08-02 20:07 ` Rik van Riel [this message]
2022-08-04 13:06 ` Petr Mladek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c04f97fc29c4618f137b27ce6537800b53f1d95f.camel@surriel.com \
--to=riel@surriel.com \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=kernel-team@fb.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=pmladek@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).