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 F113145BC6; Thu, 24 Oct 2024 18:38:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8B2B0434F5; Thu, 24 Oct 2024 18:38:19 +0200 (CEST) Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by mails.dpdk.org (Postfix) with ESMTP id 89C554025C for ; Thu, 24 Oct 2024 18:38:17 +0200 (CEST) Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-7edb6879196so500429a12.3 for ; Thu, 24 Oct 2024 09:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1729787896; x=1730392696; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=VVPGMfFiRIfYIAh7pSy8avpilJ9ceTX45Kogx3IJ5ps=; b=AKqGD9bNy7JaZfTbaqMZ2AI0+ReGPvdxPMxjyYhAKa5F4cs+xa6ZgIe4UUEA4aU7EV Pw2wUFLwgYIC9//rWH1LYMfHuOlN3YyYBfd0znU34Z65I4ybXhz4rQTPFd/ulmMxf52B ecSrYGtu8E4aHz131AG9rG8vzoFu70MUpRtWHq8YgsrCxS1ua0k2KLIUaumoBhGzYqIH /DVKmdj2w71ieU65cseEQw1R0wP36NyatmiBXx5WIf2vtXENIy7CzrJn925GI0s3h3wS L0lBBOgtlcCsdxXfChWp5w4HB3Mns+2wyLB8SAxgTTMZGPp+yFBolgMRMfbKnmCyBib7 C4Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729787896; x=1730392696; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VVPGMfFiRIfYIAh7pSy8avpilJ9ceTX45Kogx3IJ5ps=; b=cgJ6fD/Dn4ez5gXDy5I1aBS+CTlaUD3G5ZHVxhjm7dqR+/Ui2EXMZMDMQg8FqOn9O+ tG/bvLIW2BUWFMeKht9QbRT2qxOfOMLEj/fl6QjJGicS87l2nEqeoaQYZKmqaVqlPx5g 7T3L9Pkp/Nu2iqhUJRkHdanDb7RLI6hbS2DFSbUvHaLjZ7HYhIf+H+7c1GkmRkkP3oJ3 GvGsmavYEBsLSBPktPE+vzANBfQ2ClRhPqO5cgnKYHpwrUTZRMUCRwbs0eEVl6/oPfY1 g8gBjqk5sn0A1glE/VNY+STPtA2+4oPC4TXMwNizohk7HHelt2Q5V/U+L5TB5F0IN/SR mfig== X-Gm-Message-State: AOJu0Yx9k3jX5lc7JuuOlMePYb2tlwZE1Kj3G+KTunsc6plFHPskLDeF y5g6THLqh5Bz3t/ybmRPxQw+c/0yd7sEyGnKSP7tHpsmpvyrVg5x7YB4hJczd+0= X-Google-Smtp-Source: AGHT+IHvaOQC+rDD9CRDHXEqGSrVM4AjQduQ08HmoY4G4LFeOxpB244vbIRZ6ujntIgi/4ByD9f+bA== X-Received: by 2002:a05:6a20:43a7:b0:1d8:d3b4:7a73 with SMTP id adf61e73a8af0-1d9898fda0cmr3298298637.4.1729787896514; Thu, 24 Oct 2024 09:38:16 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec13d760esm8167949b3a.108.2024.10.24.09.38.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 09:38:16 -0700 (PDT) Date: Thu, 24 Oct 2024 09:38:14 -0700 From: Stephen Hemminger To: Dmitry Kozlyuk Cc: dev@dpdk.org, Anatoly Burakov , Lewis Donzis Subject: Re: [PATCH] eal: support including mapped memory in core dump Message-ID: <20241024093814.779d86c7@hermes.local> In-Reply-To: <20241023231859.1323727-1-kozlyuk@bifit.com> References: <20241023231859.1323727-1-kozlyuk@bifit.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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, 24 Oct 2024 02:18:59 +0300 Dmitry Kozlyuk wrote: > +static int > +enable_shared_hugepage_coredump(void) > +{ > + const char *path = "/proc/self/coredump_filter"; > + const unsigned long shared_hugepage_flag = RTE_BIT64(6); > + > + FILE *f; > + uint64_t coredump_filter; > + > + f = fopen(path, "r"); > + if (f == NULL) { > + rte_errno = errno; > + EAL_LOG(ERR, "Failed to open %s for reading: %s", path, strerror(errno)); > + return -1; > + } > + > + if (fscanf(f, "%"SCNx64, &coredump_filter) != 1) { > + rte_errno = errno; > + EAL_LOG(ERR, "Failed to parse %s: %s", path, strerror(errno)); > + fclose(f); > + return -1; > + } > + > + fclose(f); > + > + if (coredump_filter & shared_hugepage_flag) > + return 0; > + > + f = fopen(path, "w"); > + if (f == NULL) { > + rte_errno = errno; > + EAL_LOG(ERR, "Failed to open %s for writing: %s", path, strerror(errno)); > + return -1; > + } > + > + coredump_filter |= shared_hugepage_flag; > + if (fprintf(f, "%"PRIx64, coredump_filter) <= 0) { > + rte_errno = EIO; > + EAL_LOG(ERR, "Failed to write %"PRIx64" to %s", coredump_filter, path); > + fclose(f); > + return -1; > + } > + > + fclose(f); > + return 0; > +} > + Having a process set a system global value like coredump_filter via an internal call seems like a potential problem. What about other processes on the system? It may not even be allowed if using a hardened kernel. I would prefer that madvise() be used, and document the required change to coredump_filter.