Skip to content

Conversation

@nataraj-hates-MS-for-stealing-github
Copy link
Contributor

I found -T option setting user's defined banner very handy.

I acquired taste, and tried to put all info I need in the banner, but found that it can't be as long as I'd like to.

I came to conclusion that "american fuzzy lop" text is useless waste of precocious space compared to very important info that I want to put in the banner ;-) , "AFL" should do the same job

So this patch put "AFL" instead of "american fuzzy lop" in the stat screen header if user's banner does not fit into the space. So one can use bigger banners.

Hope I did code styling right (I tried my best), and that this patch will be useful not only to me :-)

@nataraj-hates-MS-for-stealing-github
Copy link
Contributor Author

I do not understand why tests fails... See no error message.

BTW for unpatched version on my local machine they fails too... May be the problem is not in the patch

if (unlikely(!banner[0])) {

char *si = "";
char *fuzzer_name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls make it a global in afl-fuzz.c and set it there, use extern here.

Copy link
Contributor Author

@nataraj-hates-MS-for-stealing-github nataraj-hates-MS-for-stealing-github Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry... I did not got the idea...

I do not understand why we should do it. The variable is local, and is not needed outside of this scope...

Also I do not understand where is the proper place for this variable in afl-fuzz.c I did not found similar variables there...

May be it should be added in afl_state structure from afl-fuzz.h? But I still not sure it is good idea...

I am not familiar with AFL++ architecture at all. I guess I need some guidance and explanations here...

@vanhauser-thc
Copy link
Member

I do not mind if you rename it to AFL, not just when the banner is too long otherwise.

@nataraj-hates-MS-for-stealing-github
Copy link
Contributor Author

nataraj-hates-MS-for-stealing-github commented Sep 20, 2023

I do not mind if you rename it to AFL, not just when the banner is too long otherwise.

If no user banner is set (and it is true in most cases), stat header will look nicer with "american fuzzy lop" I guess. So unless you insist, I would keep both "AFL" and "american fuzzy lop" the way I did in my first patch version...

@vanhauser-thc
Copy link
Member

the banner in the UI is rendered about 2 times per second. so the if() about how to construct the banner takes up unnecessary resources as this is something that never changes.
so I want to use your change for a bigger change.

set the banner into a global variable in main() in src/afl-fuzz.c, and import that u8* as extern into the stats source.
saves speed and allows for your feature request.

it is fine to be a global variable because it is not something that would need to be thread safe.

@vanhauser-thc
Copy link
Member

@nataraj-hates-MS-for-stealing-github
Copy link
Contributor Author

a bit occupied right now O_o Sorry.

So will say without code commit.

  1. This idea with once-calculated banner seems to be good I can do it.

  2. May be we are not ambitious enough here? Sine stat title never changes (I guess it never changes) may be we should snprintf whole title to a static buffer in first iteration, and then just print that buffer twice a second?

  3. I still does not understand why we should put that variable in afl-fuzz.c we can make it static right in the pace it is used. like

  static char *fuzzer_name;

and it will be reused in all other iterations. It is common C trick, as far as I know.

@nataraj-hates-MS-for-stealing-github
Copy link
Contributor Author

nataraj-hates-MS-for-stealing-github commented Sep 30, 2023

I've reread the code more carefully.

Everything is already done there.

There is static variable banner here

If it dose not have non-empty value in it

then proper content is calculated

and snpritf'ed into it

So all this code (and my new code too) is executed only once, and it is not really important how much CPU is wasted...

I guess no more coding is required here, if we speak about CPU efficiency

@vanhauser-thc
Copy link
Member

oh my bad, hadnt seen the if(unlikely(!banner[0]))

@vanhauser-thc vanhauser-thc merged commit f3ec554 into AFLplusplus:dev Oct 2, 2023
@nataraj-hates-MS-for-stealing-github
Copy link
Contributor Author

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants