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

Correct broken unaligned load/store in armv5 #1355

Merged
merged 1 commit into from
Apr 6, 2017
Merged

Correct broken unaligned load/store in armv5 #1355

merged 1 commit into from
Apr 6, 2017

Conversation

psolyca
Copy link
Contributor

@psolyca psolyca commented Mar 21, 2017

This PR fixes issue #1354.

armv5 devices and older (i.e. <= arm9 generation) require addresses that are stored to and loaded from to to be 4-byte aligned.

If this is not the case the lower 2 bits of the address are cleared and the load is performed in an unexpected order, including up to 3 bytes of data located prior to the address.

Inlined buckets are stored after their key in a page and since there is no guarantee that the key will be of a length that is a multiple of 4, it is possible for unaligned load/stores to occur when they are cast back to bucket and page pointer types.

The fix adds a new field to track whether the current architecture exhibits this issue, sets it on module load for ARM architectures, and then on bucket open, if this field is set and the address is unaligned, a byte-by-byte copy of the inlined bucket is performed.

The fixe commes from balena-os/bolt@97aba55
and has already been applied in the upstream boltdb repository boltdb/bolt#578

I already tested this fixe on my armv5 board with success.

Thanks

@lunny lunny added this to the 1.2.0 milestone Mar 22, 2017
@lunny lunny added the type/bug label Mar 22, 2017
@lunny
Copy link
Member

lunny commented Mar 22, 2017

please use govendor and that will update vendor/vendor.json to follow the git rev.

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 22, 2017
@psolyca
Copy link
Contributor Author

psolyca commented Mar 23, 2017

For now, I can not compile anymore. Do not know why, I have «out of memory» problem each time the build process is linking.

@psolyca
Copy link
Contributor Author

psolyca commented Mar 24, 2017

Ok, I manage to compile commit ae9b02b in 3 ways :

  • without any patch or update : same issue
  • with manual patch : no more error
  • with vendor update of BoltDB : no more error

I am updating my PR.

@psolyca psolyca closed this Mar 24, 2017
@psolyca psolyca reopened this Mar 24, 2017
Update vendor github.com/boltdb/bolt to take care of the issue #1354.
@ethantkoenig
Copy link
Member

LGTM

1 similar comment
@lunny
Copy link
Member

lunny commented Mar 27, 2017

LGTM

@tboerger tboerger removed the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 27, 2017
@lunny lunny merged commit a78a026 into go-gitea:master Apr 6, 2017
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants