forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lkl: integrate with zpoline for alternate hijack backend
This commit introduces an integration with zpoline (*1), which is a mechanism to rewrite binary upon loading. zpoline allows us to replace symbols of system call to different functions, which current LKL hijack library does the same thing in a different way, by using symbol replacement via LD_PRELOAD. The benefit of zpoline is that the replacement of syscall is at the instruction of `syscall` or `sysenter`, which userspace program can catch all syscalls, while the approach based on LD_PRELOAD cannot when the symbols of interet are hidden within libc (e.g., __socket). For more detail about the internal of zpoline, take a look at *1. *1: https://github.com/yasukata/zpoline Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
- Loading branch information
Showing
14 changed files
with
420 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
liblkl-hijack-y += preload.o | ||
liblkl-hijack-y += hijack.o | ||
liblkl-hijack-y += init.o | ||
liblkl-hijack-y += xlate.o | ||
|
||
liblkl-zpoline-y += zpoline.o | ||
liblkl-zpoline-y += hijack.o | ||
liblkl-zpoline-y += init.o | ||
liblkl-zpoline-y += xlate.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
|
||
#include <sys/socket.h> | ||
#include <sys/epoll.h> | ||
#include <poll.h> | ||
|
||
|
||
int is_lklfd(int fd); | ||
int hijack_setsockopt(int fd, int level, int optname, const void *optval, | ||
socklen_t optlen); | ||
int hijack_getsockopt(int fd, int level, int optname, void *optval, socklen_t *optlen); | ||
int hijack_poll(struct pollfd *fds, nfds_t nfds, int timeout); | ||
int hijack_select(int nfds, fd_set *r, fd_set *w, fd_set *e, struct timeval *t); | ||
int hijack_eventfd(unsigned int count, int flags); | ||
int hijack_epoll_create(int size); | ||
int hijack_epoll_create1(int flags); | ||
int hijack_epoll_ctl(int epollfd, int op, int fd, struct epoll_event *event); | ||
int hijack_epoll_wait(int epfd, struct epoll_event *events, | ||
int maxevents, int timeout); | ||
int hijack_eventfd_read(int fd, uint64_t *value); | ||
int hijack_eventfd_write(int fd, uint64_t value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.