public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>,
	Jan Kratochvil via Libc-alpha <libc-alpha@sourceware.org>
Cc: Jan Kratochvil <jkratochvil@azul.com>, Anton Kozlov <akozlov@azul.com>
Subject: Re: [PATCH] RFC: Provide a function to reset IFUNC PLTs
Date: Tue, 7 Mar 2023 10:07:58 -0300	[thread overview]
Message-ID: <2659aadc-6518-cc0e-d103-84eafcbdc3f9@linaro.org> (raw)
In-Reply-To: <87v8jdq7ht.fsf@oldenburg.str.redhat.com>



On 07/03/23 05:40, Florian Weimer via Libc-alpha wrote:
> * Jan Kratochvil via Libc-alpha:
> 
>> Some projects snapshot+restore process images to migrate them to
>> a different machine. The target machine may have different (particularly
>> lower) set of CPU features. Restored process does crash in glibc IFUNC
>> functions which have been already set in PLTs due to the former more
>> rich CPU features on the snapshotting machine.
>>
>> Providing a glibc function which can be called during the restore.
>>
>> I understand the code may need more adjustments before its upstreaming
>> but is this an acceptable approach?
> 
> Do you have a high-level overview how this is supposed to work?  Is CRIU
> expected to call the new _dl_reset_ifunc symbol after restore?
> 
> Use of <sys/platform/x86.h> is somewhat rare.  Not even GCC uses it
> AFAIK.  It has its own cached CPU data used for target clones and
> similar features.  Re-running those IFUNC resolvers will just give the
> same results.

I am not sure if the ifunc reset will be really safe without adding CRIU
migrate sync points, to avoid suspend execution in a context that the
ifunc variants are already being executed or its address is being in a
function point (for instance in PLT code).

Besides, I also not sure if adding way to remove RELRO protection won't
add more security issues (we can disable for sesuid binaries, but even
though it is not a good security practice).

> 
> Distributions have started to deploy alternate builds in
> glibc-hwcaps/x86-64-v3 directories:
> 
>   openSUSE Tumbleweed gains optional x86-64-v3 optimization
>   <https://news.opensuse.org/2023/03/02/tw-gains-optional-optimizations/>
> 
> This might be a common situation fairly soon.  This is not IFUNC-based
> at all, so any IFUNC-based approach is not going to help with that.
> 
> Practically speaking, I think cluster heterogeneity needs to be hidden
> at the cluster level.


For glibc standpoint I think heterogeneity should be handled by masking
off the higher cpu features sets so the programs always run with the 
lowest ifunc variants set.

  reply	other threads:[~2023-03-07 13:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06  8:04 Jan Kratochvil
2023-03-07  8:40 ` Florian Weimer
2023-03-07 13:07   ` Adhemerval Zanella Netto [this message]
2023-03-08 10:21     ` Jan Kratochvil
2023-03-08 13:04       ` Adhemerval Zanella Netto
2023-03-09 11:32         ` Jan Kratochvil
2023-03-09 15:47           ` Adhemerval Zanella Netto
2023-03-09 17:43             ` Adhemerval Zanella Netto
2023-03-16 14:38             ` Jan Kratochvil
2023-03-20 16:47               ` Adhemerval Zanella Netto
2023-03-29 12:12                 ` Jan Kratochvil
2023-03-29 13:14                   ` Adhemerval Zanella Netto
2023-03-13 13:59           ` Florian Weimer
2023-03-14 12:55             ` Jan Kratochvil
2023-03-14 14:49               ` Florian Weimer
2023-03-14 15:06                 ` Jan Kratochvil
2023-03-08 10:23   ` Jan Kratochvil
2023-03-08 10:44     ` Florian Weimer
2023-03-08 11:03       ` Jan Kratochvil

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=2659aadc-6518-cc0e-d103-84eafcbdc3f9@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=akozlov@azul.com \
    --cc=fweimer@redhat.com \
    --cc=jkratochvil@azul.com \
    --cc=libc-alpha@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).