Skip to content
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

GSoC 2023 #1098

Closed
tokatoka opened this issue Feb 23, 2023 · 59 comments
Closed

GSoC 2023 #1098

tokatoka opened this issue Feb 23, 2023 · 59 comments

Comments

@tokatoka
Copy link
Member

No description provided.

@tokatoka tokatoka pinned this issue Feb 23, 2023
@tokatoka tokatoka mentioned this issue Feb 23, 2023
9 tasks
@juppytt
Copy link

juppytt commented Feb 24, 2023

Hi. I'm interested in "Start rewriting AFL++'s afl-fuzz in Rust as a frontend of LibAFL" in #119.

@Srg213
Copy link

Srg213 commented Feb 24, 2023

Hello. I am working on #36 and will open PR soon. I am open to work on Rust projects and would like to contribute to LibAFL

@tokatoka
Copy link
Member Author

We'll select the candidates based on the contribution to the project.
So please send some PRs to contribute before you submit your GSoC proposal.

For example, there're some easy issues marked with good first issue to work on. #1084 #1037 #777 #609 #424 #36

@matheusbaptistella
Copy link
Contributor

Hello, I'm interested in working with issue #777. I don't have much experience with libafl_frida but it seems a great opportunity to learn new and more about the subject. Can I use that issue's discussion topic for further doubts?

@tokatoka
Copy link
Member Author

yes

@shubhangi013
Copy link

Hey @tokatoka ! I am Shubhangi, an electrical engineering undergrad and a student developer from IIT BHU. I would love to contribute to AFL++. I am starting out in fuzzing and have beginner level experience in Rust. I am keen to contribute to Start rewriting AFL++'s afl-fuzz in Rust as a frontend of LibAFL . I am a quick learner and have contributed to opensource previously, particularly to security applications.

@soumya-78
Copy link

soumya-78 commented Mar 6, 2023

Hello @tokatoka Soumya Ranjan here, and I am a third-year undergrad with proficiency in various tech stacks, including Rust, NodeJS, JavaScript, Python, PostgreSQL, MySQL, and C++. Currently, I am enthusiastic about contributing to the "Fuzzer template generator." project as a part of the AFL++ community. I am thrilled to be a part of this community and eager to make meaningful contributions.
As there is no link provided there in project description can you please guide me how to proceed.

@tokatoka
Copy link
Member Author

tokatoka commented Mar 6, 2023

Yes
Basically you are asked to build a wizard for libafl
https://en.wikipedia.org/wiki/Wizard_(software)
Your program asks the user what component of the fuzzer to use. and then later build the fuzzer rust code according to the user's preference.

Please send some PRs & contribute to libafl beforehand if you want to participate.

@soumya-78
Copy link

Thanks for replying @tokatoka . So i have to set up my local environment for libafl and solve some issues to proceed further. Can you please help me by mentioning some good issues which are still open to get familier with the codebase.

@tokatoka
Copy link
Member Author

tokatoka commented Mar 6, 2023

any issue with good first issue tag
but some people already pushed pr for some of them

if you can fix #701 then it's really helpful for us

@soumya-78
Copy link

Can you please confirm are there any pr pushed for any of the issue #1084 #609 and #424 . As they are marked as good first issue i will try to solve them and add a pr.

@tokatoka
Copy link
Member Author

tokatoka commented Mar 6, 2023

#1084 is done

@soumya-78
Copy link

The other 2 are still open along with #701?

@s1341
Copy link
Collaborator

s1341 commented Mar 6, 2023

Note that ideally the wizard shouldn’t ask which components to use, but rather what kind of fuzzing the user is intending to do, and then suggest components/modes/capabilities that match.

@tokatoka
Copy link
Member Author

tokatoka commented Mar 6, 2023

The other 2 are still open along with #701?

yeah

you can work on any open issue (not necessarily good first issue)

@soumya-78
Copy link

soumya-78 commented Mar 10, 2023

Hello @tokatoka Actually when following the contributing guide and running the "cargo build --release" command i am finding error and cannot able to resolve it out. Can you please help me with it
My llvm version is 14.0.6
Screenshot from 2023-03-10 22-43-36

