Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp666103ybg; Mon, 1 Jun 2020 11:09:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCNfTM9edwQErQeUVblY3gAfI0TyLLueJhTDOVhJbhjnMQZYPkAEFqLG3HqNz7QpBHvFsW X-Received: by 2002:a17:906:2a4d:: with SMTP id k13mr21134235eje.253.1591034986605; Mon, 01 Jun 2020 11:09:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591034986; cv=none; d=google.com; s=arc-20160816; b=VM0FAtYvkKyg/oz/AjPWnqPSvlm5gmtE+IcimlL7YlfZkYfoYRzfPQqEKfKlBz0t4c canH4g52Ltj2/NlkutDo3mTV5P/xoQLuSdHDZLTQUi0m26rHIj+1raDFIjMS8ftc0i0x 7h6G1UTqW0cYhVMneHEQWqcV+FmlAC86V5bfnJOuJwQTYAWIPnbBZNqrYN+CQQUlHqzZ XOkG6k2jJGgPEW1A/iSrg8oUq5vFqbb1ax66KrTfMP2m7+EDdySE91DyQoN4b6zHZ3fL tGrWKvKjUXh7nFk8PyDtbwghvbhu4ZZOvX1j8d1rpKvMnne7kPHrLarBH4gnb03Lws0n 1mVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=osjdztueMuaAwG61qi79PUuaa4pVp/qOeP56bfj88L4=; b=J4HTtSDCrgGmx/9YqjiS9bhIYzdnCE82RLxG206XQl3t/UzphxM+rfPdqcRATbgLWw r2VQu+5ftjnJPke+y5NX60pgjPfHBOfUKux+H6eZeZZRjb4CzYayEaVrQY3dGsgCFikn YXEIcn1BcEnzwL8/pg88F0P4UzgXVWlXhao/NluSMMxsEAz2bburUe5edcsxZhkBWQsY l8kZc8+z8DYWyUNvkvGNb9dUFQf+QSrqByA4ndu1udhKY7rSWhcxaQAylBpZbaHCw/5e HF+dXuugBGYwsrt9GBRC4KvSKWYL3UT6rmceXy93APXt/dfu887iqkSXmfl9hia8nZAR 8S0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XWHuT2rA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rk18si111120ejb.715.2020.06.01.11.09.23; Mon, 01 Jun 2020 11:09:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XWHuT2rA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730436AbgFASGR (ORCPT + 99 others); Mon, 1 Jun 2020 14:06:17 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:43391 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730370AbgFASFv (ORCPT ); Mon, 1 Jun 2020 14:05:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591034749; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=osjdztueMuaAwG61qi79PUuaa4pVp/qOeP56bfj88L4=; b=XWHuT2rApHW2jLm8wOesofWZh+6w5A1BNR4c6B+T0VB5j4sBMF0n0yilJfj6FdkFX2fQRK NUW85ydYkemkbMc0V1FS4wcKDHGF9MGHvi2VIUCX4NVHFPkmQr21sbEKnT0xpYuX6OwGKl vfMaLTq7sl/HBGtyhBpBr0XIdA9AxTg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-1-ayfnyAN1PO6nfg34SZesjA-1; Mon, 01 Jun 2020 14:05:47 -0400 X-MC-Unique: ayfnyAN1PO6nfg34SZesjA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8DF86107B266; Mon, 1 Jun 2020 18:05:45 +0000 (UTC) Received: from treble (ovpn-116-170.rdu2.redhat.com [10.10.116.170]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D44F11002394; Mon, 1 Jun 2020 18:05:40 +0000 (UTC) Date: Mon, 1 Jun 2020 13:05:38 -0500 From: Josh Poimboeuf To: "Wangshaobo (bobo)" Cc: huawei.libin@huawei.com, xiexiuqi@huawei.com, cj.chengjian@huawei.com, mingo@redhat.com, x86@kernel.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, mbenes@suse.cz, devel@etsukata.com, viro@zeniv.linux.org.uk, esyr@redhat.com Subject: Re: Question: livepatch failed for new fork() task stack unreliable Message-ID: <20200601180538.o5agg5trbdssqken@treble> References: <20200529101059.39885-1-bobo.shaobowang@huawei.com> <20200529174433.wpkknhypx2bmjika@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 30, 2020 at 10:21:19AM +0800, Wangshaobo (bobo) wrote: > 1) when a user mode task just fork start excuting ret_from_fork() till > schedule_tail, unwind_next_frame found > > orc->sp_reg is ORC_REG_UNDEFINED but orc->end not equals zero, this time > arch_stack_walk_reliable() > > terminates it's backtracing loop for unwind_done() return true. then 'if > (!(task->flags & (PF_KTHREAD | PF_IDLE)))' > > in arch_stack_walk_reliable() true and return -EINVAL after. > > * The stack trace looks like that: > > ret_from_fork > >       -=> UNWIND_HINT_EMPTY > >       -=> schedule_tail             /* schedule out */ > >       ... > >       -=> UNWIND_HINT_REGS      /*  UNDO */ Yes, makes sense. > 2) when using call_usermodehelper_exec_async() to create a user mode task, > ret_from_fork() still not exec whereas > > the task has been scheduled in __schedule(), at this time, orc->sp_reg is > ORC_REG_UNDEFINED but orc->end equals zero, > > unwind_error() return true and also terminates arch_stack_walk_reliable()'s > backtracing loop, end up return from > > 'if (unwind_error())' branch. > > * The stack trace looks like that: > > -=> call_usermodehelper_exec > >                  -=> do_exec > >                            -=> search_binary_handler > >                                       -=> load_elf_binary > >                                                 -=> elf_map > >                                                          -=> vm_mmap_pgoff > > -=> down_write_killable > > -=> _cond_resched > >              -=> __schedule           /* scheduled to work */ > > -=> ret_from_fork       /* UNDO */ I don't quite follow the stacktrace, but it sounds like the issue is the same as the first one you originally reported: > 1) The task was not actually scheduled to excute, at this time > UNWIND_HINT_EMPTY in ret_from_fork() has not reset unwind_hint, it's > sp_reg and end field remain default value and end up throwing an error > in unwind_next_frame() when called by arch_stack_walk_reliable(); Or am I misunderstanding? And to reiterate, these are not "livepatch failures", right? Livepatch doesn't fail when stack_trace_save_tsk_reliable() returns an error. It recovers gracefully and tries again later. -- Josh