Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932433Ab3GLAui (ORCPT ); Thu, 11 Jul 2013 20:50:38 -0400 Received: from mail9.hitachi.co.jp ([133.145.228.44]:39439 "EHLO mail9.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932251Ab3GLAub (ORCPT ); Thu, 11 Jul 2013 20:50:31 -0400 Message-ID: <51DF52D4.20500@hitachi.com> Date: Fri, 12 Jul 2013 09:50:28 +0900 From: Masami Hiramatsu Organization: Hitachi, Ltd., Japan User-Agent: Mozilla/5.0 (Windows NT 5.2; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Jiri Kosina Cc: Steven Rostedt , Jason Baron , "H. Peter Anvin" , Borislav Petkov , linux-kernel@vger.kernel.org Subject: Re: [RFC] [PATCH 1/2 v2] x86: introduce int3-based instruction patching References: <51DE8799.9020904@hitachi.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1253 Lines: 43 (2013/07/11 19:51), Jiri Kosina wrote: >>> + * - update all but the first byte of the patched range >>> + * - sync cores >>> + * - replalace the first byte (int3) by the first byte of >>> + * replacing opcode >>> + * - sync cores >>> + * >>> + * Note: must be called under text_mutex. >>> + */ >>> +void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler) >>> +{ >>> + unsigned char int3 = 0xcc; >>> + >> >> Here, you have to protect this code from others, since bp_* are >> global. > > Caller is responsible for holding the text_mutex, so text_poke_bp() can't > race with itself. And the proper consistency between text_poke_bp() and > the notifier is achieved by the memory barriers. Oops, right. I missed your "Note" line > > So what exact scenario do you have in mind here, please? No, never mind... Thank you, -- Masami HIRAMATSU IT Management Research Dept. Linux Technology Center Hitachi, Ltd., Yokohama Research Laboratory E-mail: masami.hiramatsu.pt@hitachi.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/