From owner-svn-src-head@freebsd.org Fri Feb 22 02:16:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A96714FB10C; Fri, 22 Feb 2019 02:16:05 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it1-f175.google.com (mail-it1-f175.google.com [209.85.166.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2DDF672B27; Fri, 22 Feb 2019 02:16:05 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it1-f175.google.com with SMTP id x131so985518itc.3; Thu, 21 Feb 2019 18:16:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=utyy3LzZU1lyNCSnh/YtmuoMo97BPGom0mu1TI8aZWY=; b=dlDDXLA1TBuj6Fsd0tq6Ops18/xHLMtrhUzjSxjON+tdy0pW41b6avd4ASDAceLp0P m6B/k1g9q7Gjjl5Ig6lCyh4aFYT7tyXq0Tg8f4ou4WXyjgoU3NvlIT8ig63lY+wqf6BW WRICQbM8RSDtV++Z/lXKgvTMaEZgKouekPkQFTIJ1HZXcM9e2Xy1JwOvzKdqGnHaro5J IACqg5TEThqOtaDcghzp0iqDruJ7g+oIZqNdP1zGwBUdxb7XIJp3ZS/OvOtmxUNjrQgr DmfuN3YEm2OfrP7sd48LqNdvrql7OjAr2fRjgbBbzs4VwddplEK0dRl802k6RwCJUfQ8 R8zA== X-Gm-Message-State: AHQUAubqu6q89us0VsOiW/75ijCW0FdZI8a8PyvlYvzD0PP5b8Ez3u22 qCIdFs8YOyFPVvZOIUrxkr5Xu0Lo X-Google-Smtp-Source: AHgI3IZ9Tm8THaNBwQfPzhdng62Tte9Nb2Fkl8P2KGJnuiKkwFYw/y3s/ugOW8hx7PMYAU/qEJedbA== X-Received: by 2002:a05:660c:6cc:: with SMTP id z12mr1111049itk.65.1550801757862; Thu, 21 Feb 2019 18:15:57 -0800 (PST) Received: from mail-io1-f48.google.com (mail-io1-f48.google.com. [209.85.166.48]) by smtp.gmail.com with ESMTPSA id y190sm54827itb.26.2019.02.21.18.15.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 18:15:57 -0800 (PST) Received: by mail-io1-f48.google.com with SMTP id p17so578996iol.7; Thu, 21 Feb 2019 18:15:57 -0800 (PST) X-Received: by 2002:a6b:6007:: with SMTP id r7mr1031368iog.124.1550801757345; Thu, 21 Feb 2019 18:15:57 -0800 (PST) MIME-Version: 1.0 References: <201902212254.x1LMsHo1020671@repo.freebsd.org> In-Reply-To: <201902212254.x1LMsHo1020671@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Thu, 21 Feb 2019 18:15:46 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r344452 - in head/sys/cddl: contrib/opensolaris/uts/common/dtrace contrib/opensolaris/uts/intel/dtrace dev/dtrace To: Mark Johnston Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 2DDF672B27 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2019 02:16:05 -0000 Thanks Mark! Prior to this change, if you used userspace dtrace enough, eventually you would get a spurious SIGTRAP on a process, which has the default behavior of dumping core. Perhaps understandably, people balk at random core files lying around. Or at dtrace killing their programs. This patch should address that long-standing problem. An easy repro scenario was described in the differential: > It's possible to reproduce this by, for example, calling strlen() > in a loop, probing every instruction in strlen(), and killing dtrace(1). On Thu, Feb 21, 2019 at 2:54 PM Mark Johnston wrote: > > Author: markj > Date: Thu Feb 21 22:54:17 2019 > New Revision: 344452 > URL: https://svnweb.freebsd.org/changeset/base/344452 > > Log: > Fix a tracepoint lookup race in fasttrap_pid_probe(). > > fasttrap hooks the userspace breakpoint handler; the hook looks up the > breakpoint address in a hash table of tracepoints. It is possible for > the tracepoint to be removed by a different thread in between the > breakpoint trap and the hash table lookup, in which case SIGTRAP gets > delivered to the target process. Fix the problem by adding a > per-process generation counter that gets incremented when a tracepoint > belonging to that process is removed. Then, when a lookup fails, the > trapping instruction is restarted if the thread's counter doesn't match > that of the process.