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 8BFFD45DF7; Sun, 1 Dec 2024 14:48:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 574F140296; Sun, 1 Dec 2024 14:48:23 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id EDABD40289 for ; Sun, 1 Dec 2024 14:48:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733060898; 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=G26HX5tdJQeQK2+e3jPeprBJbPskh/kCI0uh390hixw=; b=EXHqiw/5/E1rD9jUA6QPAaI6riDDpZSUpt8zpctXncikisaU1jJOy5JXX+HJVZJRIn5rEi PtlpopyevGfWBdFhqhcFHLSemZibbKtDTOPY4Gawkde+qFGunhO0g8JTYm93dX8OzHe7qK ZldGdcPdB6vx/tiS4vZ2ERVTogKRT+M= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-672-KL9BkEDgPhS-vxXIl_cNvw-1; Sun, 01 Dec 2024 08:48:17 -0500 X-MC-Unique: KL9BkEDgPhS-vxXIl_cNvw-1 X-Mimecast-MFC-AGG-ID: KL9BkEDgPhS-vxXIl_cNvw Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-385d52591d6so1469671f8f.1 for ; Sun, 01 Dec 2024 05:48:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733060896; x=1733665696; h=in-reply-to:references:user-agent:to:from:cc:subject:message-id :date:content-transfer-encoding:mime-version:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=aLBRfW/Q1rvCQt0HOj4fSjpX2FiAGLRiZkXo5R+dt9U=; b=tnQeIYgKRxhyUxP/xgyxK9ANA/5hq0wA820rYLQ0vRjMZBlBa1AH9r47ohfk7U6FWw U2vibBjJCEh0pN20G5c8MsswgcGcvNALom5OFCH1nSrXTHDk9LVhHAwkz3PIO4q6tvEq ZCVVrhBd7yLcxmQZaL8EiXLHzG3OZhdtcEU4sjToxO/+qiAouRumGFmDX3pLDSMQUaQf HfSh7LBBSxHuRp6YAn+Pttc+/bZOq58yLIAfLjuUxKGRn5M/1cdROpSPsno2CneZirgR YXTJVLrgpXbmgkchlCpSLrzTCpMlzl5Kn7dU+wB1zQj1kqAdzNgskfuMuqEHOz+C0ou7 n7NA== X-Gm-Message-State: AOJu0YxyT4K7n9D6YIYp/XkquiBhi8SKtw+NcM9idqFDgrAgNAHMIKJB bJHz4DbXNLq2mG7VrkbWuVAFh0DoIFzJVMaGHupCg4CSNHK43aiWc1RZJ5OJuCIiundz6/U3a+P p91E3RLhNAyG78pBVRySbi3XP1ju97RYyxPBpSPRqpt5QC16W X-Gm-Gg: ASbGncth0H4ltg67aPdv5AG26Mki26MvkkQZ1OPUP+U8nNHHlTIdlP7CMI/eo6MCR+F px4/rI7wULJ3vpXYrb31u+JrX3lR8olbirVTvc4tRW2FhYechb96xXOtJK/UIuAdKUAiBgaxeH4 FYdOFN1rpvllmnlwwkXJgNu+VHYhya6W3LuXGvKVbAuhbmvUGEcPqGnEIOlZVclZDBCkGDIWFMi p9Nfptt4OUplf2oOgKU4BGaxZj12XdJ0WWhgp6FiphHcYFrNNXjDh2uOgNZ6FZh59JxY+qvQ07L ZW9kPWPUBAPH/C9UH5xzV5y7vfkQ05it X-Received: by 2002:a5d:5886:0:b0:385:e30a:393a with SMTP id ffacd0b85a97d-385e30a3ab0mr4817338f8f.0.1733060895895; Sun, 01 Dec 2024 05:48:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHTq7Ru/3/fIi+bmGkZoFfaPuT1ocunZKYU3EGrYMg7cSnjLNEyOZoikndDVeMeWDGYX93FyQ== X-Received: by 2002:a5d:5886:0:b0:385:e30a:393a with SMTP id ffacd0b85a97d-385e30a3ab0mr4817324f8f.0.1733060895580; Sun, 01 Dec 2024 05:48:15 -0800 (PST) Received: from localhost (2a01cb000245cb001c88b351a0902c32.ipv6.abo.wanadoo.fr. [2a01:cb00:245:cb00:1c88:b351:a090:2c32]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-385f0d38a89sm883588f8f.97.2024.12.01.05.48.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Dec 2024 05:48:14 -0800 (PST) Mime-Version: 1.0 Date: Sun, 01 Dec 2024 14:48:13 +0100 Message-Id: Subject: Re: [PATCH dpdk] log: fix double free on cleanup Cc: , "Bruce Richardson" , =?utf-8?q?Morten_Br=C3=B8rup?= , "Chengwen Feng" From: "Robin Jarry" To: "Stephen Hemminger" User-Agent: aerc/0.18.2-104-gae6ebb03d2df References: <20241129161013.704859-2-rjarry@redhat.com> <20241129085450.57473230@hermes.local> In-Reply-To: <20241129085450.57473230@hermes.local> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Eg_gnMyIiONy12xUkLr4U30Jxa30RKCLq-pPY3I2wMI_1733060896 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8; format=Flowed 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 Stephen Hemminger, Nov 29, 2024 at 17:54: > On Fri, 29 Nov 2024 17:10:14 +0100 > Robin Jarry wrote: > >> @@ -550,11 +555,8 @@ eal_log_init(const char *id) >> void >> rte_eal_log_cleanup(void) >> { >> -=09FILE *log_stream =3D rte_logs.file; >> - >> -=09/* don't close stderr on the application */ >> -=09if (log_stream !=3D NULL) >> -=09=09fclose(log_stream); >> - >> +=09if (rte_logs.is_internal_file && rte_logs.file !=3D NULL) >> +=09=09fclose(rte_logs.file); >> =09rte_logs.file =3D NULL; >> +=09rte_logs.is_internal_file =3D false; >> } > > The internal flag is ok, but we still don't want to close > stderr in cleanup. Only places where syslog or journal wrapper is used. There is no chance closing stderr will happen with my patch. stderr is=20 only returned by rte_log_get_stream() when rte_logs.file is NULL, but=20 rte_logs.file is not modified. It is only modified in eal_log_init()=20 when --syslog or when running with journald. In both these cases, a new=20 file is opened, not stderr.