All of lore.kernel.org
 help / color / mirror / Atom feed
From: Song Liu <song@kernel.org>
To: Petr Mladek <pmladek@suse.com>
Cc: live-patching@vger.kernel.org, jpoimboe@kernel.org,
	jikos@kernel.org, joe.lawrence@redhat.com,
	Miroslav Benes <mbenes@suse.cz>,
	Josh Poimboeuf <jpoimboe@redhat.com>
Subject: Re: [PATCH v7] livepatch: Clear relocation targets on a module removal
Date: Thu, 5 Jan 2023 08:53:01 -0800	[thread overview]
Message-ID: <CAPhsuW5E9m5tb_ZCknH4QfFMukqwZHkKxvkHxo5A-znt5tm0ow@mail.gmail.com> (raw)
In-Reply-To: <Y7ayTvpxnDvX9Nfi@alley>

On Thu, Jan 5, 2023 at 3:20 AM Petr Mladek <pmladek@suse.com> wrote:
[...]
>
> The ideal solution would be to add checks into apply_relocated_add().
> It would make it more robust. In that case, clear_relocated_add()
> would need to clear everything.
>
> But this is not the case on powerpc and s390 at the moment.
> In this case, I suggest to clear only relocations that
> are checked in apply_relocated_add().
>
> But it should be done without duplicating the code.
>
> It would actually make sense to compute the value that was
> used in apply_relocated_add() and check that we are clearing
> the value. If we try to clear some other value than we
> probably do something wrong.
>
> This might actually be a solution. We could compute
> the value in both situations. Then we could have
> a common function for writing.
>
> This write function would check that it replaces zero
> with the value in apply_relocate_add() and that it replaces
> the value with zero in clear_relocate_add().

I like this idea. But I am not quite sure whether we can do it
for all those complicated cases.

Btw: I am confused with this one:

                case R_PPC64_REL16_HA:
                        /* Subtract location pointer */
                        value -= (unsigned long)location;
                        value = ((value + 0x8000) >> 16);
                        *((uint16_t *) location)
                                = (*((uint16_t *) location) & ~0xffff)
                                | (value & 0xffff);
                        break;

(*((uint16_t *) location) & ~0xffff) should always be zero, no?

Thanks,
Song

  reply	other threads:[~2023-01-05 16:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14 17:40 [PATCH v7] livepatch: Clear relocation targets on a module removal Song Liu
2023-01-03 17:00 ` Song Liu
2023-01-03 22:39   ` Joe Lawrence
2023-01-03 23:29     ` Song Liu
2023-01-04 10:26 ` Petr Mladek
2023-01-04 17:34   ` Song Liu
2023-01-04 23:12     ` Joe Lawrence
2023-01-05  5:59       ` Song Liu
2023-01-05 15:05         ` Joe Lawrence
2023-01-05 17:11           ` Song Liu
2023-01-06 13:02           ` Miroslav Benes
2023-01-06 16:26             ` Petr Mladek
2023-01-06 16:51               ` Song Liu
2023-01-05 11:19     ` Petr Mladek
2023-01-05 16:53       ` Song Liu [this message]
2023-01-05 18:09         ` Joe Lawrence
2023-01-05 13:03 ` 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=CAPhsuW5E9m5tb_ZCknH4QfFMukqwZHkKxvkHxo5A-znt5tm0ow@mail.gmail.com \
    --to=song@kernel.org \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@kernel.org \
    --cc=jpoimboe@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.