mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Russell King <linux@armlinux.org.uk>
Subject: Re: [PATCH v3 2/2] ARM: ftrace: Add MODULE_PLTS support
Date: Fri, 9 Mar 2018 09:54:48 +0100	[thread overview]
Message-ID: <93864477-75bb-3f73-1d06-03d128b04f94@nokia.com> (raw)
In-Reply-To: <CAKv+Gu87oP4Bxn_XkQkc2zf8GXLhoRkWBkUr5N0KMdyMfq1GMg@mail.gmail.com>

Hello Ard!

On 09/03/18 09:50, Ard Biesheuvel wrote:
>> +static u32 fixed_plts[] = {
>> +       FTRACE_ADDR,
>> +       MCOUNT_ADDR,
>> +#ifdef CONFIG_OLD_MCOUNT
>> +       (unsigned long)ftrace_caller_old,
>> +       (unsigned long)mcount,
>> +#endif
>> +};
>> +
> Do we need this stuff in the PLT loader if ftrace is disabled?

You are right, it probably would not even build w/o FTRACE.
I'll fix it, thanks for looking into this!

>>  static bool in_init(const struct module *mod, unsigned long loc)
>>  {
>>         return loc - (u32)mod->init_layout.base < mod->init_layout.size;
>> @@ -31,26 +41,43 @@ u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val)
>>  {
>>         struct mod_plt_sec *pltsec = !in_init(mod, loc) ? &mod->arch.core :
>>                                                           &mod->arch.init;
>> +       int idx;
>> +       struct plt_entries *plt;
>> +
>> +       /* Pre-allocate entries in the first plt */
>> +       if (!pltsec->plt_count) {
>> +               plt = (struct plt_entries *)pltsec->plt->sh_addr;
>> +               for (idx = 0; idx < ARRAY_SIZE(plt->ldr); ++idx)
>> +                       plt->ldr[idx] = PLT_ENT_LDR;
>> +               memcpy(plt->lit, fixed_plts, sizeof(fixed_plts));
>> +               pltsec->plt_count = ARRAY_SIZE(fixed_plts);
>> +               /*
>> +                * cache the address,
>> +                * ELF header is available only during module load
>> +                */
>> +               pltsec->plt_ent = plt;
>> +       }
>> +       plt = pltsec->plt_ent;
>>
>> -       struct plt_entries *plt = (struct plt_entries *)pltsec->plt->sh_addr;
>> -       int idx = 0;
>> +       idx = ARRAY_SIZE(fixed_plts);
>> +       while (idx)
>> +               if (plt->lit[--idx] == val)
>> +                       return (u32)&plt->ldr[idx];
>>
> Same here.

-- 
Best regards,
Alexander Sverdlin.

  reply	other threads:[~2018-03-09  8:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-09  8:41 [PATCH v3 0/2] ARM: Implement MODULE_PLT support in FTRACE Alexander Sverdlin
2018-03-09  8:41 ` [PATCH v3 1/2] ARM: PLT: Move struct plt_entries definition to header Alexander Sverdlin
2018-03-09  8:41 ` [PATCH v3 2/2] ARM: ftrace: Add MODULE_PLTS support Alexander Sverdlin
2018-03-09  8:50   ` Ard Biesheuvel
2018-03-09  8:54     ` Alexander Sverdlin [this message]
2018-03-09  9:41       ` Ard Biesheuvel

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=93864477-75bb-3f73-1d06-03d128b04f94@nokia.com \
    --to=alexander.sverdlin@nokia.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.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

all inboxes | Powered by JetHome®