@tokatoka
Copy link
Member Author

do you have llvm-config

@soumya-78
Copy link

Yes version 14.0.6
Screenshot from 2023-03-10 22-50-45

@tokatoka
Copy link
Member Author

can you try things on this issue?
#1070

  • Run with RUST_BACKTRACE=full
  • check stderr file in /target/release

@shubhangi013
Copy link

Hey @tokatoka are there any good first issues left? I would love to contribute to AFL :))

@tokatoka
Copy link
Member Author

tokatoka commented Mar 10, 2023

there're some issues with "good first issue" or "enhancement" that you can work on

(and this is not AFL)

@soumya-78
Copy link

Hello @tokatoka After making certain changes in code mentioned in that issue
Screenshot from 2023-03-11 18-01-24
there is no error in build but several warnings
Screenshot from 2023-03-11 17-56-55

and this error still exist in code showing
Screenshot from 2023-03-11 18-04-40

can you please guide me what to do?

@tokatoka
Copy link
Member Author

are you on windows? or linux?

@soumya-78
Copy link

I am in linux

@tokatoka
Copy link
Member Author

tokatoka commented Mar 11, 2023

Ok

here is no error in build but several warnings

Where does these 4 warnings come from?
Are they from println!("cargo:warning={:#?}", r)? that you added?
(but then it is guarded with cfg!(windows) so that means you are on windows)

are you on mingw or something?

(if it is mingw, then perhaps you'll need to find out what's missing. I guess nobody has tried running libafl on mingw)

@soumya-78
Copy link

Actually i have dual booted with windows but currently i am in ubuntu linux.

@tokatoka
Copy link
Member Author

ah ok.
then it doesn't matter.

so I'm sure

println!("cargo:warning={:#?}", r)? 

is printing out file XXX is missing. can you find out what is missing in your case?

@soumya-78
Copy link

Yes the warning come from println!("cargo:warning={:#?}", r)

@tokatoka
Copy link
Member Author

hmm
I don't know.. cargo is running the build code for windows when your rustc is for linux..

@soumya-78
Copy link

Actually in if the condition is for unix so it is running for linux. and in else it is for windows
Screenshot from 2023-03-11 19-15-39

@tokatoka
Copy link
Member Author

ok that code is for windows can you revert that change and see what file is missing in your case?
you can just the same as windows, println! the result of command::new() but this time for linux

@soumya-78
Copy link

And when i run cargo build --release code it is only showing 4 warning err messages. not specifically showing due to missing of which files these errors are occurring

@soumya-78
Copy link

soumya-78 commented Mar 11, 2023

if i modify the code in else if(windows)
Screenshot from 2023-03-11 19-31-03
then i am getting the error as it is coming previously
Screenshot from 2023-03-11 19-30-29

@tokatoka
Copy link
Member Author

yeah I mean If you want to insert debug prints, you have to do it in
if cfg!(unix)

do you have clang++ installed?

@soumya-78
Copy link

No clang++ is not installed

@tokatoka
Copy link
Member Author

well, you have to install it to get it working

@soumya-78
Copy link

After installing clang++ I have to build the code again?

@tokatoka
Copy link
Member Author

yeah

@soumya-78
Copy link

soumya-78 commented Mar 11, 2023

But finding same error again at the time of building. I tried to restart my pc also but facing the same problem

basically the only error that i am encountering since the beginning is, it is failing to run the custom build command of libafl_cc v0.9.0.

@tokatoka
Copy link
Member Author

tokatoka commented Mar 11, 2023

you need to find out what what file (dependency) is missing from your system to make it work

I'd guess some header files are not present

@soumya-78
Copy link

soumya-78 commented Mar 11, 2023

Yes some header files are not present
as
Screenshot from 2023-03-11 20-04-59
these headers are user defined headers. the red mark coming because there is error a which is basically
Screenshot from 2023-03-11 20-06-24

@soumya-78
Copy link

Is there any specific version of llvm required? i have installed 14.0.6

