Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1341215
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC v2 2/7] tables.h: add linker table support |
| Date | 2016-02-24 02:00 +0100 |
| Message-ID | <r5vY7-54n-17@gated-at.bofh.it> (permalink) |
| References | (3 earlier) <r4162-3e8-7@gated-at.bofh.it> <r5ufE-44a-11@gated-at.bofh.it> <r5uyZ-4cb-15@gated-at.bofh.it> <r5uIG-4hX-19@gated-at.bofh.it> <r5vln-4Oy-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Feb 23, 2016 at 04:06:55PM -0800, H. Peter Anvin wrote:
> On 02/23/2016 03:36 PM, Luis R. Rodriguez wrote:
> >
> >> 4. the only useful operator on a range is "is address X inside this
> >> range"; this operator is likely *not* useful for a table, since
^^^^^^^^^^^^
> >> if you have to ever invoke it you are probably doing something very
> >> wrong.
> >
> > kprobe uses it :P
> >
>
> Could you explain how?
Sorry I misread this as "unless you are a table", kprobes has two
ranges, one is a table (blacklist) and the other just a range
(for kprobes); only kprobes uses "address inside this range",
as reflected below. So I agree with you.
index d10ab6b9b5e0..d816c659f358 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1328,8 +1328,7 @@ out:
bool __weak arch_within_kprobe_blacklist(unsigned long addr)
{
/* The __kprobes marked functions and entry code must not be probed */
- return addr >= (unsigned long)__kprobes_text_start &&
- addr < (unsigned long)__kprobes_text_end;
+ return LINKTABLE_ADDR_WITHIN(kprobes, addr);
}
bool within_kprobe_blacklist(unsigned long addr)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index d10ab6b9b5e0..d816c659f358 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1328,8 +1328,7 @@ out:
bool __weak arch_within_kprobe_blacklist(unsigned long addr)
{
/* The __kprobes marked functions and entry code must not be probed */
- return addr >= (unsigned long)__kprobes_text_start &&
- addr < (unsigned long)__kprobes_text_end;
+ return LINKTABLE_ADDR_WITHIN(kprobes, addr);
}
What about rebranding general section primitives under section.h
#define DECLARE_SECTION_TEXT_TYPE(type, name) \
extern const type name[], name##__end[];
#define DECLARE_SECTION_TEXT(name) \
DECLARE_SECTION_TEXT_TYPE(char, name)
Then tables.h would use the TYPE version:
#define DECLARE_LINKTABLE_TEXT(type, name) \
DECLARE_SECTION_TEXT_TYPE(type, name)
Since I've been making _TEXT the implicit type for section names(SECTION_INIT
is .init.text) the above could just be DECLARE_SECTION_TYPE() and DECLARE_SECTION()
for text if we prefer.
Luis
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [RFC v2 2/7] tables.h: add linker table support "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-02-24 00:10 +0100
Re: [RFC v2 2/7] tables.h: add linker table support "H. Peter Anvin" <hpa@zytor.com> - 2016-02-24 00:30 +0100
Re: [RFC v2 2/7] tables.h: add linker table support "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-02-24 00:40 +0100
Re: [RFC v2 2/7] tables.h: add linker table support "H. Peter Anvin" <hpa@zytor.com> - 2016-02-24 01:20 +0100
Re: [RFC v2 2/7] tables.h: add linker table support "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-02-24 02:00 +0100
csiph-web