MIPS required the pointers to be aligned
Details
- Reviewers
pjd - Commits
- rS308137: Fix alignment issues on MIPS: align the pointers properly.
5520 GEOM_ELI tests passed successfully
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
sys/geom/eli/g_eli.h | ||
---|---|---|
251 | This is why I said above in #ifdef guards, and wondering about an appropriate macro to use. Because of this geli does not work today on mips64, so we can either end up with a new on-disk geli format for mips64 or have geli explicitly not supported on mips64. |
sys/geom/eli/g_eli.h | ||
---|---|---|
251 | So md5 requires that we hash into an aligned buffer? Do we have the same issue with ARM? |
Longer term, I think we should see if we can bump G_ELI_VERSION and apply this change on all architectures, in addition to switching away from md5.
sys/geom/eli/g_eli.h | ||
---|---|---|
251 | Yes md5 requires aligned md_hash. Not sure about ARM |
sys/geom/eli/g_eli.h | ||
---|---|---|
251 | Alternately we could memcpy the md_hash in. |
sys/geom/eli/g_eli.h | ||
---|---|---|
356 | FYI I would expect that alignment of at least 4 is mandated by all of our ABIs. |
sbin/geom/class/eli/geom_eli.c | ||
---|---|---|
670 | I'm slightly surprised we'd end up with a misaligned sector[], even if it's not explicitly guaranteed. However, if we do need to explicitly specify alignment there should be no problem (for this stack variable) doing it for all architectures. |
sbin/geom/class/eli/geom_eli.c | ||
---|---|---|
670 | We should do it for all architectures. There's no harm, and it may help. | |
sys/geom/eli/g_eli.h | ||
356 | Why not make this an array of uint32_t? | |
sys/geom/eli/g_eli_integrity.c | ||
449 | We can do this for all archs. There's no harm. | |
456 | Ditto. But honestly, the kernel malloc should returned a properly aligned buffer. Have you verified that it actually doesn't? |
sbin/geom/class/eli/geom_eli.c | ||
---|---|---|
670 | Probably something like __aligned(__alignof(struct g_eli_metadata)) |
sbin/geom/class/eli/geom_eli.c | ||
---|---|---|
670 | __alignof(struct g_eli_metadata) is 1, but we need 4 |
sys/geom/eli/g_eli_integrity.c | ||
---|---|---|
456 | p is adjusted pointer: if (bp->bio_cmd == BIO_READ) { data = bp->bio_driver2; p = auth + sc->sc_alen * nsec; } else { data = malloc(size, M_ELI, M_WAITOK); p = data + encr_secsize * nsec; } p = (char *)roundup((uintptr_t)p, sizeof(uintptr_t)); Sometimes p comes not aligned after this. |