@tokatoka
Copy link
Member Author

no anything between 11 and 15 should work
can you check this
#1070 (comment)

@soumya-78
Copy link

Actually i am also facing the same issue there is no stderr file exist in libfl_cc-xxx
Screenshot from 2023-03-11 21-30-42

@soumya-78
Copy link

soumya-78 commented Mar 11, 2023

@tokatoka i have corrected the include header error but still facing the issue what should i do?
Screenshot from 2023-03-11 22-47-40
and also updated the llvm version to 13.0.1

@tokatoka
Copy link
Member Author

You can send us the draft gsoc proposal to [email protected] beforehand so we can take a look

@RougherO
Copy link

Hey @tokatoka I am interested to work on AFL-style UI in #119. I am a beginner in rust and I have prior experience in TUI with python. I would really like to work on this to build my rust skills. Could you help me in providing some documentation and resources so that I could get up to speed.

Thanks in advance

@fbaltor
Copy link
Contributor

fbaltor commented Mar 22, 2023

Hey, @tokatoka and @soumya-78. I guess I found the solution. I was facing the same issue here, in my Ubuntu 22.04.

First, the outputs of RUST_BACKTRACE=full cargo build --release:

   Compiling libc v0.2.140
   Compiling proc-macro2 v1.0.52
   Compiling unicode-ident v1.0.8
   Compiling quote v1.0.26
   Compiling autocfg v1.1.0
   Compiling cfg-if v1.0.0
   Compiling serde_derive v1.0.158
   Compiling serde v1.0.158
   Compiling syn v1.0.109
   Compiling log v0.4.17
   Compiling scopeguard v1.1.0
   Compiling semver v1.0.17
   Compiling lock_api v0.4.9
   Compiling signal-hook v0.3.15
   Compiling smallvec v1.10.0
   Compiling parking_lot_core v0.9.7
   Compiling memchr v2.5.0
   Compiling bitflags v1.3.2
   Compiling version_check v0.9.4
   Compiling rustc_version v0.4.0
   Compiling syn v2.0.4
   Compiling rustversion v1.0.12
   Compiling ahash v0.8.3
   Compiling heapless v0.7.16
   Compiling jobserver v0.1.26
   Compiling signal-hook-registry v1.4.1
   Compiling mio v0.8.6
   Compiling cc v1.0.79
   Compiling parking_lot v0.12.1
   Compiling signal-hook-mio v0.2.3
   Compiling memoffset v0.7.1
   Compiling byteorder v1.4.3
   Compiling hash32 v0.2.1
   Compiling spin v0.9.6
   Compiling num-traits v0.2.15
   Compiling stable_deref_trait v1.2.0
   Compiling libm v0.2.6
   Compiling either v1.8.1
   Compiling gimli v0.27.2
   Compiling adler v1.0.2
   Compiling once_cell v1.17.1
   Compiling serde_json v1.0.94
   Compiling erased-serde v0.3.25
   Compiling backtrace v0.3.67
   Compiling libafl v0.9.0 (/home/fbaltor/LibAFL/libafl)
   Compiling miniz_oxide v0.6.2
   Compiling which v4.4.0
   Compiling crossterm v0.25.0
   Compiling getrandom v0.2.8
   Compiling object v0.30.3
   Compiling aho-corasick v0.7.20
   Compiling itoa v1.0.6
   Compiling regex-syntax v0.6.29
   Compiling cobs v0.2.3
   Compiling addr2line v0.19.0
   Compiling rustc-demangle v0.1.21
   Compiling unicode-segmentation v1.10.1
   Compiling unicode-width v0.1.10
   Compiling cassowary v0.3.0
   Compiling ryu v1.0.13
   Compiling pin-utils v0.1.0
   Compiling static_assertions v1.1.0
   Compiling match_cfg v0.1.0
   Compiling hostname v0.3.1
   Compiling nix v0.26.2
   Compiling tui v0.19.0
   Compiling regex v1.7.2
   Compiling num_enum_derive v0.5.11
   Compiling c2rust-bitfields-derive v0.17.0
   Compiling c2rust-bitfields v0.17.0
   Compiling typed-builder v0.12.0
   Compiling ctor v0.1.26
   Compiling num_enum v0.5.11
   Compiling libafl_derive v0.9.0 (/home/fbaltor/LibAFL/libafl_derive)
   Compiling libafl_cc v0.9.0 (/home/fbaltor/LibAFL/libafl_cc)
   Compiling libafl_targets v0.9.0 (/home/fbaltor/LibAFL/libafl_targets)
   Compiling crossterm v0.26.1
   Compiling wait-timeout v0.2.0
   Compiling uds v0.2.6
   Compiling tuple_list v0.1.3
   Compiling rand_core v0.6.4
   Compiling xxhash-rust v0.8.6
   Compiling rangemap v1.3.0
   Compiling intervaltree v0.2.7
error: failed to run custom build command for `libafl_cc v0.9.0 (/home/fbaltor/LibAFL/libafl_cc)`

Caused by:
  process didn't exit successfully: `/home/fbaltor/LibAFL/target/release/build/libafl_cc-a075cbaa423d57d2/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=LLVM_CONFIG
  cargo:rerun-if-env-changed=LIBAFL_EDGES_MAP_SIZE
  cargo:rerun-if-env-changed=LIBAFL_ACCOUNTING_MAP_SIZE
  cargo:rerun-if-changed=src/common-llvm.h
  cargo:rerun-if-changed=build.rs
  cargo:rerun-if-changed=src/cmplog-routines-pass.cc

  --- stderr
  Ubuntu clang version 14.0.6
  Target: x86_64-pc-linux-gnu
  Thread model: posix
  InstalledDir: /usr/lib/llvm-14/bin
  Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
  Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
  Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
  Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
  Candidate multilib: .;@m64
  Selected multilib: .;@m64
   "/usr/lib/llvm-14/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name cmplog-routines-pass.cc -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/fbaltor/LibAFL/libafl_cc -resource-dir /usr/lib/llvm-14/lib/clang/14.0.6 -I /usr/lib/llvm-14/include -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D LIBAFL_EDGES_MAP_SIZE=65536 -D LIBAFL_ACCOUNTING_MAP_SIZE=65536 -D USE_NEW_PM -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++ -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/x86_64-linux-gnu -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/backward -internal-isystem /usr/lib/llvm-14/lib/clang/14.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++14 -fdeprecated-macro -fdebug-compilation-dir=/home/fbaltor/LibAFL/libafl_cc -ferror-limit 19 -fgnuc-version=4.2.1 -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/cmplog-routines-pass-7d9665.o -x c++ src/cmplog-routines-pass.cc
  clang -cc1 version 14.0.6 based upon LLVM 14.0.6 default target x86_64-pc-linux-gnu
  ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/x86_64-linux-gnu"
  ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/backward"
  ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
  ignoring nonexistent directory "/include"
  #include "..." search starts here:
  #include <...> search starts here:
   /usr/lib/llvm-14/include
   /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++
   /usr/lib/llvm-14/lib/clang/14.0.6/include
   /usr/local/include
   /usr/include/x86_64-linux-gnu
   /usr/include
  End of search list.
  src/cmplog-routines-pass.cc:25:10: fatal error: 'list' file not found
  #include <list>
           ^~~~~~
  1 error generated.
  thread 'main' panicked at 'assertion failed: Command::new(bindir_path.join(\"clang++\")).arg(\"-v\").args(cxxflags).arg(src_dir.join(src_file)).args(ldflags).arg(\"-o\").arg(out_dir.join(format!(\"{src_stub}.{}\",\n                        dll_extension()))).status().unwrap_or_else(|_|\n            panic!(\"Failed to compile {src_file}\")).success()', libafl_cc/build.rs:141:9
  stack backtrace:
     0:     0x556fc7de2e9a - std::backtrace_rs::backtrace::libunwind::trace::h595f06c70adcc478
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
     1:     0x556fc7de2e9a - std::backtrace_rs::backtrace::trace_unsynchronized::h177a0149c76cdde9
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:     0x556fc7de2e9a - std::sys_common::backtrace::_print_fmt::hc0701fd2c3530c58
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:65:5
     3:     0x556fc7de2e9a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd4cd115d8750fd6c
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:44:22
     4:     0x556fc7e03bbe - core::fmt::write::h93e2f5923c7eca08
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/fmt/mod.rs:1213:17
     5:     0x556fc7ddf755 - std::io::Write::write_fmt::h8162dbb45f0b9e62
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/io/mod.rs:1682:15
     6:     0x556fc7de2c65 - std::sys_common::backtrace::_print::h1835ef8a8f9066da
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:47:5
     7:     0x556fc7de2c65 - std::sys_common::backtrace::print::hcb5e6388b9235f41
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:34:9
     8:     0x556fc7de466f - std::panicking::default_hook::{{closure}}::h9c084969ccf9a722
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:267:22
     9:     0x556fc7de43ab - std::panicking::default_hook::h68fa2ba3c3c6c12f
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:286:9
    10:     0x556fc7de4d79 - std::panicking::rust_panic_with_hook::h8d5c434518ef298c
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:688:13
    11:     0x556fc7de4ad2 - std::panicking::begin_panic_handler::{{closure}}::hf33414f5dabf6faf
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:577:13
    12:     0x556fc7de334c - std::sys_common::backtrace::__rust_end_short_backtrace::hc50389427413bb75
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:137:18
    13:     0x556fc7de4822 - rust_begin_unwind
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:575:5
    14:     0x556fc7d3c5b3 - core::panicking::panic_fmt::h2de7a7938f816de8
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/panicking.rs:64:14
    15:     0x556fc7d3c64d - core::panicking::panic::h90931f06a97cc5e0
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/panicking.rs:114:5
    16:     0x556fc7d43646 - build_script_build::build_pass::h038a39017ec22bd4
                                 at /home/fbaltor/LibAFL/libafl_cc/build.rs:141:9
    17:     0x556fc7d447a0 - build_script_build::main::h3bedf4bd3023a848
                                 at /home/fbaltor/LibAFL/libafl_cc/build.rs:321:9
    18:     0x556fc7d45b1b - core::ops::function::FnOnce::call_once::h6f230d6188b1f9c8
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/ops/function.rs:250:5
    19:     0x556fc7d4712e - std::sys_common::backtrace::__rust_begin_short_backtrace::hcf86b6f85543a62c
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:121:18
    20:     0x556fc7d469f1 - std::rt::lang_start::{{closure}}::he9a02485adbf00ab
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/rt.rs:166:18
    21:     0x556fc7ddbb0c - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h699977d052768608
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/ops/function.rs:287:13
    22:     0x556fc7ddbb0c - std::panicking::try::do_call::h4e121e623c70f903
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:483:40
    23:     0x556fc7ddbb0c - std::panicking::try::hf9d919e062bc178a
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:447:19
    24:     0x556fc7ddbb0c - std::panic::catch_unwind::h7a7b12272684cb97
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panic.rs:140:14
    25:     0x556fc7ddbb0c - std::rt::lang_start_internal::{{closure}}::hd96b0eb4844b8762
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/rt.rs:148:48
    26:     0x556fc7ddbb0c - std::panicking::try::do_call::h1af1f88f4f92a22c
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:483:40
    27:     0x556fc7ddbb0c - std::panicking::try::hf20d7abea7f0f097
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:447:19
    28:     0x556fc7ddbb0c - std::panic::catch_unwind::hb0e084c3a9c042e4
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panic.rs:140:14
    29:     0x556fc7ddbb0c - std::rt::lang_start_internal::hca9d5c7277f5b67c
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/rt.rs:148:20
    30:     0x556fc7d469ca - std::rt::lang_start::h473741ce03f07b13
                                 at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/rt.rs:165:17
    31:     0x556fc7d44a1e - main
    32:     0x7f2324c29d90 - __libc_start_call_main
                                 at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    33:     0x7f2324c29e40 - __libc_start_main_impl
                                 at ./csu/../csu/libc-start.c:392:3
    34:     0x556fc7d3cb35 - _start
    35:                0x0 - <unknown>
