From patchwork Tue Oct 29 15:40:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Nesterov X-Patchwork-Id: 3108741 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 99CB3BF924 for ; Tue, 29 Oct 2013 15:39:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 65FFB2037A for ; Tue, 29 Oct 2013 15:39:00 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 17E552034E for ; Tue, 29 Oct 2013 15:38:59 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VbBNf-0006hw-3e; Tue, 29 Oct 2013 15:38:55 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VbBNc-0004Dn-KR; Tue, 29 Oct 2013 15:38:52 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VbBNZ-0004D8-JG for linux-arm-kernel@lists.infradead.org; Tue, 29 Oct 2013 15:38:49 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9TFcPsL009567 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 29 Oct 2013 11:38:26 -0400 Received: from tranklukator.brq.redhat.com (dhcp-1-188.brq.redhat.com [10.34.1.188]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id r9TFcN23032200; Tue, 29 Oct 2013 11:38:24 -0400 Received: by tranklukator.brq.redhat.com (nbSMTP-1.00) for uid 500 oleg@redhat.com; Tue, 29 Oct 2013 16:40:09 +0100 (CET) Date: Tue, 29 Oct 2013 16:40:06 +0100 From: Oleg Nesterov To: David Long Subject: Re: [PATCH v2 03/13] uprobes: allow arch access to xol slot Message-ID: <20131029154006.GA22344@redhat.com> References: <1381871068-27660-1-git-send-email-dave.long@linaro.org> <1381871068-27660-4-git-send-email-dave.long@linaro.org> <20131019163627.GA7837@redhat.com> <52671265.2020107@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <52671265.2020107@linaro.org> User-Agent: Mutt/1.5.18 (2008-05-17) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131029_113849_762802_D5D1D17F X-CRM114-Status: GOOD ( 17.13 ) X-Spam-Score: -7.4 (-------) Cc: "Jon Medhurst \(Tixy\)" , Srikar Dronamraju , linux-kernel@vger.kernel.org, Rabin Vincent , Ingo Molnar , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 10/22, David Long wrote: > > On 10/19/13 12:36, Oleg Nesterov wrote: >> >> How about >> >> void __weak arch_uprobe_xol_copy(...) >> { >> copy_to_page(...); >> } >> >> then just >> >> - copy_to_page(...); >> + arch_uprobe_xol_copy(...); >> >> ? >> > > I was trying to avoid duplicating the VM calls in the > architecture-specific implementations, Yes, I understand... But this uglifies the generic code. > but maybe that is the cleaner way > to do it after all. I've made changes as suggested above. Thanks. and this uglifies arm code I guess ;) David. Perhaps we can avoid the new hook altogether? What if we do the simple change below (it ignores powerpc) ? Then arm can add "unsigned long ixol[2]" into its arch_uprobe, and arch_uprobe_analyze_insn() can initialize this member correctly. What do you think? Oleg. --- x/arch/x86/include/asm/uprobes.h +++ x/arch/x86/include/asm/uprobes.h @@ -35,7 +35,10 @@ typedef u8 uprobe_opcode_t; struct arch_uprobe { u16 fixups; - u8 insn[MAX_UINSN_BYTES]; + union { + u8 insn[MAX_UINSN_BYTES]; + u8 ixol[MAX_UINSN_BYTES]; + } #ifdef CONFIG_X86_64 unsigned long rip_rela_target_address; #endif --- x/kernel/events/uprobes.c +++ x/kernel/events/uprobes.c @@ -1264,7 +1264,8 @@ static unsigned long xol_get_insn_slot(s return 0; /* Initialize the slot */ - copy_to_page(area->page, xol_vaddr, uprobe->arch.insn, MAX_UINSN_BYTES); + copy_to_page(area->page, xol_vaddr, + uprobe->arch.ixol, sizeof(uprobe->arch.ixol)); /* * We probably need flush_icache_user_range() but it needs vma. * This should work on supported architectures too.