flatbuffers icon indicating copy to clipboard operation
flatbuffers copied to clipboard

[swift] use loadUnligned instead of load (#7640)

Open mr-swifter opened this issue 2 years ago • 4 comments

PR for fixing issues #7640

mr-swifter avatar Nov 14 '22 14:11 mr-swifter

@mr-swifter can you also run the fuzzer for like 5 mins?

mustiikhalil avatar Nov 14 '22 17:11 mustiikhalil

Just ran the fuzzer for a couple of mins! It seems to work without any issues, always remember to getACheckedRoot to verify the data is proper. @mustiikhalil , may you guide me how to do this? Do you mean tests/fuzzer? But how I need to hook swift code for this? Or do I miss something completely? Thanks

mr-swifter avatar Nov 15 '22 13:11 mr-swifter

@mr-swifter so this is a bit tricky, since you will need to follow this:

  • https://github.com/apple/swift/blob/main/docs/libFuzzerIntegration.md
  • https://github.com/apple/swift-protobuf/tree/main/FuzzTesting

and mainly run in the tests/swift/tests

xcrun --toolchain "Swift Development Snapshot" swift build -c debug -Xswiftc -sanitize=fuzzer,address -Xswiftc -parse-as-library

I couldnt manage to make it run on arm64 though (always got a seg fault), i had to switch to x86

mustiikhalil avatar Nov 15 '22 14:11 mustiikhalil

@mustiikhalil , thanks for advice, let me try

mr-swifter avatar Nov 15 '22 15:11 mr-swifter

What is the status on this one?

dbaileychess avatar Dec 15 '22 06:12 dbaileychess

What is the status on this one?

Hi @dbaileychess , this case is not forgotten, I just stuck with some backlog in my project. I believe I will do this soon.

mr-swifter avatar Dec 21 '22 17:12 mr-swifter

Converting to a draft, please upgrade when ready to review again.

dbaileychess avatar Jan 07 '23 18:01 dbaileychess

Seems investigate clearly show there is a performance regression because of using loadUnaligned instead of load. Should we go with conditional compilation then as what originally suggested?

mr-swifter avatar Jan 18 '23 16:01 mr-swifter

@mustiikhalil @mr-swifter Status on this?

dbaileychess avatar Mar 03 '23 06:03 dbaileychess

I vote for closing it until it's properly baked

mustiikhalil avatar Mar 03 '23 19:03 mustiikhalil

Feel free to reopen when more work is done.

dbaileychess avatar Mar 03 '23 19:03 dbaileychess