Skip to content

Commit

Permalink
recv(),send(): Directly call interposing entry instead of going throu…
Browse files Browse the repository at this point in the history
…gh PLT.

recv() and send()'s calls to recvfrom() and sendto() are much like
waitpid()'s call to wait4(), and likewise need not allow PLT interposing on
the called function.
  • Loading branch information
jillest committed May 10, 2015
1 parent ae16c58 commit 8ae6fa0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/libc/net/recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/socket.h>
#include "libc_private.h"

#include <stddef.h>

Expand All @@ -48,5 +49,8 @@ recv(s, buf, len, flags)
* POSIX says recv() shall be a cancellation point, so call the
* cancellation-enabled recvfrom() and not _recvfrom().
*/
return (recvfrom(s, buf, len, flags, NULL, 0));
return (((ssize_t (*)(int, void *, size_t, int,
struct sockaddr *, socklen_t *))
__libc_interposing[INTERPOS_recvfrom])(s, buf, len, flags,
NULL, NULL));
}
6 changes: 5 additions & 1 deletion lib/libc/net/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/socket.h>
#include "libc_private.h"

#include <stddef.h>

Expand All @@ -48,5 +49,8 @@ send(s, msg, len, flags)
* POSIX says send() shall be a cancellation point, so call the
* cancellation-enabled sendto() and not _sendto().
*/
return (sendto(s, msg, len, flags, NULL, 0));
return (((ssize_t (*)(int, const void *, size_t, int,
const struct sockaddr *, socklen_t))
__libc_interposing[INTERPOS_sendto])(s, msg, len, flags,
NULL, 0));
}

0 comments on commit 8ae6fa0

Please sign in to comment.