From: Alexander van Heukelum <heukelum@mailshack.com>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Jan Beulich <jbeulich@novell.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] x86: KPROBE_ENTRY should be paired wth KPROBE_END
Date: Sun, 23 Nov 2008 16:04:18 +0100 [thread overview]
Message-ID: <20081123150418.GA32078@mailshack.com> (raw)
In-Reply-To: <20081123141237.GI24818@localhost>
On Sun, Nov 23, 2008 at 05:12:37PM +0300, Cyrill Gorcunov wrote:
> [Cyrill Gorcunov - Sun, Nov 23, 2008 at 04:51:34PM +0300]
> | [Ingo Molnar - Sun, Nov 23, 2008 at 02:27:52PM +0100]
> | |
> | | * Alexander van Heukelum <heukelum@mailshack.com> wrote:
> | |
> | | > Impact: moves some code out of .kprobes.text
> | | >
> | | > KPROBE_ENTRY switches code generation to .kprobes.text, and KPROBE_END
> | | > uses .popsection to get back to the previous section (.text, normally).
> | | > Also replace ENDPROC by END, for consistency.
> | | >
> | | > Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
> | |
> | | applied to tip/x86/irq, thanks Alexander!
> | |
> | | > One more small change for today. The xen-related functions
> | | > xen_do_hypervisor_callback and xen_failsafe_callback are put
> | | > in the .kprobes.text even in the current kernel: ignore_sysret
> | | > is enclosed in KPROBE_ENTRY / ENDPROC, instead of KPROBE_ENTRY /
> | | > KPROBE_END, but I guess the situation is harmless.
> | |
> | | yeah. It narrows no-kprobes protection for that code, but it should
> | | indeed be fine (and that's the intention as well).
> | |
> | | Note that this is a reoccuring bug type, and rather long-lived. Can
> | | you think of any way to get automated nesting protection of both the
> | | .cfi_startproc/endproc macros and kprobes start/end? A poor man's
> | | solution would be to grep the number of start and end methods and
> | | enforce that they are equal.
> | |
> | | Ingo
> | |
> |
> | I think we could play with preprocessor and check if ENTRY/END matches.
> | Looking now.
> |
> | - Cyrill -
>
> Here is what I've done
>
> 1) Add some macros like:
>
> .macro __set_entry
> .set _ENTRY_IN, 1
> .endm
>
> .macro __unset_entry
> .set _ENTRY_IN, 0
> .endm
>
> .macro __check_entry
> .ifeq _ENTRY_IN
> .error "END should be used"
> .abort
> .endif
> .endm
>
> So the code
>
> ENTRY(mcount)
> __unset_entry
> retq
> __check_entry
> END(mcount)
Looks like a good approach to me. But I assume the ENTRY cppmacro
will include magic?
Greetings,
Alexander
> will fail like
>
> cyrill@lenovo linux-2.6.git $ make arch/x86/kernel/entry_64.o
> CHK include/linux/version.h
> CHK include/linux/utsrelease.h
> SYMLINK include/asm -> include/asm-x86
> CALL scripts/checksyscalls.sh
> AS arch/x86/kernel/entry_64.o
> arch/x86/kernel/entry_64.S: Assembler messages:
> arch/x86/kernel/entry_64.S:84: Error: END should be used
> arch/x86/kernel/entry_64.S:84: Fatal error: .abort detected. Abandoning ship.
> make[1]: *** [arch/x86/kernel/entry_64.o] Error 1
> make: *** [arch/x86/kernel/entry_64.o] Error 2
> cyrill@lenovo linux-2.6.git $
>
> So if such an approach is acceptable (in general) -- I could take a more
> deeper look. So every ENTRY would check if other ENTRY/KPROBE is active
> and report that.
>
> - Cyrill -
next prev parent reply other threads:[~2008-11-23 15:05 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-16 14:29 [PATCH] trivial, entry_64: remove whitespace at end of lines Alexander van Heukelum
2008-11-16 14:29 ` [RFC] x86: save_args out of line Alexander van Heukelum
2008-11-17 12:14 ` Glauber Costa
2008-11-17 15:13 ` Alexander van Heukelum
2008-11-17 12:53 ` Andi Kleen
2008-11-17 15:37 ` Alexander van Heukelum
2008-11-17 18:23 ` Andi Kleen
2008-11-17 19:22 ` Cyrill Gorcunov
2008-11-17 19:29 ` Cyrill Gorcunov
2008-11-17 19:49 ` Alexander van Heukelum
2008-11-17 19:54 ` Cyrill Gorcunov
2008-11-17 19:43 ` Alexander van Heukelum
2008-11-17 19:49 ` Cyrill Gorcunov
2008-11-17 17:52 ` [RFC,v2] x86_64: " Alexander van Heukelum
2008-11-18 8:09 ` Jan Beulich
2008-11-18 11:16 ` Alexander van Heukelum
2008-11-18 12:51 ` Jan Beulich
2008-11-18 14:03 ` Ingo Molnar
2008-11-18 14:52 ` Jan Beulich
2008-11-18 15:00 ` Ingo Molnar
2008-11-18 22:53 ` Roland McGrath
2008-11-18 23:35 ` Andi Kleen
2008-11-18 23:36 ` Jeremy Fitzhardinge
2008-11-18 23:44 ` H. Peter Anvin
2008-11-19 0:08 ` Jeremy Fitzhardinge
2008-11-18 23:45 ` Roland McGrath
2008-11-19 0:06 ` Andi Kleen
2008-11-19 0:01 ` H. Peter Anvin
2008-11-19 10:34 ` Ingo Molnar
2008-11-19 20:09 ` Ingo Molnar
2008-11-19 0:18 ` [PATCH/RFC] Move entry_64.S register saving out of the macros Alexander van Heukelum
2008-11-19 17:54 ` H. Peter Anvin
2008-11-19 20:16 ` Ingo Molnar
2008-11-20 13:40 ` [PATCH] x86: clean up after: move " Alexander van Heukelum
2008-11-20 14:01 ` Andi Kleen
2008-11-20 15:04 ` Ingo Molnar
2008-11-20 15:26 ` Alexander van Heukelum
2008-11-20 15:39 ` Ingo Molnar
2008-11-20 15:50 ` [PATCH] x86: clean up after: move entry_64.S register savingout " Jan Beulich
2008-11-20 15:57 ` [PATCH] x86: clean up after: move entry_64.S register saving out " Alexander van Heukelum
2008-11-20 16:07 ` Cyrill Gorcunov
2008-11-20 16:29 ` Alexander van Heukelum
2008-11-20 17:24 ` Ingo Molnar
2008-11-21 15:41 ` [PATCH] x86: Introduce save_rest and restructure the PTREGSCALL macro in entry_64.S Alexander van Heukelum
2008-11-21 15:43 ` [PATCH] x86: entry_64.S: Factor out save_paranoid and paranoid_exit Alexander van Heukelum
2008-11-21 15:44 ` [PATCH] Split out some macro's and move common code to paranoid_exit Alexander van Heukelum
2008-11-21 16:06 ` Ingo Molnar
2008-11-23 9:08 ` [PATCH] x86: include ENTRY/END in entry handlers in entry_64.S Alexander van Heukelum
2008-11-23 9:15 ` [PATCH] x86: KPROBE_ENTRY should be paired wth KPROBE_END Alexander van Heukelum
2008-11-23 13:27 ` Ingo Molnar
2008-11-23 13:51 ` Cyrill Gorcunov
2008-11-23 14:12 ` Cyrill Gorcunov
2008-11-23 14:55 ` Ingo Molnar
2008-11-23 15:04 ` Cyrill Gorcunov
2008-11-23 15:04 ` Alexander van Heukelum [this message]
2008-11-23 15:12 ` Cyrill Gorcunov
2008-11-23 15:31 ` Ingo Molnar
2008-11-23 15:41 ` Cyrill Gorcunov
2008-11-23 15:37 ` Cyrill Gorcunov
2008-11-23 16:29 ` Ingo Molnar
2008-11-24 9:17 ` Jan Beulich
2008-11-24 10:26 ` Alexander van Heukelum
2008-11-24 10:35 ` Jan Beulich
2008-11-24 12:24 ` [PATCH] x86_64: get rid of the use of KPROBE_ENTRY / KPROBE_END Alexander van Heukelum
2008-11-24 13:33 ` Jan Beulich
2008-11-24 14:38 ` [PATCH] i386: " Alexander van Heukelum
2008-11-23 9:21 ` [PATCH] x86: include ENTRY/END in entry handlers in entry_64.S Cyrill Gorcunov
2008-11-23 11:23 ` Alexander van Heukelum
2008-11-23 11:35 ` Cyrill Gorcunov
2008-11-23 20:13 ` H. Peter Anvin
2008-11-24 10:06 ` Alexander van Heukelum
2008-11-24 18:07 ` H. Peter Anvin
2008-11-23 13:23 ` Ingo Molnar
2008-11-17 9:47 ` [PATCH] trivial, entry_64: remove whitespace at end of lines Ingo Molnar
2008-11-17 15:14 ` Alexander van Heukelum
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=20081123150418.GA32078@mailshack.com \
--to=heukelum@mailshack.com \
--cc=gorcunov@gmail.com \
--cc=hpa@zytor.com \
--cc=jbeulich@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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 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).