warning: build failed, waiting for other jobs to finish...

From this output I concluded the problem was in this command:

   "/usr/lib/llvm-14/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name cmplog-routines-pass.cc -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/fbaltor/LibAFL/libafl_cc -resource-dir /usr/lib/llvm-14/lib/clang/14.0.6 -I /usr/lib/llvm-14/include -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D LIBAFL_EDGES_MAP_SIZE=65536 -D LIBAFL_ACCOUNTING_MAP_SIZE=65536 -D USE_NEW_PM -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++ -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/x86_64-linux-gnu -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/backward -internal-isystem /usr/lib/llvm-14/lib/clang/14.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++14 -fdeprecated-macro -fdebug-compilation-dir=/home/fbaltor/LibAFL/libafl_cc -ferror-limit 19 -fgnuc-version=4.2.1 -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/cmplog-routines-pass-7d9665.o -x c++ src/cmplog-routines-pass.cc

The subsequent lines gave me some clues:

  clang -cc1 version 14.0.6 based upon LLVM 14.0.6 default target x86_64-pc-linux-gnu
  ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/x86_64-linux-gnu"
  ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/backward"
  ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
  ignoring nonexistent directory "/include"
  #include "..." search starts here:
  #include <...> search starts here:
   /usr/lib/llvm-14/include
   /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++
   /usr/lib/llvm-14/lib/clang/14.0.6/include
   /usr/local/include
   /usr/include/x86_64-linux-gnu
   /usr/include
  End of search list.
  src/cmplog-routines-pass.cc:25:10: fatal error: 'list' file not found
  #include <list>

