From b1bf2bdc12f6878314ddf2e6c70fd1da0a1f020f Mon Sep 17 00:00:00 2001 From: Nagy Karoly Gabriel Date: Thu, 12 Feb 2015 18:18:08 +0100 Subject: [PATCH] openvswitch: added musl fixes. --- .../0001-ovs-thread-Set-stacksize-to-1M.patch | 76 +++++++++++++++++++ .../musl/pkg/openvswitch/musl-if_packet.patch | 32 ++++++++ 2 files changed, 108 insertions(+) create mode 100644 base/musl/pkg/openvswitch/0001-ovs-thread-Set-stacksize-to-1M.patch create mode 100644 base/musl/pkg/openvswitch/musl-if_packet.patch diff --git a/base/musl/pkg/openvswitch/0001-ovs-thread-Set-stacksize-to-1M.patch b/base/musl/pkg/openvswitch/0001-ovs-thread-Set-stacksize-to-1M.patch new file mode 100644 index 000000000..22c2e12c3 --- /dev/null +++ b/base/musl/pkg/openvswitch/0001-ovs-thread-Set-stacksize-to-1M.patch @@ -0,0 +1,76 @@ +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: package/.../musl/pkg/openvswitch/0001-ovs-thread-Set-stacksize-to-1M.patch +# Copyright (C) 2015 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This patch file is dual-licensed. It is available under the license the +# patched project is licensed under, as long as it is an OpenSource license +# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms +# of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# --- SDE-COPYRIGHT-NOTE-END --- + +From 92ae6e162812876c082fd9d05a0eeac062f832ae Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Mon, 25 Aug 2014 08:50:26 +0000 +Subject: [PATCH] ovs-thread: Set stacksize to 1M + +With musl libc the default stacksize is 80k which is too small and +makes it segfault. + +We increase it to 1MB. +http://permalink.gmane.org/gmane.linux.network.openvswitch.general/5831 + +Signed-off-by: Natanael Copa +--- + lib/ovs-thread.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff -ru openvswitch-2.3.0.orig/lib/ovs-thread.c openvswitch-2.3.0/lib/ovs-thread.c +--- openvswitch-2.3.0.orig/lib/ovs-thread.c 2014-10-02 14:37:47.196714056 -0300 ++++ openvswitch-2.3.0/lib/ovs-thread.c 2014-10-02 14:38:10.826714288 -0300 +@@ -28,6 +28,9 @@ + #include "socket-util.h" + #include "util.h" + ++/* set default stack size to 1M */ ++#define OVS_STACK_SIZE (1024 * 1024) ++ + #ifdef __CHECKER__ + /* Omit the definitions in this file because they are somewhat difficult to + * write without prompting "sparse" complaints, without ugliness or +@@ -329,6 +332,7 @@ + { + struct ovsthread_aux *aux; + pthread_t thread; ++ pthread_attr_t attr; + int error; + + forbid_forking("multiple threads exist"); +@@ -340,10 +344,21 @@ + aux->arg = arg; + ovs_strlcpy(aux->name, name, sizeof aux->name); + +- error = pthread_create(&thread, NULL, ovsthread_wrapper, aux); ++ error = pthread_attr_init(&attr); ++ if (error) { ++ ovs_abort(error, "pthread_attr_init failed"); ++ } ++ error = pthread_attr_setstacksize(&attr, OVS_STACK_SIZE); ++ if (error) { ++ ovs_abort(error, "pthread_attr_setstacksize failed"); ++ } ++ ++ error = pthread_create(&thread, &attr, ovsthread_wrapper, aux); + if (error) { + ovs_abort(error, "pthread_create failed"); + } ++ pthread_attr_destroy(&attr); ++ + return thread; + } + diff --git a/base/musl/pkg/openvswitch/musl-if_packet.patch b/base/musl/pkg/openvswitch/musl-if_packet.patch new file mode 100644 index 000000000..c5a4d212f --- /dev/null +++ b/base/musl/pkg/openvswitch/musl-if_packet.patch @@ -0,0 +1,32 @@ +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: package/.../musl/pkg/openvswitch/musl-if_packet.patch +# Copyright (C) 2015 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This patch file is dual-licensed. It is available under the license the +# patched project is licensed under, as long as it is an OpenSource license +# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms +# of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# --- SDE-COPYRIGHT-NOTE-END --- + +This patch originates here: +http://git.alpinelinux.org/cgit/aports/plain/main/openvswitch/musl-if_packet.patch +--- ./lib/netdev-linux.c.orig ++++ ./lib/netdev-linux.c +@@ -37,10 +37,9 @@ + #include + #include + #include +-#include + #include + #include +-#include ++#include + #include + #include + #include