All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris J Arges <chris.j.arges@canonical.com>
To: live-patching@vger.kernel.org
Cc: jeyu@redhat.com, Chris J Arges <chris.j.arges@canonical.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Seth Jennings <sjenning@redhat.com>,
	Jiri Kosina <jikos@kernel.org>, Vojtech Pavlik <vojtech@suse.com>,
	linux-api@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/3 v6] livepatch: function,sympos scheme in livepatch sysfs directory
Date: Fri, 13 Nov 2015 10:23:22 -0600	[thread overview]
Message-ID: <1447431804-18786-4-git-send-email-chris.j.arges@canonical.com> (raw)
In-Reply-To: <1447431804-18786-1-git-send-email-chris.j.arges@canonical.com>

The following directory structure will allow for cases when the same
function name exists in a single object.
	/sys/kernel/livepatch/<patch>/<object>/<function,sympos>

The sympos number corresponds to the nth occurrence of the symbol name in
kallsyms for the patched object.

An example of patching multiple symbols can be found here:
	https://github.com/dynup/kpatch/issues/493

Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
---
 Documentation/ABI/testing/sysfs-kernel-livepatch |  6 +++++-
 kernel/livepatch/core.c                          | 10 ++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-kernel-livepatch b/Documentation/ABI/testing/sysfs-kernel-livepatch
index 5bf42a8..da87f43 100644
--- a/Documentation/ABI/testing/sysfs-kernel-livepatch
+++ b/Documentation/ABI/testing/sysfs-kernel-livepatch
@@ -33,7 +33,7 @@ Description:
 		The object directory contains subdirectories for each function
 		that is patched within the object.
 
-What:		/sys/kernel/livepatch/<patch>/<object>/<function>
+What:		/sys/kernel/livepatch/<patch>/<object>/<function,sympos>
 Date:		Nov 2014
 KernelVersion:	3.19.0
 Contact:	live-patching@vger.kernel.org
@@ -41,4 +41,8 @@ Description:
 		The function directory contains attributes regarding the
 		properties and state of the patched function.
 
+		The directory name contains the patched function name and a
+		sympos number corresponding to the nth occurrence of the symbol
+		name in kallsyms for the patched object.
+
 		There are currently no such attributes.
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index 5cfe7b5..53ba0ae 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -534,7 +534,7 @@ EXPORT_SYMBOL_GPL(klp_enable_patch);
  * /sys/kernel/livepatch/<patch>
  * /sys/kernel/livepatch/<patch>/enabled
  * /sys/kernel/livepatch/<patch>/<object>
- * /sys/kernel/livepatch/<patch>/<object>/<func>
+ * /sys/kernel/livepatch/<patch>/<object>/<function,sympos>
  */
 
 static ssize_t enabled_store(struct kobject *kobj, struct kobj_attribute *attr,
@@ -679,8 +679,14 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func)
 	INIT_LIST_HEAD(&func->stack_node);
 	func->state = KLP_DISABLED;
 
+	/* The format for the sysfs directory is <function,sympos> where sympos
+	 * is the nth occurrence of this symbol in kallsyms for the patched
+	 * object. If the user selects 0 for old_sympos, then 1 will be used
+	 * since a unique symbol will be the first occurrence.
+	 */
 	return kobject_init_and_add(&func->kobj, &klp_ktype_func,
-				    &obj->kobj, "%s", func->old_name);
+				    &obj->kobj, "%s,%lu", func->old_name,
+				    func->old_sympos ? func->old_sympos : 1);
 }
 
 /* parts of the initialization that is done only when the object is loaded */
