Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1636452pxp; Thu, 17 Mar 2022 13:15:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJj+MhMNzWLUubiwnIb3ueai01XWTfuF2F0+H94ubHBiD5Ay4kzPMBKZF1lWlt4vRGAwhp X-Received: by 2002:a17:903:11c9:b0:151:888b:e1f with SMTP id q9-20020a17090311c900b00151888b0e1fmr6899205plh.78.1647548158535; Thu, 17 Mar 2022 13:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647548158; cv=none; d=google.com; s=arc-20160816; b=e/g7YIE7ZwSqA9WEzLLU/2s7K0ukOpgFAEQNwReyjqDMK8stfFU0xHZDHjUnPylXGJ +esZETPXWB/wwMDhf3gqoR9nrqAC6nRGw8rj54X7S7eU309C30+oP5P5RaZ7WbTISdnW panD+/q1YVduBnSWZfRPMtcuxk5Gwl09Lws1mQftT7q1Z8mjvQZDLqD7Nlt/9CwOGkLY EGT2ngvlucvr+HuMmNfiVr5E2yEMzJ596d+MIOv4sHFVEzZXvqTNu2EKXdN5ur1k92AL hzizev4RsAKRQxh4acC3yW0ZDJtqiTmOD8GMy2+xnqP/KoZPAvNvBF13rIb0cYjzvsls wT8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=qyvEicvZsthPeXhIK1mEJ7p6TnH+7Rc2hbOq6UcgGIo=; b=UetpWOM5ulbJ0XNPJi1Z9LEvIl86toYO8GiX1DMG5d7hdMfeHRvTaLEF2gp20U+elu VuXdBhuPDTOAV1d1move2H8ndLP8zeuIIHtiaj8gZAU//kuIftQyklHmjWAd5V8CCFWY Uk4aGZUC0SOwRXop/yReG0meqDdRp0kijO6m059XK6EOTREltrLQfQv1y9rgpBShjpsF ZVzKyU43SvOLc03Aruc6GBz5d43lVUqMvf6IwzUSjE6i77W0kHrhhq0rr0+DXYCHy6V8 V62BxyNCyXyR7pthu6cuDBlEvrhlJxvtoKDro49GSoPzzF8OGeM12GjKlPDvWjeBKHxm 61YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GajNlf5N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q38-20020a63f966000000b003816043f03csi3152640pgk.561.2022.03.17.13.15.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 13:15:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GajNlf5N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 12CBCFABD3; Thu, 17 Mar 2022 12:58:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236535AbiCQSKi (ORCPT + 99 others); Thu, 17 Mar 2022 14:10:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237194AbiCQSKW (ORCPT ); Thu, 17 Mar 2022 14:10:22 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 946C812B749 for ; Thu, 17 Mar 2022 11:09:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647540544; 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=qyvEicvZsthPeXhIK1mEJ7p6TnH+7Rc2hbOq6UcgGIo=; b=GajNlf5N4ofj0Jnoud0jF2CVeCfivuSnqnx46Lm2gD00LQdKwik2I/ud2Ip0dDBjf5aFHX eCghit4Iv5Oems6XzuqCClgDFqDhiKTE5sCHSLYhV1TrumTntQaPNL/sWF49/Cm2OPa6UD NPdEY6zjHXGBkouVpHurQb1GPhIo4Io= 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-100-mhvfhfvMOraTaGW7IL9Elw-1; Thu, 17 Mar 2022 14:09:01 -0400 X-MC-Unique: mhvfhfvMOraTaGW7IL9Elw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DA1F31C05152; Thu, 17 Mar 2022 18:09:00 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.69]) by smtp.corp.redhat.com (Postfix) with SMTP id 98AA140FF40F; Thu, 17 Mar 2022 18:08:58 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 17 Mar 2022 19:09:00 +0100 (CET) Date: Thu, 17 Mar 2022 19:08:57 +0100 From: Oleg Nesterov To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Alexey Gladkov , Kyle Huey , Kees Cook , Al Viro , linux-api@vger.kernel.org, Jens Axboe Subject: Re: [PATCH 2/2] ptrace: Return the signal to continue with from ptrace_stop Message-ID: <20220317180856.GB13318@redhat.com> References: <87a6ha4zsd.fsf@email.froward.int.ebiederm.org> <87bl1kunjj.fsf@email.froward.int.ebiederm.org> <87r19opkx1.fsf_-_@email.froward.int.ebiederm.org> <87o82gdlu9.fsf_-_@email.froward.int.ebiederm.org> <87tubyx0rg.fsf_-_@email.froward.int.ebiederm.org> <875yoe7qdp.fsf_-_@email.froward.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <875yoe7qdp.fsf_-_@email.froward.int.ebiederm.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Not sure I understand this patch, I can't apply it. I guess I need to clone your tree first, will do later. Just one question right now, On 03/15, Eric W. Biederman wrote: > > +static int ptrace_stop(int exit_code, int why, int clear_code, > unsigned long message, kernel_siginfo_t *info) > __releases(¤t->sighand->siglock) > __acquires(¤t->sighand->siglock) > { > bool gstop_done = false; > + bool read_code = true; > > if (arch_ptrace_stop_needed()) { > /* > @@ -2305,8 +2307,9 @@ static void ptrace_stop(int exit_code, int why, int clear_code, > > /* tasklist protects us from ptrace_freeze_traced() */ > __set_current_state(TASK_RUNNING); > + read_code = false; > if (clear_code) > - current->exit_code = 0; > + exit_code = 0; > read_unlock(&tasklist_lock); > } > > @@ -2316,8 +2319,10 @@ static void ptrace_stop(int exit_code, int why, int clear_code, > * any signal-sending on another CPU that wants to examine it. > */ > spin_lock_irq(¤t->sighand->siglock); > + if (read_code) exit_code = current->exit_code; style ;) > current->last_siginfo = NULL; > current->ptrace_message = 0; > + current->exit_code = 0; OK, I like it... but can't we remove the ugly "int clear_code" arg? Oleg.