Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/earlyoom: fix build with kernel < 4.3
@ 2022-07-28  8:14 Fabrice Fontaine
  2022-07-28 20:51 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2022-07-28  8:14 UTC (permalink / raw)
  To: buildroot; +Cc: Joseph Kogut, Fabrice Fontaine

PR_CAP_AMBIENT is only available since kernel 4.3 and
https://github.com/torvalds/linux/commit/58319057b7847667f0c9585b9de0e8932b0fdb08
resulting in the following build failure since bump to version 1.7 in
commit 07b7f88668b1e51e3d17e14bd8795ef042df144e and
https://github.com/rfjakob/earlyoom/commit/9edc5cfc9ad794ed59baec5e6ee8d1060456a315:

main.c: In function 'main':
main.c:119:11: error: 'PR_CAP_AMBIENT' undeclared (first use in this function)
     prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_CLEAR_ALL, 0, 0, 0);
           ^

Fixes:
 - http://autobuild.buildroot.org/results/5a0ad7e1f6de3c37e40c37d8f583fc699a457753

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...001-main.c-fix-build-with-kernel-4.3.patch | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 package/earlyoom/0001-main.c-fix-build-with-kernel-4.3.patch

diff --git a/package/earlyoom/0001-main.c-fix-build-with-kernel-4.3.patch b/package/earlyoom/0001-main.c-fix-build-with-kernel-4.3.patch
new file mode 100644
index 0000000000..8233800cd6
--- /dev/null
+++ b/package/earlyoom/0001-main.c-fix-build-with-kernel-4.3.patch
@@ -0,0 +1,45 @@
+From 499e81bfcdd9379bf4619a7c3ad85ed7f2b1dca5 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Thu, 28 Jul 2022 10:05:18 +0200
+Subject: [PATCH] main.c: fix build with kernel < 4.3
+
+PR_CAP_AMBIENT is only available since kernel 4.3 and
+https://github.com/torvalds/linux/commit/58319057b7847667f0c9585b9de0e8932b0fdb08
+resulting in the following build failure since version 1.7 and
+https://github.com/rfjakob/earlyoom/commit/9edc5cfc9ad794ed59baec5e6ee8d1060456a315:
+
+main.c: In function 'main':
+main.c:119:11: error: 'PR_CAP_AMBIENT' undeclared (first use in this function)
+     prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_CLEAR_ALL, 0, 0, 0);
+           ^
+
+Fixes:
+ - http://autobuild.buildroot.org/results/5a0ad7e1f6de3c37e40c37d8f583fc699a457753
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Upstream status: https://github.com/rfjakob/earlyoom/pull/276]
+---
+ main.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/main.c b/main.c
+index c068c7c..99ca9e2 100644
+--- a/main.c
++++ b/main.c
+@@ -115,11 +115,13 @@ int main(int argc, char* argv[])
+         fatal(4, "Could not cd to /proc: %s", strerror(errno));
+     }
+ 
++#ifdef PR_CAP_AMBIENT
+     // When systemd starts a daemon with capabilities, it uses ambient
+     // capabilities to do so. If not dropped, the capabilities can spread
+     // to any child process. This is usually not necessary and its a good
+     // idea to drop them if not needed.
+     prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_CLEAR_ALL, 0, 0, 0);
++#endif
+ 
+     meminfo_t m = parse_meminfo();
+ 
+-- 
+2.35.1
+
-- 
2.35.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/earlyoom: fix build with kernel < 4.3
  2022-07-28  8:14 [Buildroot] [PATCH 1/1] package/earlyoom: fix build with kernel < 4.3 Fabrice Fontaine
@ 2022-07-28 20:51 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-07-28 20:51 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: Joseph Kogut, buildroot

On Thu, 28 Jul 2022 10:14:18 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> PR_CAP_AMBIENT is only available since kernel 4.3 and
> https://github.com/torvalds/linux/commit/58319057b7847667f0c9585b9de0e8932b0fdb08
> resulting in the following build failure since bump to version 1.7 in
> commit 07b7f88668b1e51e3d17e14bd8795ef042df144e and
> https://github.com/rfjakob/earlyoom/commit/9edc5cfc9ad794ed59baec5e6ee8d1060456a315:
> 
> main.c: In function 'main':
> main.c:119:11: error: 'PR_CAP_AMBIENT' undeclared (first use in this function)
>      prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_CLEAR_ALL, 0, 0, 0);
>            ^
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/5a0ad7e1f6de3c37e40c37d8f583fc699a457753
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  ...001-main.c-fix-build-with-kernel-4.3.patch | 45 +++++++++++++++++++
>  1 file changed, 45 insertions(+)
>  create mode 100644 package/earlyoom/0001-main.c-fix-build-with-kernel-4.3.patch

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-28 20:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-28  8:14 [Buildroot] [PATCH 1/1] package/earlyoom: fix build with kernel < 4.3 Fabrice Fontaine
2022-07-28 20:51 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox