Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp967605ybg; Wed, 3 Jun 2020 19:45:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO+UrVe7JljYVpcFqRDzQoYsePdulYXcoLXc3b+Vr8AXLTPKhIoEBK4Ec/IDOKYfw8L+ey X-Received: by 2002:aa7:c944:: with SMTP id h4mr2208052edt.383.1591238708640; Wed, 03 Jun 2020 19:45:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591238708; cv=none; d=google.com; s=arc-20160816; b=nFNhEAk6hAz/ozF70bznL3uQ0ZRt0xbkbncGmJIE3tdhMIqenS8eAKZbGGQeJGOHAV 94o71e5uTt5BilEoPPHgDPFTHZsgB+XDkaSnfrtmSEMjrInuI3pJgV/O32TZKWIrB9ZX GB0e41yKOEGHbejF/nfhE033DY8yg9kweEJuPBab7JFTk5byhfTsiPea7W61OsdLBnod cr+uTj7RNQDPG9JlYslg1XRru/9ThGV3tRkcAefBhUp7ikbLdxx6hYzz5T9wKld2+RYF vHDikMyYfRt28loWjjm+wTHLBuEXME+suE3EnC/B1ycGjgyAenKeGvMdHlsvyEzIumBt nsgQ== 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=yd4542Fh+4FYtypVVwxlbTi97DfvciD+WPtx97gNYhs=; b=W4eKg6LstAtjmGYWczSt32EVc3bjbTrX+132dK9zzw/GN52+1fPJ4C2MHWaKMlqYgw qlVLR8Xr50XBsuCP4MXLsuEp2ZQffn+ZOnKGxrKKrPAHKcEB+0RVP5aAtAOGLfGFfMgC uXE/wxuIdAGM6uEQvanIyEz96Ld+UgcXrph78IQRD57cQkpOJTNJL2TSEJ0XguKoTqv5 w4XXrGR36ySXb7CiQWgQBKVjh/h89ku5wTo3L79psujidMJ8izacU2EOzvzdnXO7NhId vCD6k55RqzPqRnyv6LYOhTyXGsRHZZhzZijXpFL9LEmPtipY87+rf7jw8ho+e6yUqrWq VCeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OaAdvv8o; 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 y6si820968edu.513.2020.06.03.19.44.45; Wed, 03 Jun 2020 19:45:08 -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=OaAdvv8o; 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 S1726887AbgFDClK (ORCPT + 99 others); Wed, 3 Jun 2020 22:41:10 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:54189 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726047AbgFDClI (ORCPT ); Wed, 3 Jun 2020 22:41:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591238466; 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=yd4542Fh+4FYtypVVwxlbTi97DfvciD+WPtx97gNYhs=; b=OaAdvv8ovBLiSL6NgG2Hsi//d/uqKaDOdA4BFmCJdjyflX+eOGjVeXc7LmWNrIu+z0sT7p fKErTkz9pvYNojLfzK8x8aNt9pvfWSscoiK23HTvKYxsMQzla6A5HQDT0AmeG2aCXjAr54 adlBLmBrshv6UuW12gz093WPIPtuBks= 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-64-H713mFUsOtiEv0pmf7nX3g-1; Wed, 03 Jun 2020 22:41:02 -0400 X-MC-Unique: H713mFUsOtiEv0pmf7nX3g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9D3291883600; Thu, 4 Jun 2020 02:41:00 +0000 (UTC) Received: from treble (ovpn-116-170.rdu2.redhat.com [10.10.116.170]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E5C62DE71; Thu, 4 Jun 2020 02:40:53 +0000 (UTC) Date: Wed, 3 Jun 2020 21:40:51 -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: <20200604024051.6ovbr6tbrowwg6jr@treble> References: <20200529101059.39885-1-bobo.shaobowang@huawei.com> <20200529174433.wpkknhypx2bmjika@treble> <20200601180538.o5agg5trbdssqken@treble> <20200602131450.oydrydelpdaval4h@treble> <1353648b-f3f7-5b8d-f0bb-28bdb1a66f0f@huawei.com> <20200603153358.2ezz2pgxxxld7mj7@treble> <2225bc83-95f2-bf3d-7651-fdd10a3ddd00@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2225bc83-95f2-bf3d-7651-fdd10a3ddd00@huawei.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 04, 2020 at 09:24:55AM +0800, Wangshaobo (bobo) wrote: > > 在 2020/6/3 23:33, Josh Poimboeuf 写道: > > On Wed, Jun 03, 2020 at 10:06:07PM +0800, Wangshaobo (bobo) wrote: > > To be honest, I don't remember what I meant by sibling calls. They > > don't even leave anything on the stack. > > > > For noreturns, the code might be laid out like this: > > > > func1: > > ... > > call noreturn_foo > > func2: > > > > func2 is immediately after the call to noreturn_foo. So the return > > address on the stack will actually be 'func2'. We want to retrieve the > > ORC data for the call instruction (inside func1), instead of the > > instruction at the beginning of func2. > > > > I should probably update that comment. > > So, I want to ask is there any side effects if i modify like this ? this > modification is based on > > your fix. It looks like ok with proper test. > > diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c > index e9cc182aa97e..ecce5051e8fd 100644 > --- a/arch/x86/kernel/unwind_orc.c > +++ b/arch/x86/kernel/unwind_orc.c > @@ -620,6 +620,7 @@ void __unwind_start(struct unwind_state *state, struct > task_struct *task, >                 state->sp = task->thread.sp; >                 state->bp = READ_ONCE_NOCHECK(frame->bp); >                 state->ip = READ_ONCE_NOCHECK(frame->ret_addr); > +              state->signal = ((void *)state->ip == ret_from_fork); >         } > > diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c > index 7f969b2d240f..d7396431261a 100644 > --- a/arch/x86/kernel/unwind_orc.c > +++ b/arch/x86/kernel/unwind_orc.c > @@ -540,7 +540,7 @@ bool unwind_next_frame(struct unwind_state *state) >          state->sp = sp; >          state->regs = NULL; >          state->prev_regs = NULL; > -        state->signal = ((void *)state->ip == ret_from_fork); > +        state->signal = false; >          break; Yes that's correct. -- Josh