Unaligned access in gss_{get,verify}_mic_v2() on sparc64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux