diff mbox series

[oe,meta-networking,1/4] ippool: Fix build errors found with hardening flags

Message ID 20170719154132.20556-1-raj.khem@gmail.com
State New
Headers show
Series [oe,meta-networking,1/4] ippool: Fix build errors found with hardening flags | expand

Commit Message

Khem Raj July 19, 2017, 3:41 p.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

---
 ...timer-Check-for-return-value-of-write-API.patch | 28 ++++++++++++++++++++++
 .../recipes-daemons/ippool/ippool_1.3.bb           | 22 ++++++++---------
 2 files changed, 39 insertions(+), 11 deletions(-)
 create mode 100644 meta-networking/recipes-daemons/ippool/ippool/0001-usl_timer-Check-for-return-value-of-write-API.patch

-- 
2.13.3

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

Comments

Martin Jansa July 19, 2017, 4:04 p.m. UTC | #1
I've dropped this from master-next to check if the build failures we were
discussing were caused by this. Did you change anything in here (is it v2
or just resend)?

On Wed, Jul 19, 2017 at 5:41 PM, Khem Raj <raj.khem@gmail.com> wrote:

> Signed-off-by: Khem Raj <raj.khem@gmail.com>

> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

> ---

>  ...timer-Check-for-return-value-of-write-API.patch | 28

> ++++++++++++++++++++++

>  .../recipes-daemons/ippool/ippool_1.3.bb           | 22 ++++++++---------

>  2 files changed, 39 insertions(+), 11 deletions(-)

>  create mode 100644 meta-networking/recipes-daemons/ippool/ippool/0001-

> usl_timer-Check-for-return-value-of-write-API.patch

>

> diff --git a/meta-networking/recipes-daemons/ippool/ippool/0001-

> usl_timer-Check-for-return-value-of-write-API.patch

> b/meta-networking/recipes-daemons/ippool/ippool/0001-

> usl_timer-Check-for-return-value-of-write-API.patch

> new file mode 100644

> index 000000000..6fb7cc5c4

> --- /dev/null

> +++ b/meta-networking/recipes-daemons/ippool/ippool/0001-

> usl_timer-Check-for-return-value-of-write-API.patch

> @@ -0,0 +1,28 @@

> +From 5d7f20c045b3c74dad2c53d65e30bd4840250082 Mon Sep 17 00:00:00 2001

> +From: Khem Raj <raj.khem@gmail.com>

> +Date: Tue, 27 Jun 2017 15:17:19 -0700

> +Subject: [PATCH] usl_timer: Check for return value of write() API

> +

> +Signed-off-by: Khem Raj <raj.khem@gmail.com>

> +---

> + usl/usl_timer.c | 4 +++-

> + 1 file changed, 3 insertions(+), 1 deletion(-)

> +

> +diff --git a/usl/usl_timer.c b/usl/usl_timer.c

> +index fda752b..d8414a6 100644

> +--- a/usl/usl_timer.c

> ++++ b/usl/usl_timer.c

> +@@ -94,7 +94,9 @@ void usl_timer_tick(void)

> +

> +       if (!usl_tick_pending) {

> +               usl_tick_pending = 1;

> +-              write(usl_tick_pipe[1], &msg, sizeof(msg));

> ++              if (write(usl_tick_pipe[1], &msg, sizeof(msg)) !=

> sizeof(msg)) {

> ++                      fprintf(stderr, "write to fd %i failed: %s\n",

> usl_tick_pipe[1], strerror(errno));

> ++              }

> +       }

> + }

> +

> +--

> +2.13.2

> +

> diff --git a/meta-networking/recipes-daemons/ippool/ippool_1.3.bb

> b/meta-networking/recipes-daemons/ippool/ippool_1.3.bb

> index 969f434cc..e1c9215ca 100644

> --- a/meta-networking/recipes-daemons/ippool/ippool_1.3.bb

> +++ b/meta-networking/recipes-daemons/ippool/ippool_1.3.bb

> @@ -11,16 +11,16 @@ HOMEPAGE = "http://www.openl2tp.org/"

>  SECTION = "console/network"

>  LICENSE = "GPLv2+"

>

> -SRC_URI = "\

> -        https://sourceforge.net/projects/openl2tp/files/${BPN}

> /${PV}/${BPN}-${PV}.tar.gz \

> -        file://ippool_usl_timer.patch \

> -        file://ippool_parallel_make_and_pic.patch \

> -        file://ippool_init.d.patch \

> -        file://always_syslog.patch \

> -        file://makefile-add-ldflags.patch \

> -        file://runtest.sh \

> -        file://ippool.service \

> -        "

> +SRC_URI = "https://sourceforge.net/projects/openl2tp/files/${BPN}

> /${PV}/${BPN}-${PV}.tar.gz \

> +           file://runtest.sh \

> +           file://ippool.service \

> +           file://ippool_usl_timer.patch \

> +           file://ippool_parallel_make_and_pic.patch \

