All of lore.kernel.org
 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>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH v4 2/2] ARM: ftrace: Add MODULE_PLTS support
Date: Tue, 13 Mar 2018 18:13:25 +0100	[thread overview]
Message-ID: <5d3ae760-45bd-3588-500f-1b352e1722de@nokia.com> (raw)
In-Reply-To: <CAKv+Gu-g+2y6Ej0cvLcz0R571HAnj2VXXDF0agWizDzReYMymg@mail.gmail.com>

Hello Ard,

On 13/03/18 17:12, Ard Biesheuvel wrote:
>>  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;
>> +       struct plt_entries *plt;
>> +       int idx;
>>
>> -       struct plt_entries *plt = (struct plt_entries *)pltsec->plt->sh_addr;
                                                           ^^^^^^^^^^^ (*)

>> -       int idx = 0;
>> +       /* cache the address, ELF header is available only during module load */
>> +       if (!pltsec->plt_ent)
>> +               pltsec->plt_ent = (struct plt_entries *)pltsec->plt->sh_addr;
>> +       plt = pltsec->plt_ent;
>> +
> Where is plt_ent ever used?

Above is exactly the place it's used.
I need to cache it because after the module load is finished the ELF header is freed,
pltsec->plt pointer (*) is not valid any more.
With the above modification it's possible to call the function during the whole life
time of the module.

>> +       if (!pltsec->plt_count)
>> +               prealloc_fixed(pltsec, plt);

I'll prepare v5 based on your other comments.

-- 
Best regards,
Alexander Sverdlin.

WARNING: multiple messages have this Message-ID (diff)
From: alexander.sverdlin@nokia.com (Alexander Sverdlin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 2/2] ARM: ftrace: Add MODULE_PLTS support
Date: Tue, 13 Mar 2018 18:13:25 +0100	[thread overview]
Message-ID: <5d3ae760-45bd-3588-500f-1b352e1722de@nokia.com> (raw)
In-Reply-To: <CAKv+Gu-g+2y6Ej0cvLcz0R571HAnj2VXXDF0agWizDzReYMymg@mail.gmail.com>

Hello Ard,

On 13/03/18 17:12, Ard Biesheuvel wrote:
>>  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;
>> +       struct plt_entries *plt;
>> +       int idx;
>>
>> -       struct plt_entries *plt = (struct plt_entries *)pltsec->plt->sh_addr;
                                                           ^^^^^^^^^^^ (*)

>> -       int idx = 0;
>> +       /* cache the address, ELF header is available only during module load */
>> +       if (!pltsec->plt_ent)
>> +               pltsec->plt_ent = (struct plt_entries *)pltsec->plt->sh_addr;
>> +       plt = pltsec->plt_ent;
>> +
> Where is plt_ent ever used?

Above is exactly the place it's used.
I need to cache it because after the module load is finished the ELF header is freed,
pltsec->plt pointer (*) is not valid any more.
With the above modification it's possible to call the function during the whole life
time of the module.

>> +       if (!pltsec->plt_count)
>> +               prealloc_fixed(pltsec, plt);

I'll prepare v5 based on your other comments.

-- 
Best regards,
Alexander Sverdlin.

  reply	other threads:[~2018-03-13 17:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13 13:53 [PATCH v4 0/2] ARM: Implement MODULE_PLT support in FTRACE Alexander Sverdlin
2018-03-13 13:53 ` Alexander Sverdlin
2018-03-13 13:53 ` [PATCH v4 1/2] ARM: PLT: Move struct plt_entries definition to header Alexander Sverdlin
2018-03-13 13:53   ` Alexander Sverdlin
2018-03-13 13:53 ` [PATCH v4 2/2] ARM: ftrace: Add MODULE_PLTS support Alexander Sverdlin
2018-03-13 13:53   ` Alexander Sverdlin
2018-03-13 16:12   ` Ard Biesheuvel
2018-03-13 16:12     ` Ard Biesheuvel
2018-03-13 17:13     ` Alexander Sverdlin [this message]
2018-03-13 17:13       ` Alexander Sverdlin
2018-03-13 17:18       ` Ard Biesheuvel
2018-03-13 17:18         ` Ard Biesheuvel
2018-03-13 17:32         ` Alexander Sverdlin
2018-03-13 17:32           ` Alexander Sverdlin
2018-03-13 17:39           ` Ard Biesheuvel
2018-03-13 17:39             ` Ard Biesheuvel
2018-03-13 17:49             ` Alexander Sverdlin
2018-03-13 17:49               ` Alexander Sverdlin
2018-03-13 17:51               ` Ard Biesheuvel
2018-03-13 17:51                 ` Ard Biesheuvel
2018-03-13 18:24                 ` Alexander Sverdlin
2018-03-13 18:24                   ` Alexander Sverdlin
2018-03-13 18:29                   ` Ard Biesheuvel
2018-03-13 18:29                     ` Ard Biesheuvel
2018-03-13 18:28             ` Alexander Sverdlin
2018-03-13 18:28               ` Alexander Sverdlin
2018-03-20 12:28           ` Alexander Sverdlin
2018-03-20 12:28             ` Alexander Sverdlin

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=5d3ae760-45bd-3588-500f-1b352e1722de@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 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.