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

Always allow linking AFL-instrumented modules #10107

Merged
merged 1 commit into from Jan 4, 2021
Merged

Always allow linking AFL-instrumented modules #10107

merged 1 commit into from Jan 4, 2021

Conversation

dra27
Copy link
Member

@dra27 dra27 commented Jan 1, 2021

#9998 added testsuite/tests/flambda/afl_lazy.ml. This test fails to link on platforms which don't support AFL (like Windows).

This has been wrong forever, but as the test itself was added in 4.12, I propose including this bug fix in 4.12.

More detail: AFL support is always built in the runtime if the required shared memory support is available. The --with-afl option simply controls whether the -afl-instrument option is the default. So ocamlopt always requires the caml_afl_area_ptr and caml_afl_prev_loc data areas and also caml_setup_afl to be a valid function. The fix is therefore easy - always define the two data values and include a dummy stub for caml_setup_afl returning Val_unit (this is what caml_setup_afl normally does when an instrumented program is run without AFL).

More seriously: we appear to be no longer continuously testing Windows flambda anywhere?

@dra27 dra27 added the bug label Jan 1, 2021
@dra27 dra27 added this to the 4.12 milestone Jan 1, 2021
Copy link
Contributor

@xavierleroy xavierleroy left a comment

Choose a reason for hiding this comment

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

The change is OK, but makes me see something I don't like in this AFL runtime support.

@@ -15,6 +15,11 @@
/* Runtime support for afl-fuzz */
#include "caml/config.h"

/* Values used by the instrumentation logic (see cmmgen.ml) */
static unsigned char afl_area_initial[1 << 16];
Copy link
Contributor

Choose a reason for hiding this comment

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

So, every OCaml program is 64 Kbytes bigger, just in case AFL is applied to it?

I know this is orthogonal to the issue at hand, but I'd really like to see on-demand allocation here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, it wasn't just me bothered by this! I'll open an issue to track it...

@xavierleroy
Copy link
Contributor

More seriously: we appear to be no longer continuously testing Windows flambda anywhere?

No longer at Inria's CI. It takes too long given the limited number of cores we can throw at the 6 Windows ports...

We (@shindere) could try to get more cores. Or, we could have a different CI job, "other-windows-configs", say, that runs once every night, say, and that tests flambda and other less common configurations on Windows.

@xavierleroy
Copy link
Contributor

On a related note: I'm not sure no-naked-pointers mode is tested much under Windows, too.

@dra27
Copy link
Member Author

dra27 commented Jan 3, 2021

Perhaps GitHub actions can help out here (they're quite generous with Windows runners, it seems).

Alternatively, could the mingw64 worker build flambda?

@dra27 dra27 merged commit 15c5679 into ocaml:trunk Jan 4, 2021
@dra27 dra27 deleted the afl branch January 4, 2021 09:36
@shindere
Copy link
Contributor

shindere commented Jan 5, 2021 via email

@xavierleroy
Copy link
Contributor

Alternatively, could the mingw64 worker build flambda?

No, because mingw64 is the slowest Windows build already (50+ minutes vs. 30 min for msvc32).

@dra27
Copy link
Member Author

dra27 commented Jan 5, 2021

I picked mingw64 since it's the closest to the default Linux flambda build (i.e. it's gcc and 64-bit) so if you see a failure on just mingw64+flambda you could be fairly you're looking at an flambda issue, and not an MSVC/32-bit/etc.

However, the disparity in speed is much more important than that - I'd pick the fastest native Windows build to do it

@gasche
Copy link
Member

gasche commented Feb 13, 2021

This work was mentioned in the 4.12 milestone, and its Changes entry is in the 4.12 section, but as far as I can tell it was never cherry-picked in the 4.12 branch. (cc @dra27 @Octachron)

My current understanding is that this change will not be part of 4.12.0, so I will fix the Changes by moving it to the trunk section.

@gasche
Copy link
Member

gasche commented Feb 13, 2021

(Note: this fixes a bug in a test that was added in 4.12~dev; if the fix is not backported, maybe it would make sense to disable the test from 4.12 to avoid future annoyance for people testing 4.12.)

dra27 added a commit that referenced this pull request Apr 14, 2021
Always allow linking AFL-instrumented modules

(cherry picked from commit 15c5679)
@dra27
Copy link
Member Author

dra27 commented Apr 14, 2021

Sorry, this appears have to been lost in the lockdown 3 fog here in the UK...

I have just cherry-picked this to 4.12, but moved it from the 4.12.0 to the top of Changes

@dra27 dra27 mentioned this pull request Jan 9, 2023
gerdstolpmann pushed a commit to gerdstolpmann/ocaml that referenced this pull request Mar 24, 2023
Always allow linking AFL-instrumented modules

(cherry picked from commit 15c5679)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants