All of lore.kernel.org
 help / color / mirror / Atom feed
* Unaligned access in gss_{get,verify}_mic_v2() on sparc64
@ 2017-12-02 23:28 ` James Ettle
  0 siblings, 0 replies; 9+ messages in thread
From: James Ettle @ 2017-12-02 23:28 UTC (permalink / raw)
  To: linux-nfs; +Cc: sparclinux

Hello,

I've been using nfs4 with krb5 on sparc64 with kernel 4.13 and 4.14 and
seeing a lot of messages like:

sparky kernel: [  105.262927] Kernel unaligned access at TPC[10afb234]
gss_get_mic_kerberos+0xd4/0x360 [rpcsec_gss_krb5]

I've traced this down to gss_get_mic_v2() in gss_krb5_seal.c. I think
the suspicious line is:

	*((__be64 *)(krb5_hdr + 8)) = cpu_to_be64(seq_send);

krb5_hdr is void*, but comes from a u16 so won't generally have __be64
alignment. As an experiment I added local variable

	__be64 seq_send_be64;

and replaced the cpu_to_be64 line with:

	seq_send_be64 = cpu_to_be64(seq_send);
	memcpy(krb5_hdr + 8, (char *) &seq_send_be64, 8);

There's another one in gss_verify_mic_v2() in gss_krb5_unseal.c. Here
there's a line

	if (be16_to_cpu(*((__be16 *)ptr)) != KG2_TOK_MIC)

but ptr is a u8*. For this I added local variable

	__be16 data_be16;

and replaced the above if() with

	memcpy((void *) &data_be16, (char *) ptr, 2);
	if (be16_to_cpu(data_be16) != KG2_TOK_MIC)

I've not seen any misalignment complaints yet with this.

I apologise for not sending this in the form of a patch, but this is
only a sketch solution. I'm not a kernel hacker and I'm sure someone
else will make a proper job of it!

Thanks,

James.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-01-28 20:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-02 23:28 Unaligned access in gss_{get,verify}_mic_v2() on sparc64 James Ettle
2017-12-02 23:28 ` James Ettle
2017-12-06 19:09 ` J. Bruce Fields
2017-12-06 19:09   ` J. Bruce Fields
2017-12-07  1:42   ` James Ettle
2017-12-07  1:42     ` James Ettle
2018-01-28 16:34     ` James Ettle
2018-01-28 20:08       ` Sam Ravnborg
2018-01-28 20:08         ` Sam Ravnborg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.