Skip to contentSkip to conversation

Open file with O_CLOEXEC to avoid fd leak

PATCH Superseded [email protected] 4 participants 14 messages Jan 19, 2020 – Jan 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Open file with O_CLOEXEC to avoid fd leak

From: Pavel Modilaynen <[email protected]>

Use close-on-exec (O_CLOEXEC) flag when open log file to make sure its file descriptor is not leaked to parent process on fork/exec.

---
 pseudo_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pseudo_util.c +1 -1
index c867ed6..0ec527b 100644
@@ -1594,7 +1594,7 @@ pseudo_logfile(char *filename, char *defname, int prefer_fd) {
 		}
 		free(filename);
 	}	
-	fd = open(pseudo_path, O_WRONLY | O_APPEND | O_CREAT, 0644);
+	fd = open(pseudo_path, O_WRONLY | O_APPEND | O_CREAT | O_CLOEXEC, 0644);
 	if (fd == -1) {
 		pseudo_diag("help: can't open log file %s: %s\n", pseudo_path, strerror(errno));
 	} else {
Signature · 1 line
2.7.4
#1 lore raw

✗ patchtest: failure for Open file with O_CLOEXEC to avoid fd leak

== Series Details ==

Series: Open file with O_CLOEXEC to avoid fd leak
Revision: 1
URL : https://patchwork.openembedded.org/series/22123/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 9d7a521971)

* Patch            Open file with O_CLOEXEC to avoid fd leak
 Issue             Shortlog does not follow expected format [test_shortlog_format] 
  Suggested fix    Commit shortlog (first line of commit message) should follow the format "<target>: <summary>"
* Patch            Open file with O_CLOEXEC to avoid fd leak
 Issue             Patch is missing Signed-off-by [test_signed_off_by_presence] 
  Suggested fix    Sign off the patch (either manually or with "git commit --amend -s")

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
#2 lore raw

PATCH v2 1/1 Open file with O_CLOEXEC to avoid fd leak

In reply to [email protected]

From: Pavel Modilaynen <[email protected]>

Use close-on-exec (O_CLOEXEC) flag when open log file to make sure its file descriptor is not leaked to parent process on fork/exec.

---
 pseudo_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pseudo_util.c +1 -1
index c867ed6..0ec527b 100644
@@ -1594,7 +1594,7 @@ pseudo_logfile(char *filename, char *defname, int prefer_fd) {
 		}
 		free(filename);
 	}	
-	fd = open(pseudo_path, O_WRONLY | O_APPEND | O_CREAT, 0644);
+	fd = open(pseudo_path, O_WRONLY | O_APPEND | O_CREAT | O_CLOEXEC, 0644);
 	if (fd == -1) {
 		pseudo_diag("help: can't open log file %s: %s\n", pseudo_path, strerror(errno));
 	} else {
Signature · 1 line
2.7.4
#3 lore raw

✗ patchtest: failure for Open file with O_CLOEXEC to avoid fd leak (rev2)

In reply to [email protected]

== Series Details ==

Series: Open file with O_CLOEXEC to avoid fd leak (rev2)
Revision: 2
URL : https://patchwork.openembedded.org/series/22123/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 9d7a521971)

* Patch            [v2] Open file with O_CLOEXEC to avoid fd leak
 Issue             Shortlog does not follow expected format [test_shortlog_format] 
  Suggested fix    Commit shortlog (first line of commit message) should follow the format "<target>: <summary>"

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
#4 lore raw

PATCH v3 1/1 pseudo_util.c: Open file with O_CLOEXEC to avoid fd leak

In reply to [email protected]

From: Pavel Modilaynen <[email protected]>

Use close-on-exec (O_CLOEXEC) flag when open log file to make sure its file descriptor is not leaked to parent process on fork/exec.

---
 pseudo_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pseudo_util.c +1 -1
index c867ed6..0ec527b 100644
@@ -1594,7 +1594,7 @@ pseudo_logfile(char *filename, char *defname, int prefer_fd) {
 		}
 		free(filename);
 	}	
-	fd = open(pseudo_path, O_WRONLY | O_APPEND | O_CREAT, 0644);
+	fd = open(pseudo_path, O_WRONLY | O_APPEND | O_CREAT | O_CLOEXEC, 0644);
 	if (fd == -1) {
 		pseudo_diag("help: can't open log file %s: %s\n", pseudo_path, strerror(errno));
 	} else {
Signature · 1 line
2.7.4
#5 lore raw

✗ patchtest: failure for Open file with O_CLOEXEC to avoid fd leak (rev3)

In reply to [email protected]

== Series Details ==

Series: Open file with O_CLOEXEC to avoid fd leak (rev3)
Revision: 3
URL : https://patchwork.openembedded.org/series/22123/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 9d7a521971)

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
author
#6 lore raw

Re: ✗ patchtest: failure for Open file with O_CLOEXEC to avoid fd leak (rev3)

Quoted 16 lines · Patchwork

== Series Details ==

Series: Open file with O_CLOEXEC to avoid fd leak (rev3)
Revision: 3
URL : https://patchwork.openembedded.org/series/22123/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

Quoted 3 lines
* Issue             Series does not apply on top of target branch [test_series_merge_on_head]
   Suggested fix    Rebase your series on top of targeted branch
   Targeted branch  master (currently at 9d7a521971)

Have already rebased on the master branch of http://git.yoctoproject.org/cgit/cgit.cgi/pseudo/, why still issue out the above issue? Any hint?

Thanks,

Quoted 16 lines

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
#7 lore raw

Re: ✗ patchtest: failure for Open file with O_CLOEXEC to avoid fd leak (rev3)

Hi Mingli

Quoted 17 lines · Mingli
Quoted 16 lines · Patchwork

== Series Details ==

Series: Open file with O_CLOEXEC to avoid fd leak (rev3)
Revision: 3
URL : https://patchwork.openembedded.org/series/22123/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

Quoted 7 lines
Quoted 3 lines
* Issue             Series does not apply on top of target branch [test_series_merge_on_head]
   Suggested fix    Rebase your series on top of targeted branch
   Targeted branch  master (currently at 9d7a521971)

Have already rebased on the master branch of
http://git.yoctoproject.org/cgit/cgit.cgi/pseudo/, why still issue out the above issue? Any hint?

It's assuming that patches sent to this list are for OE-Core (which they generally are). I wasn't aware but apparently the documented place to send pseudo patches is this list, so I think in this case you can just ignore patchtest.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel System Software Products
author
#8 lore raw

Re: ✗ patchtest: failure for Open file with O_CLOEXEC to avoid fd leak (rev3)

Quoted 24 lines · Paul Eggleton

Hi Mingli

Quoted 21 lines · Mingli
Quoted 19 lines · Patchwork

== Series Details ==

Series: Open file with O_CLOEXEC to avoid fd leak (rev3)
Revision: 3
URL : https://patchwork.openembedded.org/series/22123/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 9d7a521971)

Quoted 8 lines
Quoted 3 lines

Have already rebased on the master branch of
http://git.yoctoproject.org/cgit/cgit.cgi/pseudo/, why still issue out the above issue? Any hint?

It's assuming that patches sent to this list are for OE-Core (which they generally are). I wasn't aware but apparently the documented place to send pseudo patches is this list, so I think in this case you can just ignore patchtest.

Okay, many thanks Paul for your hint!

Thanks,

Quoted 4 lines

Cheers,
Paul

#9 lore raw

Re: ✗ patchtest: failure for Open file with O_CLOEXEC to avoid fd leak (rev3)

Quoted 41 lines

-----Original Message-----
From: [email protected] <openembedded-core- [email protected]> On Behalf Of Yu, Mingli
Sent: den 20 januari 2020 02:34
To: Paul Eggleton <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core] ✗ patchtest: failure for Open file with O_CLOEXEC to avoid fd leak (rev3)

Quoted 15 lines · Paul Eggleton

Hi Mingli

Quoted 12 lines · Mingli
Quoted 11 lines · Patchwork

== Series Details ==

Series: Open file with O_CLOEXEC to avoid fd leak (rev3)
Revision: 3
URL : https://patchwork.openembedded.org/series/22123/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This

is

Quoted 1 line
Quoted 1 line
Quoted 1 line

an automated response. Several tests have been executed on the

proposed

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch

[test_series_merge_on_head]

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 9d7a521971)

Have already rebased on the master branch of
http://git.yoctoproject.org/cgit/cgit.cgi/pseudo/, why still issue out the above issue? Any hint?

Quoted 12 lines
Quoted 4 lines

It's assuming that patches sent to this list are for OE-Core (which they generally are). I wasn't aware but apparently the documented place to send pseudo patches is this list, so I think in this case you can just ignore patchtest.

Okay, many thanks Paul for your hint!

Thanks,

Quoted 3 lines

Cheers,
Paul

But it is probably a good idea to include a "[pseudo]" tag in the subject when sending patches related to pseudo to this list, as the expectation otherwise is that they are for OE-Core.

//Peter

author
#10 lore raw

Re: ✗ patchtest: failure for Open file with O_CLOEXEC to avoid fd leak (rev3)

Quoted 51 lines · Peter Kjellerstedt
Quoted 51 lines

-----Original Message-----
From: [email protected] <openembedded-core- [email protected]> On Behalf Of Yu, Mingli
Sent: den 20 januari 2020 02:34
To: Paul Eggleton <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core] ✗ patchtest: failure for Open file with O_CLOEXEC to avoid fd leak (rev3)

Quoted 15 lines · Paul Eggleton

Hi Mingli

Quoted 12 lines · Mingli
Quoted 11 lines · Patchwork

== Series Details ==

Series: Open file with O_CLOEXEC to avoid fd leak (rev3)
Revision: 3
URL : https://patchwork.openembedded.org/series/22123/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This

is

Quoted 1 line
Quoted 1 line
Quoted 1 line

an automated response. Several tests have been executed on the

proposed

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch

[test_series_merge_on_head]

Quoted 11 lines
Quoted 6 lines
Quoted 2 lines

Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 9d7a521971)

Have already rebased on the master branch of
http://git.yoctoproject.org/cgit/cgit.cgi/pseudo/, why still issue out the above issue? Any hint?

It's assuming that patches sent to this list are for OE-Core (which they generally are). I wasn't aware but apparently the documented place to send pseudo patches is this list, so I think in this case you can just ignore patchtest.

Okay, many thanks Paul for your hint!

Thanks,

Quoted 1 line
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

Cheers,
Paul

But it is probably a good idea to include a "[pseudo]" tag in the subject when sending patches related to pseudo to this list, as the expectation otherwise is that they are for OE-Core.

Thanks Peter! And already add the "pseudo_util.c" tag in the subject in the v3, please check the mail with the subject "[OE-core] [PATCH v3] pseudo_util.c: Open file with O_CLOEXEC to avoid fd leak".

Thanks,

Quoted 3 lines

//Peter

#11 lore raw

Re: ✗ patchtest: failure for Open file with O_CLOEXEC to avoid fd leak (rev3)

Quoted 69 lines

-----Original Message-----
From: Yu, Mingli <[email protected]>
Sent: den 20 januari 2020 04:04
To: Peter Kjellerstedt <[email protected]>; Paul Eggleton <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core] ✗ patchtest: failure for Open file with O_CLOEXEC to avoid fd leak (rev3)

Quoted 2 lines · Peter Kjellerstedt
Quoted 2 lines

-----Original Message-----
From: [email protected] <openembedded-

core-

Quoted 5 lines
Quoted 5 lines

[email protected]> On Behalf Of Yu, Mingli
Sent: den 20 januari 2020 02:34
To: Paul Eggleton <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core] ✗ patchtest: failure for Open file with

O_CLOEXEC

Quoted 14 lines
Quoted 14 lines

to avoid fd leak (rev3)

Quoted 11 lines · Paul Eggleton

Hi Mingli

Quoted 8 lines · Mingli
Quoted 7 lines · Patchwork

== Series Details ==

Series: Open file with O_CLOEXEC to avoid fd leak (rev3)
Revision: 3
URL : https://patchwork.openembedded.org/series/22123/
State : failure

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core.

This

Quoted 7 lines
Quoted 7 lines

is

Quoted 1 line
Quoted 1 line
Quoted 1 line

an automated response. Several tests have been executed on the

proposed

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

series by patchtest resulting in the following failures:

Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

* Issue Series does not apply on top of target branch

[test_series_merge_on_head]

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 9d7a521971)

Have already rebased on the master branch of
http://git.yoctoproject.org/cgit/cgit.cgi/pseudo/, why still issue

out

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

the above issue? Any hint?

It's assuming that patches sent to this list are for OE-Core (which

they

Quoted 12 lines
Quoted 11 lines
Quoted 3 lines

generally are). I wasn't aware but apparently the documented place to send pseudo patches is this list, so I think in this case you can just ignore patchtest.

Okay, many thanks Paul for your hint!

Thanks,

Quoted 3 lines

Cheers,
Paul

Quoted 8 lines
Quoted 1 line

But it is probably a good idea to include a "[pseudo]" tag in the

subject

Quoted 2 lines

when sending patches related to pseudo to this list, as the expectation otherwise is that they are for OE-Core.

Thanks Peter! And already add the "pseudo_util.c" tag in the subject in the v3, please check the mail with the subject "[OE-core] [PATCH v3] pseudo_util.c: Open file with O_CLOEXEC to avoid fd leak".

That is not the same. The "pseudo_util.c:" is part of the commit subject and will end up in the Git repository. A "[pseudo]" tag is for anyone seeing the mail (possibly including patchwork and patchtest), letting them know that this commit is about pseudo, not OE-Core (similar to the "[PATCH v3]" tag, which is also information about the commit).

Quoted 3 lines

Thanks,

Quoted 1 line

//Peter

//Peter

#12 lore raw

PATCH v4 1/1 pseudo_util.c: Open file with O_CLOEXEC to avoid fd leak

From: Pavel Modilaynen <[email protected]>

Use close-on-exec (O_CLOEXEC) flag when open log file to make sure its file descriptor is not leaked to parent process on fork/exec.

---
 pseudo_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pseudo_util.c +1 -1
index c867ed6..0ec527b 100644
@@ -1594,7 +1594,7 @@ pseudo_logfile(char *filename, char *defname, int prefer_fd) {
 		}
 		free(filename);
 	}	
-	fd = open(pseudo_path, O_WRONLY | O_APPEND | O_CREAT, 0644);
+	fd = open(pseudo_path, O_WRONLY | O_APPEND | O_CREAT | O_CLOEXEC, 0644);
 	if (fd == -1) {
 		pseudo_diag("help: can't open log file %s: %s\n", pseudo_path, strerror(errno));
 	} else {
Signature · 1 line
2.7.4
author
#13 lore raw

Re: ✗ patchtest: failure for Open file with O_CLOEXEC to avoid fd leak (rev3)

In reply to Peter Kjellerstedt
Quoted 78 lines · Peter Kjellerstedt
Quoted 69 lines

-----Original Message-----
From: Yu, Mingli <[email protected]>
Sent: den 20 januari 2020 04:04
To: Peter Kjellerstedt <[email protected]>; Paul Eggleton <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core] ✗ patchtest: failure for Open file with O_CLOEXEC to avoid fd leak (rev3)

Quoted 2 lines · Peter Kjellerstedt
Quoted 2 lines

-----Original Message-----
From: [email protected] <openembedded-

core-

Quoted 5 lines
Quoted 5 lines

[email protected]> On Behalf Of Yu, Mingli
Sent: den 20 januari 2020 02:34
To: Paul Eggleton <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core] ✗ patchtest: failure for Open file with

O_CLOEXEC

Quoted 14 lines
Quoted 14 lines

to avoid fd leak (rev3)

Quoted 11 lines · Paul Eggleton

Hi Mingli

Quoted 8 lines · Mingli
Quoted 7 lines · Patchwork

== Series Details ==

Series: Open file with O_CLOEXEC to avoid fd leak (rev3)
Revision: 3
URL : https://patchwork.openembedded.org/series/22123/
State : failure

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core.

This

Quoted 7 lines
Quoted 7 lines

is

Quoted 1 line
Quoted 1 line
Quoted 1 line

an automated response. Several tests have been executed on the

proposed

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

series by patchtest resulting in the following failures:

Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

* Issue Series does not apply on top of target branch

[test_series_merge_on_head]

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 9d7a521971)

Have already rebased on the master branch of
http://git.yoctoproject.org/cgit/cgit.cgi/pseudo/, why still issue

out

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

the above issue? Any hint?

It's assuming that patches sent to this list are for OE-Core (which

they

Quoted 12 lines
Quoted 11 lines
Quoted 3 lines

generally are). I wasn't aware but apparently the documented place to send pseudo patches is this list, so I think in this case you can just ignore patchtest.

Okay, many thanks Paul for your hint!

Thanks,

Quoted 3 lines

Cheers,
Paul

Quoted 8 lines
Quoted 1 line

But it is probably a good idea to include a "[pseudo]" tag in the

subject

Quoted 2 lines

when sending patches related to pseudo to this list, as the expectation otherwise is that they are for OE-Core.

Thanks Peter! And already add the "pseudo_util.c" tag in the subject in the v3, please check the mail with the subject "[OE-core] [PATCH v3] pseudo_util.c: Open file with O_CLOEXEC to avoid fd leak".

Quoted 5 lines

That is not the same. The "pseudo_util.c:" is part of the commit subject and will end up in the Git repository. A "[pseudo]" tag is for anyone seeing the mail (possibly including patchwork and patchtest), letting them know that this commit is about pseudo, not OE-Core (similar to the "[PATCH v3]" tag, which is also information about the commit).

Got it! V4 is incoming.

Thanks,

Quoted 7 lines
Quoted 4 lines

Thanks,

Quoted 1 line

//Peter

//Peter