> +           file://ippool_init.d.patch \

> +           file://always_syslog.patch \

> +           file://makefile-add-ldflags.patch \

> +           file://0001-usl_timer-Check-for-return-value-of-write-API.patch

> \

> +           "

>

>  LIC_FILES_CHKSUM = "file://LICENSE;md5=4c59283b82fc2b166455e0fc23c71c6f"

>  SRC_URI[md5sum] = "e2401e65db26a3764585b97212888fae"

> @@ -50,7 +50,7 @@ do_compile_prepend() {

>

>      # ignore the OPT_CFLAGS?= in Makefile,

>      # it should be in CFLAGS from env

> -    export OPT_CFLAGS=

> +    export OPT_CFLAGS="${SELECTED_OPTIMIZATION}"

>  }

>

>

> --

> 2.13.3

>

>

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Khem Raj July 19, 2017, 5:08 p.m. UTC | #2
No changes I thought I never send it out

On Wed, Jul 19, 2017 at 12:04 PM Martin Jansa <martin.jansa@gmail.com>
wrote:

> I've dropped this from master-next to check if the build failures we were

> discussing were caused by this. Did you change anything in here (is it v2

> or just resend)?

>

> On Wed, Jul 19, 2017 at 5:41 PM, Khem Raj <raj.khem@gmail.com> wrote:

>

>> Signed-off-by: Khem Raj <raj.khem@gmail.com>

>> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

>> ---

>>  ...timer-Check-for-return-value-of-write-API.patch | 28

>> ++++++++++++++++++++++

>>  .../recipes-daemons/ippool/ippool_1.3.bb           | 22

>> ++++++++---------

>>  2 files changed, 39 insertions(+), 11 deletions(-)

>>  create mode 100644

>> meta-networking/recipes-daemons/ippool/ippool/0001-usl_timer-Check-for-return-value-of-write-API.patch

>>

>> diff --git

>> a/meta-networking/recipes-daemons/ippool/ippool/0001-usl_timer-Check-for-return-value-of-write-API.patch

>> b/meta-networking/recipes-daemons/ippool/ippool/0001-usl_timer-Check-for-return-value-of-write-API.patch

>> new file mode 100644

>> index 000000000..6fb7cc5c4

>> --- /dev/null

>> +++

>> b/meta-networking/recipes-daemons/ippool/ippool/0001-usl_timer-Check-for-return-value-of-write-API.patch

>> @@ -0,0 +1,28 @@

>> +From 5d7f20c045b3c74dad2c53d65e30bd4840250082 Mon Sep 17 00:00:00 2001

>> +From: Khem Raj <raj.khem@gmail.com>

>> +Date: Tue, 27 Jun 2017 15:17:19 -0700

>> +Subject: [PATCH] usl_timer: Check for return value of write() API

>> +

>> +Signed-off-by: Khem Raj <raj.khem@gmail.com>

>> +---

>> + usl/usl_timer.c | 4 +++-

>> + 1 file changed, 3 insertions(+), 1 deletion(-)

>> +

>> +diff --git a/usl/usl_timer.c b/usl/usl_timer.c

>> +index fda752b..d8414a6 100644

>> +--- a/usl/usl_timer.c

>> ++++ b/usl/usl_timer.c

>> +@@ -94,7 +94,9 @@ void usl_timer_tick(void)

>> +

>> +       if (!usl_tick_pending) {

>> +               usl_tick_pending = 1;

>> +-              write(usl_tick_pipe[1], &msg, sizeof(msg));

>> ++              if (write(usl_tick_pipe[1], &msg, sizeof(msg)) !=

>> sizeof(msg)) {

>> ++                      fprintf(stderr, "write to fd %i failed: %s\n",

>> usl_tick_pipe[1], strerror(errno));

>> ++              }

>> +       }

>> + }

>> +

>> +--

>> +2.13.2

>> +

>> diff --git a/meta-networking/recipes-daemons/ippool/ippool_1.3.bb

>> b/meta-networking/recipes-daemons/ippool/ippool_1.3.bb

>> index 969f434cc..e1c9215ca 100644

>> --- a/meta-networking/recipes-daemons/ippool/ippool_1.3.bb

>> +++ b/meta-networking/recipes-daemons/ippool/ippool_1.3.bb

>> @@ -11,16 +11,16 @@ HOMEPAGE = "http://www.openl2tp.org/"

>>  SECTION = "console/network"

>>  LICENSE = "GPLv2+"

>>

>> -SRC_URI = "\

>> -

>> https://sourceforge.net/projects/openl2tp/files/${BPN}/${PV}/${BPN}-${PV}.tar.gz

>> \

>> -        file://ippool_usl_timer.patch \

>> -        file://ippool_parallel_make_and_pic.patch \

>> -        file://ippool_init.d.patch \

>> -        file://always_syslog.patch \

>> -        file://makefile-add-ldflags.patch \

