summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Swiecki <robert@swiecki.net>2017-06-14 14:58:37 +0200
committerRobert Swiecki <robert@swiecki.net>2017-06-14 14:58:37 +0200
commit6134ce075a353457dddc8d83a346da033a5b965f (patch)
tree4dec0b7ae35378acd3e58bd54275d6c10907e5f1
parentd9e96986c2b75c2c926221bd32e8b56541e1402b (diff)
downloadhonggfuzz-6134ce075a353457dddc8d83a346da033a5b965f.tar.gz
Linux: remove BTS block - as it's just BTS edge
-rw-r--r--cmdline.c7
-rw-r--r--display.c2
-rw-r--r--libcommon/common.h1
-rw-r--r--linux/arch.c3
-rw-r--r--linux/perf.c35
-rw-r--r--report.c6
6 files changed, 9 insertions, 45 deletions
diff --git a/cmdline.c b/cmdline.c
index ec09ef14..9a354bfc 100644
--- a/cmdline.c
+++ b/cmdline.c
@@ -97,9 +97,6 @@ static void cmdlineHelp(const char *pname, struct custom_option *opts)
LOG_HELP(" Run the binary over a dynamic file, maximize total no. of branches:");
LOG_HELP_BOLD(" " PROG_NAME " --linux_perf_branch -- /usr/bin/tiffinfo -D "
_HF_FILE_PLACEHOLDER);
- LOG_HELP(" Run the binary over a dynamic file, maximize unique code blocks via BTS:");
- LOG_HELP_BOLD(" " PROG_NAME " --linux_perf_bts_block -- /usr/bin/tiffinfo -D "
- _HF_FILE_PLACEHOLDER);
LOG_HELP(" Run the binary over a dynamic file, maximize unique branches (edges) via BTS:");
LOG_HELP_BOLD(" " PROG_NAME " --linux_perf_bts_edge -- /usr/bin/tiffinfo -D "
_HF_FILE_PLACEHOLDER);
@@ -312,7 +309,6 @@ bool cmdlineParse(int argc, char *argv[], honggfuzz_t * hfuzz)
{{"linux_perf_ignore_above", required_argument, NULL, 0x503}, "Ignore perf events which report IPs above this address"},
{{"linux_perf_instr", no_argument, NULL, 0x510}, "Use PERF_COUNT_HW_INSTRUCTIONS perf"},
{{"linux_perf_branch", no_argument, NULL, 0x511}, "Use PERF_COUNT_HW_BRANCH_INSTRUCTIONS perf"},
- {{"linux_perf_bts_block", no_argument, NULL, 0x512}, "Use Intel BTS to count unique blocks"},
{{"linux_perf_bts_edge", no_argument, NULL, 0x513}, "Use Intel BTS to count unique edges"},
{{"linux_perf_ipt_block", no_argument, NULL, 0x514}, "Use Intel Processor Trace to count unique blocks (requires libipt.so)"},
{{"linux_perf_kernel_only", no_argument, NULL, 0x515}, "Gather kernel-only coverage with Intel PT and with Intel BTS"},
@@ -487,9 +483,6 @@ bool cmdlineParse(int argc, char *argv[], honggfuzz_t * hfuzz)
case 0x511:
hfuzz->dynFileMethod |= _HF_DYNFILE_BRANCH_COUNT;
break;
- case 0x512:
- hfuzz->dynFileMethod |= _HF_DYNFILE_BTS_BLOCK;
- break;
case 0x513:
hfuzz->dynFileMethod |= _HF_DYNFILE_BTS_EDGE;
break;
diff --git a/display.c b/display.c
index 645d2839..6da1e87e 100644
--- a/display.c
+++ b/display.c
@@ -224,7 +224,7 @@ static void display_displayLocked(honggfuzz_t * hfuzz)
display_put(" hwb: " ESC_BOLD "%" _HF_MONETARY_MOD PRIu64 ESC_RESET,
ATOMIC_GET(hfuzz->linux.hwCnts.cpuBranchCnt));
}
- if (hfuzz->dynFileMethod & (_HF_DYNFILE_BTS_BLOCK | _HF_DYNFILE_BTS_EDGE)) {
+ if (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_EDGE) {
display_put(" bts: " ESC_BOLD "%" _HF_MONETARY_MOD PRIu64 ESC_RESET,
ATOMIC_GET(hfuzz->linux.hwCnts.bbCnt));
}
diff --git a/libcommon/common.h b/libcommon/common.h
index 04cd416f..ff839724 100644
--- a/libcommon/common.h
+++ b/libcommon/common.h
@@ -101,7 +101,6 @@ typedef enum {
_HF_DYNFILE_NONE = 0x0,
_HF_DYNFILE_INSTR_COUNT = 0x1,
_HF_DYNFILE_BRANCH_COUNT = 0x2,
- _HF_DYNFILE_BTS_BLOCK = 0x8,
_HF_DYNFILE_BTS_EDGE = 0x10,
_HF_DYNFILE_IPT_BLOCK = 0x20,
_HF_DYNFILE_SOFT = 0x40,
diff --git a/linux/arch.c b/linux/arch.c
index 9d54a587..1a7a85f9 100644
--- a/linux/arch.c
+++ b/linux/arch.c
@@ -429,8 +429,7 @@ bool arch_archInit(honggfuzz_t * hfuzz)
* 3) Intel's PT and new Intel BTS format require kernel >= 4.1
*/
unsigned long checkMajor = 3, checkMinor = 7;
- if ((hfuzz->dynFileMethod & _HF_DYNFILE_BTS_BLOCK) ||
- (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_EDGE) ||
+ if ((hfuzz->dynFileMethod & _HF_DYNFILE_BTS_EDGE) ||
(hfuzz->dynFileMethod & _HF_DYNFILE_IPT_BLOCK)) {
checkMajor = 4;
checkMinor = 1;
diff --git a/linux/perf.c b/linux/perf.c
index d9329c31..16ef7a39 100644
--- a/linux/perf.c
+++ b/linux/perf.c
@@ -79,10 +79,7 @@ static inline void arch_perfBtsCount(honggfuzz_t * hfuzz, fuzzer_t * fuzzer)
continue;
}
- register size_t pos = br->to;
- if (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_EDGE) {
- pos = ((br->from << 12) ^ (br->to & 0xFFF));
- }
+ register size_t pos = ((br->from << 12) ^ (br->to & 0xFFF));
pos &= _HF_PERF_BITMAP_BITSZ_MASK;
register uint8_t prev = ATOMIC_BTS(hfuzz->feedback->bbMapPc, pos);
if (!prev) {
@@ -103,7 +100,7 @@ static inline void arch_perfMmapParse(honggfuzz_t * hfuzz UNUSED, fuzzer_t * fuz
LOG_F("The PERF AUX data has been overwritten. The AUX buffer is too small");
}
- if (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_BLOCK || hfuzz->dynFileMethod & _HF_DYNFILE_BTS_EDGE) {
+ if (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_EDGE) {
arch_perfBtsCount(hfuzz, fuzzer);
}
if (hfuzz->dynFileMethod & _HF_DYNFILE_IPT_BLOCK) {
@@ -128,7 +125,7 @@ static bool arch_perfCreate(honggfuzz_t * hfuzz, fuzzer_t * fuzzer UNUSED, pid_t
LOG_F("The PERF FD is already initialized, possibly conflicting perf types enabled");
}
- if (((method & _HF_DYNFILE_BTS_BLOCK) || method & _HF_DYNFILE_BTS_EDGE)
+ if ((method & _HF_DYNFILE_BTS_EDGE)
&& perfIntelBtsPerfType == -1) {
LOG_F("Intel BTS events (new type) are not supported on this platform");
}
@@ -165,10 +162,6 @@ static bool arch_perfCreate(honggfuzz_t * hfuzz, fuzzer_t * fuzzer UNUSED, pid_t
pe.config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS;
pe.inherit = 1;
break;
- case _HF_DYNFILE_BTS_BLOCK:
- LOG_D("Using: (Intel BTS) type=%" PRIu32 " for PID: %d", perfIntelBtsPerfType, pid);
- pe.type = perfIntelBtsPerfType;
- break;
case _HF_DYNFILE_BTS_EDGE:
LOG_D("Using: (Intel BTS) type=%" PRIu32 " for PID: %d", perfIntelBtsPerfType, pid);
pe.type = perfIntelBtsPerfType;
@@ -193,8 +186,7 @@ static bool arch_perfCreate(honggfuzz_t * hfuzz, fuzzer_t * fuzzer UNUSED, pid_t
return false;
}
- if (method != _HF_DYNFILE_BTS_BLOCK && method != _HF_DYNFILE_BTS_EDGE
- && method != _HF_DYNFILE_IPT_BLOCK) {
+ if (method != _HF_DYNFILE_BTS_EDGE && method != _HF_DYNFILE_IPT_BLOCK) {
return true;
}
#if defined(PERF_ATTR_SIZE_VER5)
@@ -250,13 +242,6 @@ bool arch_perfOpen(pid_t pid, honggfuzz_t * hfuzz, fuzzer_t * fuzzer)
goto out;
}
}
- if (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_BLOCK) {
- if (arch_perfCreate(hfuzz, fuzzer, pid, _HF_DYNFILE_BTS_BLOCK, &fuzzer->linux.cpuIptBtsFd)
- == false) {
- LOG_E("Cannot set up perf for PID=%d (_HF_DYNFILE_BTS_BLOCK)", pid);
- goto out;
- }
- }
if (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_EDGE) {
if (arch_perfCreate(hfuzz, fuzzer, pid, _HF_DYNFILE_BTS_EDGE, &fuzzer->linux.cpuIptBtsFd) ==
false) {
@@ -305,10 +290,6 @@ void arch_perfClose(honggfuzz_t * hfuzz, fuzzer_t * fuzzer)
close(fuzzer->linux.cpuBranchFd);
fuzzer->linux.cpuBranchFd = -1;
}
- if (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_BLOCK) {
- close(fuzzer->linux.cpuIptBtsFd);
- fuzzer->linux.cpuIptBtsFd = -1;
- }
if (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_EDGE) {
close(fuzzer->linux.cpuIptBtsFd);
fuzzer->linux.cpuIptBtsFd = -1;
@@ -331,9 +312,6 @@ bool arch_perfEnable(honggfuzz_t * hfuzz, fuzzer_t * fuzzer)
if (hfuzz->dynFileMethod & _HF_DYNFILE_BRANCH_COUNT) {
ioctl(fuzzer->linux.cpuBranchFd, PERF_EVENT_IOC_ENABLE, 0);
}
- if (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_BLOCK) {
- ioctl(fuzzer->linux.cpuIptBtsFd, PERF_EVENT_IOC_ENABLE, 0);
- }
if (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_EDGE) {
ioctl(fuzzer->linux.cpuIptBtsFd, PERF_EVENT_IOC_ENABLE, 0);
}
@@ -371,11 +349,6 @@ void arch_perfAnalyze(honggfuzz_t * hfuzz, fuzzer_t * fuzzer)
ioctl(fuzzer->linux.cpuBranchFd, PERF_EVENT_IOC_RESET, 0);
}
- if (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_BLOCK) {
- ioctl(fuzzer->linux.cpuIptBtsFd, PERF_EVENT_IOC_DISABLE, 0);
- arch_perfMmapParse(hfuzz, fuzzer);
- ioctl(fuzzer->linux.cpuIptBtsFd, PERF_EVENT_IOC_RESET, 0);
- }
if (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_EDGE) {
ioctl(fuzzer->linux.cpuIptBtsFd, PERF_EVENT_IOC_DISABLE, 0);
arch_perfMmapParse(hfuzz, fuzzer);
diff --git a/report.c b/report.c
index 0f7a669b..147e3bdc 100644
--- a/report.c
+++ b/report.c
@@ -46,10 +46,10 @@ static void report_printdynFileMethod(honggfuzz_t * hfuzz)
dprintf(reportFD, "INSTR_COUNT ");
if (hfuzz->dynFileMethod & _HF_DYNFILE_BRANCH_COUNT)
dprintf(reportFD, "BRANCH_COUNT ");
- if (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_BLOCK)
- dprintf(reportFD, "BLOCK_COUNT ");
if (hfuzz->dynFileMethod & _HF_DYNFILE_BTS_EDGE)
- dprintf(reportFD, "EDGE_COUNT ");
+ dprintf(reportFD, "BTS_EDGE_COUNT ");
+ if (hfuzz->dynFileMethod & _HF_DYNFILE_IPT_BLOCK)
+ dprintf(reportFD, "IPT_BLOCK_COUNT ");
dprintf(reportFD, "\n");
}