[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #51990] Calling select() from different threads with M

From: Joel Cunningham
Subject: [lwip-devel] [bug #51990] Calling select() from different threads with MPU enabled triggers memory protection fault
Date: Mon, 11 Sep 2017 12:26:13 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #1, bug #51990 (project lwip):


I did an initial code review, things looked good.  Only a couple really minors

--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -50,7 +50,6 @@
 #include "lwip/sockets.h"
 #include "lwip/api.h"
-#include "lwip/sys.h"
 #include "lwip/igmp.h"
 #include "lwip/inet.h"
 #include "lwip/tcp.h"

We'll want to keep lwip/sys.h as there is other code in sockets.c using things
in the header

@@ -77,6 +76,13 @@
 #define LWIP_NETCONN 0
+#define API_SELECT_CB_VAR_REF(name)               API_VAR_REF(name)
+#define API_SELECT_CB_VAR_DECLARE(name)           API_VAR_DECLARE(struct
lwip_select_cb, name)
+#define API_SELECT_CB_VAR_ALLOC(name)             API_VAR_ALLOC(struct
lwip_select_cb, MEMP_SELECT_CB, name, ERR_MEM)
lwip_select_cb, MEMP_SELECT_CB, name, NULL)
+#define API_SELECT_CB_VAR_FREE(name)             

Extra newline here

+ * MEMP_NUM_SELECT_CB: the number of struct lwip_select_cb.
+ * (only needed if you use the sequential API, like api_lib.c)
+ */
+#if !defined MEMP_NUM_SELECT_CB || defined __DOXYGEN__
+#define MEMP_NUM_SELECT_CB              4

I think for the comment on this option, we'll want to mention 'only needed if
you use the sockets API', since select is not available when only using
netconn API

Couple notes when porting this fix to master:
1) We'll want to put struct lwip_select_cb and SELECT_ macros in
sockets_priv.h rather than public API
2) MEMP_NUM_SELECT_CB memory pool will need to be guarded by #if


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]