Skip to content

Revert "[compiler-rt][rtsan] fopencookie support." #121537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,6 @@ INTERCEPTOR(FILE *, fdopen, int fd, const char *mode) {
return REAL(fdopen)(fd, mode);
}

INTERCEPTOR(FILE *, fopencookie, void *cookie, const char *mode,
cookie_io_functions_t funcs) {
__rtsan_notify_intercepted_call("fopencookie");
return REAL(fopencookie)(cookie, mode, funcs);
}

#if SANITIZER_INTERCEPT_OPEN_MEMSTREAM
INTERCEPTOR(FILE *, open_memstream, char **buf, size_t *size) {
__rtsan_notify_intercepted_call("open_memstream");
Expand Down Expand Up @@ -978,7 +972,6 @@ void __rtsan::InitializeInterceptors() {
INTERCEPT_FUNCTION(fputs);
INTERCEPT_FUNCTION(fdopen);
INTERCEPT_FUNCTION(freopen);
INTERCEPT_FUNCTION(fopencookie);
RTSAN_MAYBE_INTERCEPT_OPEN_MEMSTREAM;
RTSAN_MAYBE_INTERCEPT_FMEMOPEN;
INTERCEPT_FUNCTION(lseek);
Expand Down
23 changes: 0 additions & 23 deletions compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,29 +353,6 @@ TEST_F(RtsanFileTest, FopenDiesWhenRealtime) {
ExpectNonRealtimeSurvival(Func);
}

TEST_F(RtsanFileTest, FopenCookieDieWhenRealtime) {
FILE *f = fopen(GetTemporaryFilePath(), "w");
EXPECT_THAT(f, Ne(nullptr));
struct fholder {
FILE *fp;
size_t read;
} fh = {f, 0};
auto CookieRead = [this](void *cookie, char *buf, size_t size) {
fholder *p = reinterpret_cast<fholder *>(cookie);
p->read = fread(static_cast<void *>(buf), 1, size, p->fp);
EXPECT_NE(0, p->read);
};
cookie_io_functions_t funcs = {(cookie_read_function_t *)&CookieRead, nullptr,
nullptr, nullptr};
auto Func = [&fh, &funcs]() {
FILE *f = fopencookie(&fh, "w", funcs);
EXPECT_THAT(f, Ne(nullptr));
};

ExpectRealtimeDeath(Func, "fopencookie");
ExpectNonRealtimeSurvival(Func);
}

#if SANITIZER_INTERCEPT_OPEN_MEMSTREAM
TEST_F(RtsanFileTest, OpenMemstreamDiesWhenRealtime) {
char *buffer;
Expand Down
Loading