-- 
1.9.1


  parent reply	other threads:[~2015-11-13 16:23 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02 17:58 [PATCH] livepatch: old_name.number scheme in livepatch sysfs directory Chris J Arges
2015-11-02 17:58 ` Chris J Arges
2015-11-02 19:15 ` Jessica Yu
2015-11-02 19:52 ` [PATCH] " Josh Poimboeuf
2015-11-02 19:52   ` Josh Poimboeuf
2015-11-02 20:16   ` Chris J Arges
2015-11-02 20:32     ` Josh Poimboeuf
2015-11-02 22:59       ` [PATCH v2] " Chris J Arges
2015-11-02 22:59         ` Chris J Arges
2015-11-03  9:50         ` Miroslav Benes
2015-11-03 15:03           ` Josh Poimboeuf
2015-11-03 10:52         ` Miroslav Benes
2015-11-03 10:52           ` Miroslav Benes
2015-11-03 12:44           ` Petr Mladek
2015-11-03 12:44             ` Petr Mladek
2015-11-03 15:03             ` Josh Poimboeuf
2015-11-03 15:03               ` Josh Poimboeuf
2015-11-03 19:57             ` Jiri Kosina
2015-11-03 19:57               ` Jiri Kosina
2015-11-03 20:06               ` Josh Poimboeuf
2015-11-03 20:06                 ` Josh Poimboeuf
     [not found]                 ` <1447259366-7055-1-git-send-email-chris.j.arges@canonical.com>
2015-11-11 16:28                   ` [PATCH 1/3 v4] livepatch: add old_sympos as disambiguator field to klp_func Chris J Arges
2015-11-11 17:43                     ` Josh Poimboeuf
2015-11-12 10:22                     ` Miroslav Benes
2015-11-11 16:29                   ` [PATCH 2/3 v4] livepatch: add old_sympos as disambiguator field to klp_reloc Chris J Arges
2015-11-11 16:39                     ` Chris J Arges
2015-11-11 17:57                     ` Josh Poimboeuf
2015-11-12 14:31                       ` Petr Mladek
2015-11-12 19:19                         ` Josh Poimboeuf
2015-11-13 13:54                           ` Petr Mladek
2015-11-13 16:59                             ` Josh Poimboeuf
2015-11-16 12:11                               ` Petr Mladek
2015-11-12 10:23                     ` Miroslav Benes
2015-11-11 16:29                   ` [PATCH 3/3 v4] livepatch: old_name,number scheme in livepatch sysfs directory Chris J Arges
2015-11-11 18:01                     ` Josh Poimboeuf
2015-11-11 18:01                       ` Josh Poimboeuf
     [not found]                   ` <1447347595-30728-1-git-send-email-chris.j.arges@canonical.com>
2015-11-12 16:59                     ` [PATCH 1/4 v5] livepatch: add old_sympos as disambiguator field to klp_func Chris J Arges
2015-11-12 19:45                       ` Josh Poimboeuf
2015-11-13  9:56                       ` Jiri Kosina
2015-11-13 10:14                       ` Miroslav Benes
2015-11-13 16:27                       ` Petr Mladek
2015-11-12 16:59                     ` [PATCH 2/4 v5] livepatch: Simplify code for relocated external symbols Chris J Arges
2015-11-13 10:24                       ` Miroslav Benes
2015-11-13 13:55                         ` Petr Mladek
2015-11-12 16:59                     ` [PATCH 3/4 v5] livepatch: add sympos as disambiguator field to klp_reloc Chris J Arges
2015-11-12 19:50                       ` Josh Poimboeuf
2015-11-13 16:42                       ` Petr Mladek
2015-11-12 16:59                     ` [PATCH 4/4 v5] livepatch: function,sympos scheme in livepatch sysfs directory Chris J Arges
     [not found]                     ` <1447431804-18786-1-git-send-email-chris.j.arges@canonical.com>
2015-11-13 16:23                       ` [PATCH 1/3 v6] livepatch: add old_sympos as disambiguator field to klp_func Chris J Arges
2015-11-13 16:23                       ` [PATCH 2/3 v6] livepatch: add sympos as disambiguator field to klp_reloc Chris J Arges
2015-11-13 16:23                       ` Chris J Arges [this message]
     [not found]                       ` <1447693391-10065-1-git-send-email-chris.j.arges@canonical.com>
2015-11-16 17:03                         ` [PATCH 1/3 v7] livepatch: add old_sympos as disambiguator field to klp_func Chris J Arges
2015-11-16 21:59                           ` Jiri Kosina
2015-11-17 14:29                             ` Chris J Arges
2015-11-19 10:02                               ` Jiri Kosina
2015-11-16 17:03                         ` [PATCH 2/3 v7] livepatch: add sympos as disambiguator field to klp_reloc Chris J Arges
2015-11-18  9:56                           ` Miroslav Benes
2015-11-18 14:01                             ` Josh Poimboeuf
2015-11-18 16:47                               ` Petr Mladek
2015-11-18 16:37                           ` Petr Mladek
2015-11-18 16:39                             ` Chris J Arges
2015-11-18 16:55                               ` Petr Mladek
2015-11-18 20:34                                 ` Jiri Kosina
2015-11-16 17:03                         ` [PATCH 3/3 v7] livepatch: function,sympos scheme in livepatch sysfs directory Chris J Arges
2015-11-20 17:25                         ` [PATCH 0/3 v8] livepatch: disambiguate symbols with the same name Chris J Arges
2015-11-20 17:25                           ` [PATCH 1/3 v8] livepatch: add old_sympos as disambiguator field to klp_func Chris J Arges
2015-11-23  9:47                             ` Miroslav Benes
2015-11-20 17:25                           ` [PATCH 2/3 v8] livepatch: add sympos as disambiguator field to klp_reloc Chris J Arges
2015-11-23  9:52                             ` Miroslav Benes
2015-11-30 20:46                               ` Chris J Arges
2015-12-01  1:17                                 ` Josh Poimboeuf
2015-11-20 17:25                           ` [PATCH 3/3 v8] livepatch: function,sympos scheme in livepatch sysfs directory Chris J Arges
2015-11-23  9:47                             ` Miroslav Benes
2015-12-02  2:40                           ` [PATCH 0/3 v9] livepatch: disambiguate symbols with the same name Chris J Arges
2015-12-02  2:40                             ` [PATCH 1/3 v9] livepatch: add old_sympos as disambiguator field to klp_func Chris J Arges
2015-12-02  2:40                             ` [PATCH 2/3 v9] livepatch: add sympos as disambiguator field to klp_reloc Chris J Arges
2015-12-14 12:45                               ` Miroslav Benes
2015-12-02  2:40                             ` [PATCH 3/3 v9] livepatch: function,sympos scheme in livepatch sysfs directory Chris J Arges
2015-12-02 15:28                             ` [PATCH 0/3 v9] livepatch: disambiguate symbols with the same name Petr Mladek
2015-12-03 17:59                             ` Josh Poimboeuf
2015-12-03 22:04                             ` Jiri Kosina
2015-11-03 14:58           ` [PATCH v2] livepatch: old_name.number scheme in livepatch sysfs directory Josh Poimboeuf
2015-11-03 16:09             ` Miroslav Benes
2015-11-03 16:50               ` Josh Poimboeuf
2015-11-03 20:42                 ` Chris J Arges
2015-11-03 20:42                   ` Chris J Arges
2015-11-04  9:52                 ` Miroslav Benes
2015-11-04  9:52                   ` Miroslav Benes
2015-11-04 16:03                   ` Josh Poimboeuf
2015-11-04 16:17                     ` Chris J Arges
2015-11-04 16:17                       ` Chris J Arges
2015-11-05 15:18                     ` Miroslav Benes
2015-11-05 15:56                       ` Josh Poimboeuf
2015-11-05 16:07                         ` Chris J Arges
2015-11-09 16:16                         ` [PATCH v3] livepatch: old_name,number " Chris J Arges
2015-11-09 16:16                           ` Chris J Arges
2015-11-09 20:56                           ` Josh Poimboeuf
2015-11-09 23:01                             ` Chris J Arges
2015-11-09 23:01                               ` Chris J Arges
2015-11-10  4:54                               ` Josh Poimboeuf
2015-11-10  8:49                                 ` Miroslav Benes
2015-11-10 13:40                                   ` Josh Poimboeuf
2015-11-10 13:40                                     ` Josh Poimboeuf
2015-11-10  9:02                           ` Miroslav Benes

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=1447431804-18786-4-git-send-email-chris.j.arges@canonical.com \
    --to=chris.j.arges@canonical.com \
    --cc=jeyu@redhat.com \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --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.