From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F2293A00C3; Thu, 23 Jun 2022 09:51:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E633940DDB; Thu, 23 Jun 2022 09:51:19 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id D57014067B for ; Thu, 23 Jun 2022 09:51:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655970678; 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=eJr4ZY8OzL8gwLHpbnwx9AT4hCDX2yWyJPf97LcZUTo=; b=CFCa0XofvzBaheVUFMPgzymwDxZdB10sg/EhU4SWc8U5aohvGV9+4d7sbNxV7O8IfFwo5i 086rIR4Vrb5v9YOAUE0WzMScyzenXnJXyDpX5pWIVhrhP2kcdYd4dAsfj3rkaGqiuWYwCP WC8zvUu2VDzo3XYECJGwXOnXBWB6K2Q= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-591-69yhhs8KNpeTw6HROAJ8Xw-1; Thu, 23 Jun 2022 03:51:17 -0400 X-MC-Unique: 69yhhs8KNpeTw6HROAJ8Xw-1 Received: by mail-lf1-f69.google.com with SMTP id cf10-20020a056512280a00b0047f5a295656so7050892lfb.15 for ; Thu, 23 Jun 2022 00:51:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=eJr4ZY8OzL8gwLHpbnwx9AT4hCDX2yWyJPf97LcZUTo=; b=zsU6YKJUeb9Mix84S9QV6Hj5/eamJxr8Xu6XzGmggPDZRLolZUBdNPuwSWWe3iU+GL q5aO8YkuMNGugVYJuqY2m17ZRsLTDBiBvUkcUhGZGDkojxFtYNFvKKGPhqZRt39Eh0fa TErlnunyon2RcDdzYrzJwOqht8YYjtkjfvdq2pWm8RKLfHtF9IU7eWBx0MU9JyMwCeR3 ARCncME+AR4lhUyMSc6V8Y6OK4JL2/Fc2YSihK2MfpKkVy5pNiRRZjiP9K8nVC+MHz0O LCUjHFgOf/cvGQ3ZQRfojR4U+OysfW5pjKUbfNb2Y0rAYR+MjgW3UoQ+dd6IMkbspTrb YZlQ== X-Gm-Message-State: AJIora/JqSmJ6swCXVm7mUjkbkvWGQrSIQY3i8jD2uJmBvTuyEG9jUmQ kgi0HUob/MRf/Gozrm79eHDrgIdgWd1YTXEmBvzByoJNWVhWz/7wk2K/hH3DeOfU/k/XnRC4fM2 hgmv3o6XA8/Wn/BiaOMk= X-Received: by 2002:a05:651c:38e:b0:25a:7182:410d with SMTP id e14-20020a05651c038e00b0025a7182410dmr4015648ljp.81.1655970675796; Thu, 23 Jun 2022 00:51:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sYun7kyluMg0VPnwngcGM6QuFLtxLM/n/43NwJgj0pVOod2VV1uYT+9VgjCX9+p7kdMMk83zT2mFl/oOgu0FY= X-Received: by 2002:a05:651c:38e:b0:25a:7182:410d with SMTP id e14-20020a05651c038e00b0025a7182410dmr4015640ljp.81.1655970675583; Thu, 23 Jun 2022 00:51:15 -0700 (PDT) MIME-Version: 1.0 References: <20220129011039.264377-1-stephen@networkplumber.org> <20220414201940.266711-1-stephen@networkplumber.org> In-Reply-To: <20220414201940.266711-1-stephen@networkplumber.org> From: David Marchand Date: Thu, 23 Jun 2022 09:51:04 +0200 Message-ID: Subject: Re: [PATCH v4] rte_dump_stack: make in async signal safe To: Stephen Hemminger Cc: dev , =?UTF-8?Q?Morten_Br=C3=B8rup?= , Bruce Richardson Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Apr 14, 2022 at 10:19 PM Stephen Hemminger wrote: > > rte_dump_stack() needs to be usable in situations when a bug is > encountered and from signal handlers (such as SEGV). > > Glibc backtrace_symbols() calls malloc which makes it > dangerous in a signal handler that is handling errors that maybe > due to memory corruption. Additionally, rte_log() is unsafe because > syslog() is not signal safe; printf() is also documented as > not being safe. > > This version formats message and uses writev for each line in a manner > similar to what glibc version of backtrace_symbols_fd() does. The > FreeBSD version of backtrace_symbols_fd() is not signal safe. > > Sample output: > > 0: ./build/app/dpdk-testpmd (rte_dump_stack+0x2b) [560a6e9c002b] > 1: ./build/app/dpdk-testpmd (main+0xad) [560a6decd5ad] > 2: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xcd) [7fd43d3e27fd= ] > 3: ./build/app/dpdk-testpmd (_start+0x2a) [560a6e83628a] > > Bugzilla ID: 929 > Acked-by: Morten Br=C3=B8rup > Signed-off-by: Stephen Hemminger Reviewed-by: David Marchand Applied, thanks. --=20 David Marchand