>> -        file://runtest.sh \

>> -        file://ippool.service \

>> -        "

>> +SRC_URI = "

>> https://sourceforge.net/projects/openl2tp/files/${BPN}/${PV}/${BPN}-${PV}.tar.gz

>> \

>> +           file://runtest.sh \

>> +           file://ippool.service \

>> +           file://ippool_usl_timer.patch \

>> +           file://ippool_parallel_make_and_pic.patch \

>> +           file://ippool_init.d.patch \

>> +           file://always_syslog.patch \

>> +           file://makefile-add-ldflags.patch \

>> +

>>  file://0001-usl_timer-Check-for-return-value-of-write-API.patch \

>> +           "

>>

>>  LIC_FILES_CHKSUM = "file://LICENSE;md5=4c59283b82fc2b166455e0fc23c71c6f"

>>  SRC_URI[md5sum] = "e2401e65db26a3764585b97212888fae"

>> @@ -50,7 +50,7 @@ do_compile_prepend() {

>>

>>      # ignore the OPT_CFLAGS?= in Makefile,

>>      # it should be in CFLAGS from env

>> -    export OPT_CFLAGS=

>> +    export OPT_CFLAGS="${SELECTED_OPTIMIZATION}"

>>  }

>>

>>

>> --

>> 2.13.3

>>

>>

>

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
diff mbox series

Patch

diff --git a/meta-networking/recipes-daemons/ippool/ippool/0001-usl_timer-Check-for-return-value-of-write-API.patch b/meta-networking/recipes-daemons/ippool/ippool/0001-usl_timer-Check-for-return-value-of-write-API.patch
new file mode 100644
index 000000000..6fb7cc5c4
--- /dev/null
+++ b/meta-networking/recipes-daemons/ippool/ippool/0001-usl_timer-Check-for-return-value-of-write-API.patch
@@ -0,0 +1,28 @@ 
+From 5d7f20c045b3c74dad2c53d65e30bd4840250082 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 27 Jun 2017 15:17:19 -0700
+Subject: [PATCH] usl_timer: Check for return value of write() API
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ usl/usl_timer.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/usl/usl_timer.c b/usl/usl_timer.c
+index fda752b..d8414a6 100644
+--- a/usl/usl_timer.c
++++ b/usl/usl_timer.c
+@@ -94,7 +94,9 @@ void usl_timer_tick(void)
+ 
+ 	if (!usl_tick_pending) {
+ 		usl_tick_pending = 1;
+-		write(usl_tick_pipe[1], &msg, sizeof(msg));
++		if (write(usl_tick_pipe[1], &msg, sizeof(msg)) != sizeof(msg)) {
++			fprintf(stderr, "write to fd %i failed: %s\n", usl_tick_pipe[1], strerror(errno));
++		}
+ 	}
+ }
+ 
+-- 
+2.13.2
+
diff --git a/meta-networking/recipes-daemons/ippool/ippool_1.3.bb b/meta-networking/recipes-daemons/ippool/ippool_1.3.bb
index 969f434cc..e1c9215ca 100644
--- a/meta-networking/recipes-daemons/ippool/ippool_1.3.bb
+++ b/meta-networking/recipes-daemons/ippool/ippool_1.3.bb
@@ -11,16 +11,16 @@  HOMEPAGE = "http://www.openl2tp.org/"
 SECTION = "console/network"
 LICENSE = "GPLv2+"
 
-SRC_URI = "\
-        https://sourceforge.net/projects/openl2tp/files/${BPN}/${PV}/${BPN}-${PV}.tar.gz \
-        file://ippool_usl_timer.patch \
-        file://ippool_parallel_make_and_pic.patch \
-        file://ippool_init.d.patch \
-        file://always_syslog.patch \
-        file://makefile-add-ldflags.patch \
-        file://runtest.sh \
-        file://ippool.service \
-        "
+SRC_URI = "https://sourceforge.net/projects/openl2tp/files/${BPN}/${PV}/${BPN}-${PV}.tar.gz \
+           file://runtest.sh \
+           file://ippool.service \
+           file://ippool_usl_timer.patch \
+           file://ippool_parallel_make_and_pic.patch \
+           file://ippool_init.d.patch \
+           file://always_syslog.patch \
+           file://makefile-add-ldflags.patch \
+           file://0001-usl_timer-Check-for-return-value-of-write-API.patch \
+           "
 
 LIC_FILES_CHKSUM = "file://LICENSE;md5=4c59283b82fc2b166455e0fc23c71c6f"
 SRC_URI[md5sum] = "e2401e65db26a3764585b97212888fae"
@@ -50,7 +50,7 @@  do_compile_prepend() {
 
     # ignore the OPT_CFLAGS?= in Makefile,
     # it should be in CFLAGS from env
-    export OPT_CFLAGS=
+    export OPT_CFLAGS="${SELECTED_OPTIMIZATION}"
 }