[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5294F10C.8060901@amacapital.net>
Date: Tue, 26 Nov 2013 11:05:48 -0800
From: Andy Lutomirski <luto@...capital.net>
To: Andi Kleen <andi@...stfloor.org>, linux-kernel@...r.kernel.org
CC: torvalds@...ux-foundation.org, x86@...nel.org,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH] Add a text_poke syscall v2
On 11/25/2013 04:37 PM, Andi Kleen wrote:
> From: Andi Kleen <ak@...ux.intel.com>
>
> [Addressed all addressable review feedback in v2]
>
> Properly patching running code ("cross modification")
> is a quite complicated business on x86.
>
> The CPU has specific rules that need to be followed, including
> multiple global barriers.
>
> Self modifying code is getting more popular, so it's important
> to make it easy to follow the rules.
>
> The kernel does it properly with text_poke_bp(). But the same
> method is hard to do for user programs.
>
> This patch adds a (x86 specific) text_poke() syscall that exposes
> the text_poke_bp() machinery to user programs.
>
> The interface is practically the same as text_poke_bp, just as
> a syscall. I added an extra flags parameter, for future
> extension. Right now it is enforced to be 0.
>
> The call also still has a global lock, so it has some scaling
> limitations. If it was commonly used this could be fixed
> by setting up a list of break point locations. Then
> a lock would only be hold to modify the list.
>
> Right now the implementation is just as simple as possible.
IIRC someone proposed that, rather than specifying a "handler", that any
user thread that traps just wait until the poke completes. This would
complicate the kernel implementation a bit, but it would make the user
code a good deal simpler. Is there any reason that this is a bad idea?
--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists