AFL run_target trace_bits

2024-03-02 06:20
文章标签 target run trace bits afl

本文主要是介绍AFL run_target trace_bits,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

先简单总结下run_target中和覆盖率计算相关的代码(去除我不关注的内容,如dump,no_forkserver等):

static u8 run_target(char** argv, u32 timeout) {/* After this memset, trace_bits[] are effectively volatile, so wemust prevent any earlier operations from venturing into thatterritory. */memset(trace_bits, 0, MAP_SIZE);MEM_BARRIER();// 执行二进制程序。。。// 等待程序终止。。。/* Any subsequent operations on trace_bits must not be moved by thecompiler below this point. Past this location, trace_bits[] behavevery normally and do not have to be treated as volatile. */MEM_BARRIER();#ifdef WORD_SIZE_64classify_counts((u64*)trace_bits);
#elseclassify_counts((u32*)trace_bits);
#endif /* ^WORD_SIZE_64 */return FAULT_NONE;

把其他内容删减后,对共享内存的操作就几句话。
memset,给trace_bits全部置0。
MEM_BARRIER(),内存屏障,暂时不去了解

classify_counts((u64*)trace_bits);每次处理8个字节,一共65536个字节需要处理

classify_count函数如下:

static inline void classify_counts(u64* mem) {u32 i = MAP_SIZE >> 3;while (i--) {/* Optimize for sparse bitmaps. */if (unlikely(*mem)) {u16* mem16 = (u16*)mem;mem16[0] = count_class_lookup16[mem16[0]];mem16[1] = count_class_lookup16[mem16[1]];mem16[2] = count_class_lookup16[mem16[2]];mem16[3] = count_class_lookup16[mem16[3]];}mem++;}}

i = 65536 / 8 = 8192,while循环8192次
u16* mem16 = (u16*)mem; 把u64指针转化为u16指针

static u16 count_class_lookup16[65536];EXP_ST void init_count_class16(void) {u32 b1, b2;for (b1 = 0; b1 < 256; b1++) for (b2 = 0; b2 < 256; b2++)count_class_lookup16[(b1 << 8) + b2] = (count_class_lookup8[b1] << 8) |count_class_lookup8[b2];}static const u8 count_class_lookup8[256] = {[0]           = 0,[1]           = 1,[2]           = 2,[3]           = 4,[4 ... 7]     = 8,[8 ... 15]    = 16,[16 ... 31]   = 32,[32 ... 127]  = 64,[128 ... 255] = 128};

感觉大概意思就是,对trace_bit的数据进行一些形式化处理,但是基本上不改变值。

run_target中间没有其他地方对trace_bits的具体赋值,应该是在二进制程序插桩中直接修改了trace_bits,暂时先不去深入了解

这篇关于AFL run_target trace_bits的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/765182

相关文章

Kotlin 作用域函数apply、let、run、with、also使用指南

《Kotlin作用域函数apply、let、run、with、also使用指南》在Kotlin开发中,作用域函数(ScopeFunctions)是一组能让代码更简洁、更函数式的高阶函数,本文将... 目录一、引言:为什么需要作用域函数?二、作用域函China编程数详解1. apply:对象配置的 “流式构建器”最

python subprocess.run中的具体使用

《pythonsubprocess.run中的具体使用》subprocess.run是Python3.5及以上版本中用于运行子进程的函数,它提供了更简单和更强大的方式来创建和管理子进程,本文就来详细... 目录一、详解1.1、基本用法1.2、参数详解1.3、返回值1.4、示例1.5、总结二、subproce

访问controller404:The origin server did not find a current representation for the target resource

ider build->rebuild project。Rebuild:对选定的目标(Project),进行强制性编译,不管目标是否是被修改过。由于 Rebuild 的目标只有 Project,所以 Rebuild 每次花的时间会比较长。 参考:资料

[vue小白]npm run运行以后无法关闭

开启vue任务后,关闭git bash窗口发现端口仍然被占用,程序没有关闭 通过查询资料,大部分都说ctrl+c就可以了,但是经过实践发现并不可行,目测大部分都是复制粘贴的答案。 经过尝试,最终发现可能只能暴力关闭了 1.在cmd中输入netstat -ano查询占用端口号的pid 2. 然后在任务管理器中查询对应的任务并关闭 3. 在linux系统中更简单,直接kill -9 pid即可

The `XXXUITests [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build......

出现的警告: [!] The `ColorInHeartUITests [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-ColorInHeart-ColorInHeartUITests/Po

JS实现将两个相同的json对象合并成为一个新对象(对象中包含list或者其他对象)source===target(不破坏target的非空值)

重点申明一下, 这个方法 只限于两个完全一样的对象 ,不一样的对象请使用 下面的进行合并,   <script>let form = {name: 'liming', sex: '男'};let obj = {class: '一班', age: 15};console.log('before', form);Object.assign(form, obj); //该方法可以完成console.

【HarmonyOS】安装包报错,code:9568282 error: install releaseType target not same.

【HarmonyOS】安装包报错,code:9568282 error: install releaseType target not same. 报错信息 Install Failed: error: failed to install bundle. code:9568282 error: install releaseType target not same. You can also

[LeetCode] 338. Counting Bits

题:https://leetcode.com/problems/counting-bits/description/ 题目 Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary repres

[LeetCode] 190. Reverse Bits

题:https://leetcode.com/problems/reverse-bits/ 题目大意 将32位的数,二进制翻转。 解题思路 解法和 将int a =123,翻转的思路 相同。 int b= 0;while(a>0){b = b*10 + a %10;a /=10;} 将新数整体左移一位,然后 取每个数的第i位置,将该位放到 新数的最低位。循环32次遍可以得到翻转。