trace: Use explicit alignment requirements to avoid misalignment
64-bit builds with CONFIG_WPA_TRACE=y resulted in the wpabuf pointers getting misaligned (only 32-bit aligned) and that would result in reads and writes of unaligned size_t values. Avoid this by indicating explicit alignment requirement for wpabuf_trace to 8 octets (i.e., there will be extra four octets of padding in case of 64-bit builds). Similarly, struct os_alloc_trace resulted in some potential misalignment cases, e.g., when CONFIG_ACS=y uses a 'long double' variable within struct hostapd_channel_data. Avoid misalignment issues with explicit alignment indication. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
f97e3ce473
commit
e01281fccc
2 changed files with 2 additions and 2 deletions
|
@ -36,7 +36,7 @@ struct os_alloc_trace {
|
||||||
struct dl_list list;
|
struct dl_list list;
|
||||||
size_t len;
|
size_t len;
|
||||||
WPA_TRACE_INFO
|
WPA_TRACE_INFO
|
||||||
};
|
} __attribute__((aligned(16)));
|
||||||
|
|
||||||
#endif /* WPA_TRACE */
|
#endif /* WPA_TRACE */
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
struct wpabuf_trace {
|
struct wpabuf_trace {
|
||||||
unsigned int magic;
|
unsigned int magic;
|
||||||
};
|
} __attribute__((aligned(8)));
|
||||||
|
|
||||||
static struct wpabuf_trace * wpabuf_get_trace(const struct wpabuf *buf)
|
static struct wpabuf_trace * wpabuf_get_trace(const struct wpabuf *buf)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue