From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D923AC77B61 for ; Mon, 24 Apr 2023 11:08:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231452AbjDXLI6 (ORCPT ); Mon, 24 Apr 2023 07:08:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231203AbjDXLI4 (ORCPT ); Mon, 24 Apr 2023 07:08:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F33CE210A for ; Mon, 24 Apr 2023 04:08:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682334491; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Dp8THvRtHWbI7oq8asUizkVUk3mdmGjgjj7UOLbkef8=; b=F1Z7kjAnXH8xHf6mT1rs2AyKc59/XOPngC2brEn7tARjQhmPhfRq7Ev2pdiXA3ZKHNW1Ex 52qD1/Q3o1G74DcHOy6vbCweFBRw3DBJ7Z5xJc0Y7+qvtkmG7JfjVQoO9NNEsrpGmAytjG zsVbZRNykZLTHqg1LZrrlZ97XXvjA24= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-609-WcO18q13Od6hIVflrwyiCw-1; Mon, 24 Apr 2023 07:08:05 -0400 X-MC-Unique: WcO18q13Od6hIVflrwyiCw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 56AE91C0878A; Mon, 24 Apr 2023 11:08:05 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.226.225]) by smtp.corp.redhat.com (Postfix) with SMTP id 844FF492B03; Mon, 24 Apr 2023 11:08:01 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 24 Apr 2023 13:07:54 +0200 (CEST) Date: Mon, 24 Apr 2023 13:07:50 +0200 From: Oleg Nesterov To: Tiezhu Yang Cc: Bagas Sanjaya , Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, Srikar Dronamraju Subject: Re: [PATCH] MIPS: uprobes: Restore thread.trap_nr Message-ID: <20230424110750.GA11631@redhat.com> References: <1682213883-3654-1-git-send-email-yangtiezhu@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/23, Tiezhu Yang wrote: > > Cc: > Oleg Nesterov > Srikar Dronamraju > > On 04/23/2023 11:08 AM, Bagas Sanjaya wrote: > >On Sun, Apr 23, 2023 at 09:38:03AM +0800, Tiezhu Yang wrote: > >>thread.trap_nr is saved in arch_uprobe_pre_xol(), it should be restored > >>in arch_uprobe_{post,abort}_xol() accordingly, actually it was only done > >>in the post function, just do it in the abort function too, this change > >>is similar with x86 and powerpc. > > > >I'm confused (please fix up grammar, spelling, and punctuation). Can you > >explain why thread.trap_nr should be restored somewhere else? Also, what > >x86/powerpc changes as reference? > > > > Here is the related first commit for x86 in 2012: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0326f5a94dde > > When xol insn itself triggers the signal, restart the original insn, > in this case, UTASK_SSTEP_TRAPPED is set [1], it does *abort_xol() > instead of *post_xol() [2], then should do the restore operations. Yes... for example, if the uprobed task was killed abort() should restore the state and (in particular) change ->trap_nr from UPROBE_TRAP_NR back to ->saved_trap_nr. So the patch looks fine to me. Oleg.