All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Seth Jennings <sjenning@redhat.com>,
	Jiri Kosina <jikos@kernel.org>, Vojtech Pavlik <vojtech@suse.com>,
	linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
	"Cyril B." <cbay@alwaysdata.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Miroslav Benes <mbenes@suse.cz>
Subject: Re: [PATCH v2 3/3] livepatch: Cleanup module page permission changes
Date: Fri, 6 Nov 2015 11:40:55 +0100	[thread overview]
Message-ID: <20151106104055.GL2599@pathway.suse.cz> (raw)
In-Reply-To: <f3427a7aa26f4765c231ae36f3f11f7006a9aa41.1446757977.git.jpoimboe@redhat.com>

On Thu 2015-11-05 15:18:05, Josh Poimboeuf wrote:
> Calling set_memory_rw() and set_memory_ro() for every iteration of the
> loop in klp_write_object_relocations() is messy, inefficient, and
> error-prone.
> 
> Change all the read-only pages to read-write before the loop and convert
> them back to read-only again afterwards.
> 
> The {un}set_module_core_ro_nx() functions are used to change the
> page permissions.  Toggling NX isn't necessary in this case, but it's
> not highly performance sensitive code so it should be fine.

Hmm, the name (un)set_module_core_ro_nx() still sounds a bit strange,
especially the "ro_nx" suffix. Alternative solution would be to create

   set_module_text_rw()
   set_module_text_ro()

There already exists

   set_all_modules_text_rw()
   set_all_modules_text_ro()

They modify only the ro/rw flags. IMHO, the name is more descriptive
They are used by ftrace for very similar purpose.

They modify also the init section. But we might want to touch it
as well. klp_module_notify() is called too late now. But once we
have a more complex consistency model, we will need to reject
the module when the patching fails. We will need to call the
livepatch init earlier, close to ftrace_module_init(mod).
Then the init section might be interesting as well.


Best Regards,
Petr

  reply	other threads:[~2015-11-06 10:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05 21:18 [PATCH v2 0/3] CONFIG_DEBUG_SET_MODULE_RONX bug fix and cleanups Josh Poimboeuf
2015-11-05 21:18 ` [PATCH v2 1/3] livepatch: Fix crash with !CONFIG_DEBUG_SET_MODULE_RONX Josh Poimboeuf
2015-11-06 10:14   ` Jiri Kosina
2015-11-05 21:18 ` [PATCH v2 2/3] module: Use the same logic for setting and unsetting RO/NX Josh Poimboeuf
2015-11-08 19:40   ` Rusty Russell
2015-11-05 21:18 ` [PATCH v2 3/3] livepatch: Cleanup module page permission changes Josh Poimboeuf
2015-11-06 10:40   ` Petr Mladek [this message]
2015-11-06 12:12     ` Josh Poimboeuf
2015-11-06 13:42       ` Petr Mladek
2015-11-06 17:14         ` Josh Poimboeuf
2015-11-08 23:01           ` Rusty Russell

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=20151106104055.GL2599@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=cbay@alwaysdata.com \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=rusty@rustcorp.com.au \
    --cc=sjenning@redhat.com \
    --cc=vojtech@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.