[rtems-libbsd commit] Disable HHOOK(9) support for sockets
Sebastian Huber
sebh at rtems.org
Fri Nov 10 12:00:20 UTC 2017
Module: rtems-libbsd
Branch: master
Commit: 057656b706d159bd4b8f09a229191c1338f9a2a9
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=057656b706d159bd4b8f09a229191c1338f9a2a9
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Nov 10 11:15:35 2017 +0100
Disable HHOOK(9) support for sockets
Support was only partly disabled leading to NULL pointer accesses.
Disable it completely.
---
freebsd/sys/kern/uipc_socket.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/freebsd/sys/kern/uipc_socket.c b/freebsd/sys/kern/uipc_socket.c
index 5c2ff57..d64f9ed 100644
--- a/freebsd/sys/kern/uipc_socket.c
+++ b/freebsd/sys/kern/uipc_socket.c
@@ -197,8 +197,10 @@ MALLOC_DEFINE(M_PCB, "pcb", "protocol control block");
VNET_ASSERT(curvnet != NULL, \
("%s:%d curvnet is NULL, so=%p", __func__, __LINE__, (so)));
+#ifndef __rtems__
VNET_DEFINE(struct hhook_head *, socket_hhh[HHOOK_SOCKET_LAST + 1]);
#define V_socket_hhh VNET(socket_hhh)
+#endif /* __rtems__ */
/*
* Limit on the number of connections in the listen queue waiting
@@ -2455,6 +2457,7 @@ sorflush(struct socket *so)
static int inline
hhook_run_socket(struct socket *so, void *hctx, int32_t h_id)
{
+#ifndef __rtems__
struct socket_hhook_data hhook_data = {
.so = so,
.hctx = hctx,
@@ -2468,6 +2471,9 @@ hhook_run_socket(struct socket *so, void *hctx, int32_t h_id)
/* Ugly but needed, since hhooks return void for now */
return (hhook_data.status);
+#else /* __rtems__ */
+ return (0);
+#endif /* __rtems__ */
}
/*
@@ -2735,10 +2741,12 @@ sosetopt(struct socket *so, struct sockopt *sopt)
break;
default:
+#ifndef __rtems__
if (V_socket_hhh[HHOOK_SOCKET_OPT]->hhh_nhooks > 0)
error = hhook_run_socket(so, sopt,
HHOOK_SOCKET_OPT);
else
+#endif /* __rtems__ */
error = ENOPROTOOPT;
break;
}
@@ -2930,10 +2938,12 @@ integer:
goto integer;
default:
+#ifndef __rtems__
if (V_socket_hhh[HHOOK_SOCKET_OPT]->hhh_nhooks > 0)
error = hhook_run_socket(so, sopt,
HHOOK_SOCKET_OPT);
else
+#endif /* __rtems__ */
error = ENOPROTOOPT;
break;
}
More information about the vc
mailing list