diff --git a/meta-sysmocom-bsp/recipes-apps/images/image-static-dns.inc b/meta-sysmocom-bsp/recipes-apps/images/image-static-dns.inc index 26bae4985b..4147135686 100644 --- a/meta-sysmocom-bsp/recipes-apps/images/image-static-dns.inc +++ b/meta-sysmocom-bsp/recipes-apps/images/image-static-dns.inc @@ -8,22 +8,37 @@ DNSSEARCH = "${@d.getVar('DNS_SEARCH', True) or ''}" ROOTFS_POSTPROCESS_COMMAND += "set_static_dns;" set_static_dns() { - echo "#created by image-static-dns.inc" > ${IMAGE_ROOTFS}/etc/resolv.conf + printf "Replacing /etc/resolv.conf\n" + printf "#This default-file was generated by the image-static-dns hook\n \ +in the post-image setup.\n\n" > ${IMAGE_ROOTFS}/etc/resolv.conf if [ -n "${DNSSERVER}" ]; then printf "setting DNS-server\n" - echo "nameserver ${DNSSERVER}" >> ${IMAGE_ROOTFS}/etc/resolv.conf + printf "nameserver %s\n" "${DNSSERVER}" >> ${IMAGE_ROOTFS}/etc/resolv.conf fi if [ -n "${DNSDOMAIN}" ]; then printf "setting DNS-domain\n" - echo "domain ${DNSDOMAIN}" >> ${IMAGE_ROOTFS}/etc/resolv.conf + printf "domain %s\n" "${DNSDOMAIN}" >> ${IMAGE_ROOTFS}/etc/resolv.conf fi if [ -n "${DNSSEARCH}" ]; then - printf "seting DNS-search\n" - echo "search ${DNSSEARCH}" >> ${IMAGE_ROOTFS}/etc/resolv.conf + printf "setting DNS-search\n" + printf "search %s\n" "${DNSSEARCH}" >> ${IMAGE_ROOTFS}/etc/resolv.conf fi - if [ -w ${IMAGE_ROOTFS}/default/udhcpc ]; then - sed -i -e "s/^#.*\(STATIC_DNS\).*$/\1=yes/g" ${IMAGE_ROOTFS}/default/udhcpc + if [ -w ${IMAGE_ROOTFS}/etc/default/udhcpc ]; then + printf "Configure the installed udhcpc for static DNS\n" + STATIC_DNS_TEXT="# The static-dns configuration was generated by the image-static-dns hook." + sed -i -e "s/^#.*\(STATIC_DNS\).*$/${STATIC_DNS_TEXT}\n\1=\"yes\"/g" ${IMAGE_ROOTFS}/etc/default/udhcpc + else + printf "Configure the not installed udhcpc for static DNS\n" + mkdir -p ${IMAGE_ROOTFS}/etc/default + cat << EOF > ${IMAGE_ROOTFS}/etc/default/udhcpc +#This default-file was generated by the image-static-dns hook, +#in the post-image setup. +# +#When udhcpc is installed one setup needs to be chosen. + +STATIC_DNS="yes" +EOF fi } diff --git a/meta-sysmocom-bsp/recipes-bsp/linux/files/sysmobts-v2/defconfig b/meta-sysmocom-bsp/recipes-bsp/linux/files/sysmobts-v2/defconfig index d32a978bae..a1970dd5c8 100644 --- a/meta-sysmocom-bsp/recipes-bsp/linux/files/sysmobts-v2/defconfig +++ b/meta-sysmocom-bsp/recipes-bsp/linux/files/sysmobts-v2/defconfig @@ -1693,7 +1693,11 @@ CONFIG_IRQCHIP=y # # CONFIG_EXT2_FS is not set # CONFIG_EXT3_FS is not set -# CONFIG_EXT4_FS is not set +CONFIG_EXT3_FS=y +CONFIG_EXT3_DEFAULTS_TO_ORDERED=y +CONFIG_EXT4_FS=y +CONFIG_JBD=y +CONFIG_JBD2=y # CONFIG_REISERFS_FS is not set # CONFIG_JFS_FS is not set # CONFIG_XFS_FS is not set diff --git a/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-Fix-memory-leak-in-stdout-journal-streams.patch b/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-Fix-memory-leak-in-stdout-journal-streams.patch new file mode 100644 index 0000000000..5271de71aa --- /dev/null +++ b/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-Fix-memory-leak-in-stdout-journal-streams.patch @@ -0,0 +1,23 @@ +From f92ae4968f070ef0ada61ba7cd585794fac404dd Mon Sep 17 00:00:00 2001 +From: Dan McGee +Date: Sun, 8 Dec 2013 14:33:45 -0600 +Subject: [PATCH] Fix memory leak in stdout journal streams + +Just as 'identifier' is strdup-ed and freed, we need to do the same for +unit_id. +--- + src/journal/journald-stream.c | 1 + + 1 file changed, 1 insertion(+) + +Index: systemd-206/src/journal/journald-stream.c +=================================================================== +--- systemd-206.orig/src/journal/journald-stream.c ++++ systemd-206/src/journal/journald-stream.c +@@ -339,6 +339,7 @@ void stdout_stream_free(StdoutStream *s) + #endif + + free(s->identifier); ++ free(s->unit_id); + free(s); + } + diff --git a/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-journal-fix-hashmap-leak-in-mmap-cache.patch b/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-journal-fix-hashmap-leak-in-mmap-cache.patch new file mode 100644 index 0000000000..d3984e8600 --- /dev/null +++ b/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-journal-fix-hashmap-leak-in-mmap-cache.patch @@ -0,0 +1,37 @@ +From 8e6d9397b550f5617fc9231e3a275348cda23c89 Mon Sep 17 00:00:00 2001 +From: George McCollister +Date: Thu, 1 Aug 2013 12:40:01 -0500 +Subject: [PATCH] journal: fix hashmap leak in mmap-cache + +hashmap_free() wasn't being called on m->contexts and m->fds resulting +in a leak. + +To reproduce do: + while(1) { + sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY); + sd_journal_close(j); + } + +Memory usage will increase until OOM. +--- + src/journal/mmap-cache.c | 4 ++++ + 1 file changed, 4 insertions(+) + +Index: systemd-206/src/journal/mmap-cache.c +=================================================================== +--- systemd-206.orig/src/journal/mmap-cache.c ++++ systemd-206/src/journal/mmap-cache.c +@@ -307,9 +307,13 @@ static void mmap_cache_free(MMapCache *m + while ((c = hashmap_first(m->contexts))) + context_free(c); + ++ hashmap_free(m->contexts); ++ + while ((f = hashmap_first(m->fds))) + fd_free(f); + ++ hashmap_free(m->fds); ++ + while (m->unused) + window_free(m->unused); + diff --git a/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-journal-fix-minor-memory-leak.patch b/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-journal-fix-minor-memory-leak.patch new file mode 100644 index 0000000000..66b4974c41 --- /dev/null +++ b/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-journal-fix-minor-memory-leak.patch @@ -0,0 +1,25 @@ +From baabc09191178a1d1a7454cd1b601a98dcb22976 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 8 Nov 2013 13:53:25 +0100 +Subject: [PATCH] journal: fix minor memory leak + +--- + src/journal/sd-journal.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c +index 3ccb14a..4579e9e 100644 +--- a/src/journal/sd-journal.c ++++ b/src/journal/sd-journal.c +@@ -1276,7 +1276,7 @@ static void check_network(sd_journal *j, int fd) { + static bool file_has_type_prefix(const char *prefix, const char *filename) { + const char *full, *tilded, *atted; + +- full = strappend(prefix, ".journal"); ++ full = strappenda(prefix, ".journal"); + tilded = strappenda(full, "~"); + atted = strappenda(prefix, "@"); + +-- +1.9.1 + diff --git a/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-journald-accept-EPOLLERR-from-dev-kmsg.patch b/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-journald-accept-EPOLLERR-from-dev-kmsg.patch new file mode 100644 index 0000000000..dacc707b04 --- /dev/null +++ b/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-journald-accept-EPOLLERR-from-dev-kmsg.patch @@ -0,0 +1,70 @@ +From 5843c5ebb4341382ae9c87e93c2c87467e573548 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Thu, 19 Sep 2013 16:57:57 -0500 +Subject: [PATCH] journald: accept EPOLLERR from /dev/kmsg + +Also print out unexpected epoll events explictly. +--- + src/journal/journald-server.c | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +Index: systemd-206/src/journal/journald-server.c +=================================================================== +--- systemd-206.orig/src/journal/journald-server.c ++++ systemd-206/src/journal/journald-server.c +@@ -1075,7 +1075,8 @@ int process_event(Server *s, struct epol + ssize_t n; + + if (ev->events != EPOLLIN) { +- log_error("Got invalid event from epoll."); ++ log_error("Got invalid event from epoll for %s: %"PRIx32, ++ "signal fd", ev->events); + return -EIO; + } + +@@ -1124,8 +1125,12 @@ int process_event(Server *s, struct epol + } else if (ev->data.fd == s->dev_kmsg_fd) { + int r; + +- if (ev->events != EPOLLIN) { +- log_error("Got invalid event from epoll."); ++ if (ev->events & EPOLLERR) ++ log_warning("/dev/kmsg buffer overrun, some messages lost."); ++ ++ if (!(ev->events & EPOLLIN)) { ++ log_error("Got invalid event from epoll for %s: %"PRIx32, ++ "/dev/kmsg", ev->events); + return -EIO; + } + +@@ -1139,7 +1144,9 @@ int process_event(Server *s, struct epol + ev->data.fd == s->syslog_fd) { + + if (ev->events != EPOLLIN) { +- log_error("Got invalid event from epoll."); ++ log_error("Got invalid event from epoll for %s: %"PRIx32, ++ ev->data.fd == s->native_fd ? "native fd" : "syslog fd", ++ ev->events); + return -EIO; + } + +@@ -1267,7 +1274,8 @@ int process_event(Server *s, struct epol + } else if (ev->data.fd == s->stdout_fd) { + + if (ev->events != EPOLLIN) { +- log_error("Got invalid event from epoll."); ++ log_error("Got invalid event from epoll for %s: %"PRIx32, ++ "stdout fd", ev->events); + return -EIO; + } + +@@ -1278,7 +1286,8 @@ int process_event(Server *s, struct epol + StdoutStream *stream; + + if ((ev->events|EPOLLIN|EPOLLHUP) != (EPOLLIN|EPOLLHUP)) { +- log_error("Got invalid event from epoll."); ++ log_error("Got invalid event from epoll for %s: %"PRIx32, ++ "stdout stream", ev->events); + return -EIO; + } + diff --git a/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-journald-fix-minor-memory-leak.patch b/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-journald-fix-minor-memory-leak.patch new file mode 100644 index 0000000000..82dc9ff052 --- /dev/null +++ b/meta-sysmocom-bsp/recipes-fixes/systemd/systemd/0001-journald-fix-minor-memory-leak.patch @@ -0,0 +1,23 @@ +From 2ee0591d12b9e725c4585502285fd91cde682d9b Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 9 Oct 2013 04:03:45 +0200 +Subject: [PATCH] journald: fix minor memory leak + +--- + src/journal/journal-vacuum.c | 2 ++ + 1 file changed, 2 insertions(+) + +Index: systemd-206/src/journal/journal-vacuum.c +=================================================================== +--- systemd-206.orig/src/journal/journal-vacuum.c ++++ systemd-206/src/journal/journal-vacuum.c +@@ -273,6 +273,9 @@ int journal_directory_vacuum( + log_debug("Deleted empty journal %s/%s.", directory, p); + else if (errno != ENOENT) + log_warning("Failed to delete %s/%s: %m", directory, p); ++ ++ free(p); ++ + continue; + } + diff --git a/meta-sysmocom-bsp/recipes-fixes/systemd/systemd_sysmocom-206.inc b/meta-sysmocom-bsp/recipes-fixes/systemd/systemd_sysmocom-206.inc index c60cb95e91..e790729481 100644 --- a/meta-sysmocom-bsp/recipes-fixes/systemd/systemd_sysmocom-206.inc +++ b/meta-sysmocom-bsp/recipes-fixes/systemd/systemd_sysmocom-206.inc @@ -1,3 +1,8 @@ SRC_URI += " \ file://0001-RFC-fsck-Allow-to-specify-the-fsck-repair-option-in-.patch \ + file://0001-journal-fix-hashmap-leak-in-mmap-cache.patch \ + file://0001-journald-fix-minor-memory-leak.patch \ + file://0001-journald-accept-EPOLLERR-from-dev-kmsg.patch \ + file://0001-journal-fix-minor-memory-leak.patch \ + file://0001-Fix-memory-leak-in-stdout-journal-streams.patch \ "