diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2020-02-05 11:32:14 +0100 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2020-02-05 11:32:14 +0100 |
commit | 35c7f435e4c3c5f71fbce9efed24455e50f2b07e (patch) | |
tree | 49c50b7ec49e68666a4caa83d3be3f9d391acf4d | |
parent | 65ad766e9c017123124323fde73842415fdceb30 (diff) | |
download | ptxdist-35c7f435e4c3c5f71fbce9efed24455e50f2b07e.tar.gz ptxdist-35c7f435e4c3c5f71fbce9efed24455e50f2b07e.tar.xz |
weston: add upstream fixes for older glibc
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
3 files changed, 98 insertions, 0 deletions
diff --git a/patches/weston-8.0.0/0001-unconditionally-include-sys-mman.h-in-os-compatibili.patch b/patches/weston-8.0.0/0001-unconditionally-include-sys-mman.h-in-os-compatibili.patch new file mode 100644 index 000000000..1486121e7 --- /dev/null +++ b/patches/weston-8.0.0/0001-unconditionally-include-sys-mman.h-in-os-compatibili.patch @@ -0,0 +1,33 @@ +From: James Hilliard <james.hilliard1@gmail.com> +Date: Sat, 1 Feb 2020 20:02:29 -0700 +Subject: [PATCH] unconditionally include sys/mman.h in os-compatibility.c +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fixes: +../shared/os-compatibility.c:273:25: error: ‘PROT_READ’ undeclared (first use in this function); did you mean ‘LOCK_READ’? + map = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, file->fd, 0); + ^~~~~~~~~ + LOCK_READ + +Signed-off-by: James Hilliard <james.hilliard1@gmail.com> +--- + shared/os-compatibility.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/shared/os-compatibility.c b/shared/os-compatibility.c +index 5e1ce4793cec..041c929f83e5 100644 +--- a/shared/os-compatibility.c ++++ b/shared/os-compatibility.c +@@ -34,10 +34,7 @@ + #include <string.h> + #include <stdlib.h> + #include <libweston/zalloc.h> +- +-#ifdef HAVE_MEMFD_CREATE + #include <sys/mman.h> +-#endif + + #include "os-compatibility.h" + diff --git a/patches/weston-8.0.0/0002-shared-guard-all-the-seal-logic-behind-HAVE_MEMFD_CR.patch b/patches/weston-8.0.0/0002-shared-guard-all-the-seal-logic-behind-HAVE_MEMFD_CR.patch new file mode 100644 index 000000000..82d25b00d --- /dev/null +++ b/patches/weston-8.0.0/0002-shared-guard-all-the-seal-logic-behind-HAVE_MEMFD_CR.patch @@ -0,0 +1,60 @@ +From: Sebastian Wick <sebastian@sebastianwick.net> +Date: Wed, 5 Feb 2020 10:27:23 +0100 +Subject: [PATCH] shared: guard all the seal logic behind HAVE_MEMFD_CREATE + +The initial version of os_ro_anonymous_file missed two guards around the +seal logic which leads to a compilation error on older systems. + +Also make the check for a read-only file symmetric in +os_ro_anonymous_file_get_fd and os_ro_anonymous_file_put_fd. + +Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net> +--- + shared/os-compatibility.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/shared/os-compatibility.c b/shared/os-compatibility.c +index 041c929f83e5..2e12b7cc3626 100644 +--- a/shared/os-compatibility.c ++++ b/shared/os-compatibility.c +@@ -340,6 +340,7 @@ os_ro_anonymous_file_get_fd(struct ro_anonymous_file *file, + void *src, *dst; + int seals, fd; + ++#ifdef HAVE_MEMFD_CREATE + seals = fcntl(file->fd, F_GET_SEALS); + + /* file was sealed for read-only and we don't have to support MAP_SHARED +@@ -348,6 +349,7 @@ os_ro_anonymous_file_get_fd(struct ro_anonymous_file *file, + if (seals != -1 && mapmode == RO_ANONYMOUS_FILE_MAPMODE_PRIVATE && + (seals & READONLY_SEALS) == READONLY_SEALS) + return file->fd; ++#endif + + /* for all other cases we create a new anonymous file that can be mapped + * with MAP_SHARED and copy the contents to it and return that instead +@@ -388,17 +390,18 @@ os_ro_anonymous_file_get_fd(struct ro_anonymous_file *file, + int + os_ro_anonymous_file_put_fd(int fd) + { ++#ifdef HAVE_MEMFD_CREATE + int seals = fcntl(fd, F_GET_SEALS); + if (seals == -1 && errno != EINVAL) + return -1; + +- /* If the fd cannot be sealed seals is -1 at this point +- * or the file can be sealed but has not been sealed for writing. +- * In both cases we created a new anonymous file that we have to +- * close. ++ /* The only case in which we do NOT have to close the file is when the file ++ * was sealed for read-only + */ +- if (seals == -1 || !(seals & F_SEAL_WRITE)) +- close(fd); ++ if (seals != -1 && (seals & READONLY_SEALS) == READONLY_SEALS) ++ return 0; ++#endif + ++ close(fd); + return 0; + } diff --git a/patches/weston-8.0.0/series b/patches/weston-8.0.0/series new file mode 100644 index 000000000..ed045c3f9 --- /dev/null +++ b/patches/weston-8.0.0/series @@ -0,0 +1,5 @@ +# generated by git-ptx-patches +#tag:base --start-number 1 +0001-unconditionally-include-sys-mman.h-in-os-compatibili.patch +0002-shared-guard-all-the-seal-logic-behind-HAVE_MEMFD_CR.patch +# bb3fbf767cc2393f046e3c397089bedb - git-ptx-patches magic |