[PATCH] D43543: Add new interceptors: getnetent(3) family
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 25 14:40:24 PST 2018
vitalybuka added inline comments.
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:6973
+ void *ctx;
+ struct __sanitizer_netent *n;
+ COMMON_INTERCEPTOR_ENTER(ctx, getnetent);
----------------
Combine declaration and initialization
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:6981
+
+ while (*nn) {
+ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, nn, sizeof(char **));
----------------
for (char **nn = n->n_aliases; *nn, ++nn) {
}
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:6982
+ while (*nn) {
+ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, nn, sizeof(char **));
+ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *nn, REAL(strlen)(*nn) + 1);
----------------
you can remove
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, nn, sizeof(char **));
and count nn
and WRITE_RANGE after the loop
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:6995
+ COMMON_INTERCEPTOR_ENTER(ctx, getnetbyname, name);
+ n = REAL(getnetbyname)(name);
+ if (n) {
----------------
You need READ_RANGE for "name"
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:7032
+INTERCEPTOR(void, setnetent, int stayopen) {
+ void *ctx;
+ COMMON_INTERCEPTOR_ENTER(ctx, setnetent, stayopen);
----------------
Don't install empty interceptors
================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:7284
INIT_GETPROTOENT;
+ INIT_GETNETENT;
----------------
I'd remove GET from here and the test name
================
Comment at: test/sanitizer_common/TestCases/NetBSD/getnetent.cc:16
+ ntp = getnetent();
+ if (!ntp)
+ exit(1);
----------------
remove exit(1)
================
Comment at: test/sanitizer_common/TestCases/NetBSD/getnetent.cc:18
+ exit(1);
+
+ printf("%s ", ntp->n_name);
----------------
combine declaration and initialization
================
Comment at: test/sanitizer_common/TestCases/NetBSD/getnetent.cc:96
+ // CHECK: loopback 2 127
+ // CHECK: loopback 2 127
+ // CHECK: loopback 2 127
----------------
Could you please add test name into printf and check it here.
It will help to debug failures
Repository:
rL LLVM
https://reviews.llvm.org/D43543
More information about the llvm-commits
mailing list