* [PATCH] livepatch: old_name@old_addr scheme in livepatch sysfs directory
@ 2015-10-31 3:44 Chris J Arges
[not found] ` <1446263060-22175-1-git-send-email-chris.j.arges-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Chris J Arges @ 2015-10-31 3:44 UTC (permalink / raw)
To: live-patching-u79uwXL29TY76Z2rM5mHXA
Cc: Chris J Arges, Josh Poimboeuf, Seth Jennings, Jiri Kosina,
Vojtech Pavlik, linux-api-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
The following directory structure will allow for cases when the same
function name exists in a single object.
/sys/kernel/livepatch/<patch>/<object>/<function@address>
An example of this issue is documented here:
https://github.com/dynup/kpatch/issues/493
Signed-off-by: Chris J Arges <chris.j.arges-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
Documentation/ABI/testing/sysfs-kernel-livepatch | 4 ++--
kernel/livepatch/core.c | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-kernel-livepatch b/Documentation/ABI/testing/sysfs-kernel-livepatch
index 5bf42a8..afa0470 100644
--- a/Documentation/ABI/testing/sysfs-kernel-livepatch
+++ b/Documentation/ABI/testing/sysfs-kernel-livepatch
@@ -33,12 +33,12 @@ 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@address>
Date: Nov 2014
KernelVersion: 3.19.0
Contact: live-patching-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Description:
- The function directory contains attributes regarding the
+ The function@address directory contains attributes regarding the
properties and state of the patched function.
There are currently no such attributes.
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index 6e53441..347cb3e 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -733,7 +733,8 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func)
func->state = KLP_DISABLED;
return kobject_init_and_add(&func->kobj, &klp_ktype_func,
- &obj->kobj, "%s", func->old_name);
+ &obj->kobj, "%s@%p", func->old_name,
+ (void *)func->old_addr);
}
/* parts of the initialization that is done only when the object is loaded */
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: livepatch: old_name@old_addr scheme in livepatch sysfs directory
[not found] ` <1446263060-22175-1-git-send-email-chris.j.arges-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
@ 2015-11-01 1:53 ` Jessica Yu
2015-11-01 4:01 ` Chris J Arges
0 siblings, 1 reply; 5+ messages in thread
From: Jessica Yu @ 2015-11-01 1:53 UTC (permalink / raw)
To: Chris J Arges
Cc: live-patching-u79uwXL29TY76Z2rM5mHXA, Josh Poimboeuf,
Seth Jennings, Jiri Kosina, Vojtech Pavlik,
linux-api-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
+++ Chris J Arges [30/10/15 22:44 -0500]:
>The following directory structure will allow for cases when the same
>function name exists in a single object.
> /sys/kernel/livepatch/<patch>/<object>/<function@address>
Hi Chris, thanks for the patch.
I think the last time this issue was discussed, the conclusion was
that concatenating the address to the function name constitutes as an
information leak (as the sysfs entry is visible to non-root users).
One option suggested by Josh in that thread would be to do something
like "func.n", where n is just the nth occurrence of the symbol name.
Another option might be to keep the func@addr format but not make these
entries visible to non-root users.
Jessica
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: livepatch: old_name@old_addr scheme in livepatch sysfs directory
2015-11-01 1:53 ` Jessica Yu
@ 2015-11-01 4:01 ` Chris J Arges
[not found] ` <56358EA4.10900-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Chris J Arges @ 2015-11-01 4:01 UTC (permalink / raw)
To: Jessica Yu
Cc: live-patching, Josh Poimboeuf, Seth Jennings, Jiri Kosina,
Vojtech Pavlik, linux-api, linux-kernel
On 10/31/2015 08:53 PM, Jessica Yu wrote:
> +++ Chris J Arges [30/10/15 22:44 -0500]:
>> The following directory structure will allow for cases when the same
>> function name exists in a single object.
>> /sys/kernel/livepatch/<patch>/<object>/<function@address>
>
> Hi Chris, thanks for the patch.
>
> I think the last time this issue was discussed, the conclusion was
> that concatenating the address to the function name constitutes as an
> information leak (as the sysfs entry is visible to non-root users).
>
> One option suggested by Josh in that thread would be to do something
> like "func.n", where n is just the nth occurrence of the symbol name.
> Another option might be to keep the func@addr format but not make these
> entries visible to non-root users.
>
> Jessica
>
Jessica,
Makes sense to me. Is there a reason why the sysfs entries are visible
to non-root users?
Otherwise, if there is a use-case for keeping the permissions the same,
then I'd be happy to to use the 'func.n' format for v2.
--chris
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: livepatch: old_name@old_addr scheme in livepatch sysfs directory
[not found] ` <56358EA4.10900-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
@ 2015-11-01 9:07 ` Jiri Kosina
[not found] ` <alpine.LNX.2.00.1511010958430.17538-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Jiri Kosina @ 2015-11-01 9:07 UTC (permalink / raw)
To: Chris J Arges
Cc: Jessica Yu, live-patching-u79uwXL29TY76Z2rM5mHXA, Josh Poimboeuf,
Seth Jennings, Vojtech Pavlik, linux-api-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On Sat, 31 Oct 2015, Chris J Arges wrote:
> Makes sense to me. Is there a reason why the sysfs entries are visible
> to non-root users?
Well, kptr_restrict applies only to values printed using '%pK'. So if the
sysfs handler is using other printk() format string to print the pointer,
it'll be leaked out (and should eventually be fixed).
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: livepatch: old_name@old_addr scheme in livepatch sysfs directory
[not found] ` <alpine.LNX.2.00.1511010958430.17538-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
@ 2015-11-02 9:08 ` Jessica Yu
0 siblings, 0 replies; 5+ messages in thread
From: Jessica Yu @ 2015-11-02 9:08 UTC (permalink / raw)
To: Jiri Kosina
Cc: Chris J Arges, live-patching-u79uwXL29TY76Z2rM5mHXA,
Josh Poimboeuf, Seth Jennings, Vojtech Pavlik,
linux-api-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
+++ Jiri Kosina [01/11/15 10:07 +0100]:
>On Sat, 31 Oct 2015, Chris J Arges wrote:
>
>> Makes sense to me. Is there a reason why the sysfs entries are visible
>> to non-root users?
>
>Well, kptr_restrict applies only to values printed using '%pK'. So if the
>sysfs handler is using other printk() format string to print the pointer,
>it'll be leaked out (and should eventually be fixed).
Hm, I think the func.n solution might be a good temporary fix for now.
Even if we do go with func@addr and use the '%pK' format specifier we
will run into the same problem at kptr_restrict == 2.
Jessica
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-11-02 9:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-31 3:44 [PATCH] livepatch: old_name@old_addr scheme in livepatch sysfs directory Chris J Arges
[not found] ` <1446263060-22175-1-git-send-email-chris.j.arges-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2015-11-01 1:53 ` Jessica Yu
2015-11-01 4:01 ` Chris J Arges
[not found] ` <56358EA4.10900-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2015-11-01 9:07 ` Jiri Kosina
[not found] ` <alpine.LNX.2.00.1511010958430.17538-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2015-11-02 9:08 ` Jessica Yu
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 NNTP newsgroup(s).