gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated: internal.h: hack member placement


From: gnunet
Subject: [libmicrohttpd] branch master updated: internal.h: hack member placement in struct MHD_Daemon to avoid Address Sanitizer warnings and avoid potential problems on architectures that do not support unaligned access. Proper fix should include introduction of __attribute__ ((alligned(x)))
Date: Thu, 29 Oct 2020 14:59:23 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new 5876da15 internal.h: hack member placement in struct MHD_Daemon to 
avoid Address Sanitizer warnings and avoid potential problems on architectures 
that do not support unaligned access. Proper fix should include introduction of 
__attribute__ ((alligned(x)))
5876da15 is described below

commit 5876da15e6f788d8c8619b7521686917008dac18
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Thu Oct 29 16:50:59 2020 +0300

    internal.h: hack member placement in struct MHD_Daemon to
    avoid Address Sanitizer warnings and avoid potential
    problems on architectures that do not support unaligned
    access.
    Proper fix should include introduction of
    __attribute__ ((alligned(x)))
---
 src/microhttpd/internal.h | 107 ++++++++++++++++++++++++++--------------------
 1 file changed, 60 insertions(+), 47 deletions(-)

diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 3b044984..8ecd4ed6 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1301,6 +1301,14 @@ struct MHD_Daemon
    */
   void *default_handler_cls;
 
+  /**
+   * Daemon's flags (bitfield).
+   *
+   * @remark Keep this member after pointer value to keep it
+   * properly aligned as it will be used as member of union MHD_DaemonInfo.
+   */
+  enum MHD_FLAG options;
+
   /**
    * Head of doubly-linked list of new, externally added connections.
    */
@@ -1352,7 +1360,35 @@ struct MHD_Daemon
    */
   struct MHD_Connection *eready_tail;
 
+  /**
+   * File descriptor associated with our epoll loop.
+   *
+   * @remark Keep this member after pointer value to keep it
+   * properly aligned as it will be used as member of union MHD_DaemonInfo.
+   */
+  int epoll_fd;
+
+  /**
+   * true if the listen socket is in the 'epoll' set,
+   * false if not.
+   */
+  bool listen_socket_in_epoll;
+
 #ifdef UPGRADE_SUPPORT
+#ifdef HTTPS_SUPPORT
+  /**
+   * File descriptor associated with the #run_epoll_for_upgrade() loop.
+   * Only available if #MHD_USE_HTTPS_EPOLL_UPGRADE is set.
+   */
+  int epoll_upgrade_fd;
+
+  /**
+   * true if @e epoll_upgrade_fd is in the 'epoll' set,
+   * false if not.
+   */
+  bool upgrade_fd_in_epoll;
+#endif /* HTTPS_SUPPORT */
+
   /**
    * Head of EDLL of upgraded connections ready for processing (in epoll mode).
    */
@@ -1460,6 +1496,14 @@ struct MHD_Daemon
    */
   void *unescape_callback_cls;
 
+  /**
+   * Listen port.
+   *
+   * @remark Keep this member after pointer value to keep it
+   * properly aligned as it will be used as member of union MHD_DaemonInfo.
+   */
+  uint16_t port;
+
 #ifdef HAVE_MESSAGES
   /**
    * Function for logging error messages (if we
@@ -1478,6 +1522,14 @@ struct MHD_Daemon
    */
   struct MHD_Daemon *master;
 
+  /**
+   * Listen socket.
+   *
+   * @remark Keep this member after pointer value to keep it
+   * properly aligned as it will be used as member of union MHD_DaemonInfo.
+   */
+  MHD_socket listen_fd;
+
 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
   /**
    * Worker daemons (one per thread)
@@ -1490,6 +1542,14 @@ struct MHD_Daemon
    */
   void *per_ip_connection_count;
 
+  /**
+   * Number of active parallel connections.
+   *
+   * @remark Keep this member after pointer value to keep it
+   * properly aligned as it will be used as member of union MHD_DaemonInfo.
+   */
+  unsigned int connections;
+
   /**
    * Size of the per-connection memory pools.
    */
@@ -1539,11 +1599,6 @@ struct MHD_Daemon
    */
   enum MHD_DisableSanityCheck insanity_level;
 
-  /**
-   * Listen socket.
-   */
-  MHD_socket listen_fd;
-
   /**
    * Whether to allow/disallow/ignore reuse of listening address.
    * The semantics is the following:
@@ -1555,33 +1610,6 @@ struct MHD_Daemon
    */
   int listening_address_reuse;
 
-#ifdef EPOLL_SUPPORT
-  /**
-   * File descriptor associated with our epoll loop.
-   */
-  int epoll_fd;
-
-  /**
-   * true if the listen socket is in the 'epoll' set,
-   * false if not.
-   */
-  bool listen_socket_in_epoll;
-
-#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
-  /**
-   * File descriptor associated with the #run_epoll_for_upgrade() loop.
-   * Only available if #MHD_USE_HTTPS_EPOLL_UPGRADE is set.
-   */
-  int epoll_upgrade_fd;
-
-  /**
-   * true if @e epoll_upgrade_fd is in the 'epoll' set,
-   * false if not.
-   */
-  bool upgrade_fd_in_epoll;
-#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
-
-#endif
 
   /**
    * Inter-thread communication channel (also used to unblock
@@ -1632,11 +1660,6 @@ struct MHD_Daemon
    */
   bool data_already_pending;
 
-  /**
-   * Number of active parallel connections.
-   */
-  unsigned int connections;
-
   /**
    * Limit on the number of parallel connections.
    */
@@ -1654,16 +1677,6 @@ struct MHD_Daemon
    */
   unsigned int per_ip_connection_limit;
 
-  /**
-   * Daemon's flags (bitfield).
-   */
-  enum MHD_FLAG options;
-
-  /**
-   * Listen port.
-   */
-  uint16_t port;
-
   /**
    * Be neutral (zero), strict (1) or permissive (-1) to client.
    */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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