From owner-freebsd-hackers@freebsd.org Thu Apr 27 12:57:33 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5340DD530B5 for ; Thu, 27 Apr 2017 12:57:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF05AA80 for ; Thu, 27 Apr 2017 12:57:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v3RCvPGD098746 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 27 Apr 2017 15:57:25 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v3RCvPGD098746 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v3RCvPPR098745; Thu, 27 Apr 2017 15:57:25 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 27 Apr 2017 15:57:25 +0300 From: Konstantin Belousov To: Willem Jan Withagen Cc: "freebsd-hackers@freebsd.org" Subject: Re: Disabling program core dumps Message-ID: <20170427125725.GM1622@kib.kiev.ua> References: <32ac85ed-f0e5-2f80-299a-3bb1166cd5e6@digiware.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <32ac85ed-f0e5-2f80-299a-3bb1166cd5e6@digiware.nl> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 12:57:33 -0000 On Thu, Apr 27, 2017 at 02:36:52PM +0200, Willem Jan Withagen wrote: > Hi, > > Running (googletest) tests some are expected to die: EXPECT_DEATH(). > This normally dumps a core, but since it is expected that core is rather > useless. > > Thusfar I've found the best way to limit a program to dump core (from > within the program) is to set its RLIMIT_CORE to 0. > > So I can do this before the test, and then set the old size back once > the test is finished. > > Or is there another way, like setting a flag in process state (which I > have not been able to find) See procctl(2) PROC_TRACE_CTL command. Disabling tracing also disables coredumping.