DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Robin Jarry" <rjarry@redhat.com>
To: "Stephen Hemminger" <stephen@networkplumber.org>
Cc: dev@dpdk.org, "Bruce Richardson" <bruce.richardson@intel.com>,
	"Morten Brørup" <mb@smartsharesystems.com>,
	"Chengwen Feng" <fengchengwen@huawei.com>
Subject: Re: [PATCH dpdk] log: fix double free on cleanup
Date: Sun, 01 Dec 2024 14:48:13 +0100	[thread overview]
Message-ID: <D60ETBANA0PQ.3OKCDLE3VKI9E@redhat.com> (raw)
In-Reply-To: <20241129085450.57473230@hermes.local>

Stephen Hemminger, Nov 29, 2024 at 17:54:
> On Fri, 29 Nov 2024 17:10:14 +0100
> Robin Jarry <rjarry@redhat.com> wrote:
>
>> @@ -550,11 +555,8 @@ eal_log_init(const char *id)
>>  void
>>  rte_eal_log_cleanup(void)
>>  {
>> -	FILE *log_stream = rte_logs.file;
>> -
>> -	/* don't close stderr on the application */
>> -	if (log_stream != NULL)
>> -		fclose(log_stream);
>> -
>> +	if (rte_logs.is_internal_file && rte_logs.file != NULL)
>> +		fclose(rte_logs.file);
>>  	rte_logs.file = NULL;
>> +	rte_logs.is_internal_file = 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 
only returned by rte_log_get_stream() when rte_logs.file is NULL, but 
rte_logs.file is not modified. It is only modified in eal_log_init() 
when --syslog or when running with journald. In both these cases, a new 
file is opened, not stderr.


  reply	other threads:[~2024-12-01 13:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-29 16:10 Robin Jarry
2024-11-29 16:54 ` Stephen Hemminger
2024-12-01 13:48   ` Robin Jarry [this message]
2024-11-29 17:00 ` Stephen Hemminger
2024-12-23  8:59   ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D60ETBANA0PQ.3OKCDLE3VKI9E@redhat.com \
    --to=rjarry@redhat.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=mb@smartsharesystems.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).