First thing I did was check my clang++ installation using clang++ --verbose which gave me:

Ubuntu clang version 14.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64

So even though I have clang++, sounds like it's not being able to find the source code of some included libraries (like 'list'). Odd. I searched by clang ignoring nonexistent directory and found this very similar issue at the llvm-project (llvm/llvm-project#56343). Reading through it I found a possible solution in this Stack Overflow question (https://stackoverflow.com/questions/74543715/usr-bin-ld-cannot-find-lstdc-no-such-file-or-directory-on-running-flutte/74605488#74605488):

"I ran into a similar problem after a system upgrade. After a while, I realized that it was because nvidia-driver-520-open installed gcc-12. I use clang-15 that I installed with the script installClang15.sh. clang-15 depends and hence installs libstdc++-11-dev and gcc-11. The problem is that once gcc-12 was installed, clang++ picked it up automatically instead of gcc-11... "

The easiest solution is to add the missing libstdc++. Since my clang++ is using gcc-12 I installed the following:

sudo apt install libstdc++-12-dev

And it worked!

@tokatoka
Copy link
Member Author

Probably you don't have libstdc++

@tokatoka
Copy link
Member Author

@RougherO
in addition to Rust, you can take a look at https://lcamtuf.coredump.cx/afl/technical_details.txt to get familiar with how fuzzing works

@fbaltor
Copy link
Contributor

fbaltor commented Mar 22, 2023

Yes. My great skills in editing big markdown files made me publish an incomplete answer hehe I choose to edit it instead.

@RougherO
Copy link

@RougherO in addition to Rust, you can take a look at https://lcamtuf.coredump.cx/afl/technical_details.txt to get familiar with how fuzzing works

The text is a little difficult to understand, although I understood more or less of how its working it would be great if you could provide something which is a little more easier perhaps some examples would make it clear... Thanks

@matheusbaptistella
Copy link
Contributor

You can send us the draft gsoc proposal to [email protected] beforehand so we can take a look

Hello tokatoka, last Wednesday I sent my gsoc proposal draft to [email protected]. Do I have to send it somewhere else? Because I don't know if you guys received or are still analysing it hahahahaha.

@tokatoka
Copy link
Member Author

Sorry for being late
Yes we had discussion about it, and I sent the feedback to you now.

@ToSeven
Copy link
Contributor

ToSeven commented Apr 3, 2023

My contribution @tokatoka #1195

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants