/* * lz4defs.h -- architecture specific defines * * Copyright (C) 2013, LG Electronics, Kyungsik Lee * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ /* * Detects 64 bits mode */ #if defined(CONFIG_64BIT) #define LZ4_ARCH64 1 #else #define LZ4_ARCH64 0 #endif /* * Architecture-specific macros */ #define BYTE u8 typedef struct _U16_S { u16 v; } U16_S; typedef struct _U32_S { u32 v; } U32_S; typedef struct _U64_S { u64 v; } U64_S; #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) #define A16(x) (((U16_S *)(x))->v) #define A32(x) (((U32_S *)(x))->v) #define A64(x) (((U64_S *)(x))->v) #define PUT4(s, d) (A32(d) = A32(s)) #define PUT8(s, d) (A64(d) = A64(s)) #define LZ4_READ_LITTLEENDIAN_16(d, s, p) \ (d = s - A16(p)) #define LZ4_WRITE_LITTLEENDIAN_16(p, v) \ do { \ A16(p) = v; \ p += 2; \ } while (0) #else /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */ #define A64(x) get_unaligned((u64 *)&(((U16_S *)(x))->v)) #define A32(x) get_unaligned((u32 *)&(((U16_S *)(x))->v)) #define A16(x) get_unaligned((u16 *)&(((U16_S *)(x))->v)) #define PUT4(s, d) \ put_unaligned(get_unaligned((const u32 *) s), (u32 *) d) #define PUT8(s, d) \ put_unaligned(get_unaligned((const u64 *) s), (u64 *) d) #define LZ4_READ_LITTLEENDIAN_16(d, s, p) \ (d = s - get_unaligned_le16(p)) #define LZ4_WRITE_LITTLEENDIAN_16(p, v) \ do { \ put_unaligned_le16(v, (u16 *)(p)); \ p += 2; \ } while (0) #endif #define COPYLENGTH 8 #define ML_BITS 4 #define ML_MASK ((1U << ML_BITS) - 1) #define RUN_BITS (8 - ML_BITS) #define RUN_MASK ((1U << RUN_BITS) - 1) #define MEMORY_USAGE 14 #define MINMATCH 4 #define SKIPSTRENGTH 6 #define LASTLITERALS 5 #define MFLIMIT (COPYLENGTH + MINMATCH) #define MINLENGTH (MFLIMIT + 1) #define MAXD_LOG 16 #define MAXD (1 << MAXD_LOG) #define MAXD_MASK (u32)(MAXD - 1) #define MAX_DISTANCE (MAXD - 1) #define HASH_LOG (MAXD_LOG - 1) #define HASHTABLESIZE (1 << HASH_LOG) #define MAX_NB_ATTEMPTS 256 #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH) #define LZ4_64KLIMIT ((1<<16) + (MFLIMIT - 1)) #define HASHLOG64K ((MEMORY_USAGE - 2) + 1) #define HASH64KTABLESIZE (1U << HASHLOG64K) #define LZ4_HASH_VALUE(p) (((A32(p)) * 2654435761U) >> \ ((MINMATCH * 8) - (MEMORY_USAGE-2))) #define LZ4_HASH64K_VALUE(p) (((A32(p)) * 2654435761U) >> \ ((MINMATCH * 8) - HASHLOG64K)) #define HASH_VALUE(p) (((A32(p)) * 2654435761U) >> \ ((MINMATCH * 8) - HASH_LOG)) #if LZ4_ARCH64/* 64-bit */ #define STEPSIZE 8 #define LZ4_COPYSTEP(s, d) \ do { \ PUT8(s, d); \ d += 8; \ s += 8; \ } while (0) #define LZ4_COPYPACKET(s, d) LZ4_COPYSTEP(s, d) #define LZ4_SECURECOPY(s, d, e) \ do { \ if (d < e) { \ LZ4_WILDCOPY(s, d, e); \ } \ } while (0) #define HTYPE u32 #ifdef __BIG_ENDIAN #define LZ4_NBCOMMONBYTES(val) (__builtin_clzll(val) >> 3) #else #define LZ4_NBCOMMONBYTES(val) (__builtin_ctzll(val) >> 3) #endif #else /* 32-bit */ #define STEPSIZE 4 #define LZ4_COPYSTEP(s, d) \ do { \ PUT4(s, d); \ d += 4; \ s += 4; \ } while (0) #define LZ4_COPYPACKET(s, d) \ do { \ LZ4_COPYSTEP(s, d); \ LZ4_COPYSTEP(s, d); \ } while (0) #define LZ4_SECURECOPY LZ4_WILDCOPY #define HTYPE const u8* #ifdef __BIG_ENDIAN #define LZ4_NBCOMMONBYTES(val) (__builtin_clz(val) >> 3) #else #define LZ4_NBCOMMONBYTES(val) (__builtin_ctz(val) >> 3) #endif #endif #define LZ4_WILDCOPY(s, d, e) \ do { \ LZ4_COPYPACKET(s, d); \ } while (d < e) #define LZ4_BLINDCOPY(s, d, l) \ do { \ u8 *e = (d) + l; \ LZ4_WILDCOPY(s, d, e); \ d = e; \ } while (0) ='2017-01-31 12:29:24 -0500'>2017-01-31svcrpc: fix oops in absence of krb5 moduleJ. Bruce Fields1-1/+1 Olga Kornievskaia says: "I ran into this oops in the nfsd (below) (4.10-rc3 kernel). To trigger this I had a client (unsuccessfully) try to mount the server with krb5 where the server doesn't have the rpcsec_gss_krb5 module built." The problem is that rsci.cred is copied from a svc_cred structure that gss_proxy didn't properly initialize. Fix that. [120408.542387] general protection fault: 0000 [#1] SMP ... [120408.565724] CPU: 0 PID: 3601 Comm: nfsd Not tainted 4.10.0-rc3+ #16 [120408.567037] Hardware name: VMware, Inc. VMware Virtual = Platform/440BX Desktop Reference Platform, BIOS 6.00 07/02/2015 [120408.569225] task: ffff8800776f95c0 task.stack: ffffc90003d58000 [120408.570483] RIP: 0010:gss_mech_put+0xb/0x20 [auth_rpcgss] ... [120408.584946] ? rsc_free+0x55/0x90 [auth_rpcgss] [120408.585901] gss_proxy_save_rsc+0xb2/0x2a0 [auth_rpcgss] [120408.587017] svcauth_gss_proxy_init+0x3cc/0x520 [auth_rpcgss] [120408.588257] ? __enqueue_entity+0x6c/0x70 [120408.589101] svcauth_gss_accept+0x391/0xb90 [auth_rpcgss] [120408.590212] ? try_to_wake_up+0x4a/0x360 [120408.591036] ? wake_up_process+0x15/0x20 [120408.592093] ? svc_xprt_do_enqueue+0x12e/0x2d0 [sunrpc] [120408.593177] svc_authenticate+0xe1/0x100 [sunrpc] [120408.594168] svc_process_common+0x203/0x710 [sunrpc] [120408.595220] svc_process+0x105/0x1c0 [sunrpc] [120408.596278] nfsd+0xe9/0x160 [nfsd] [120408.597060] kthread+0x101/0x140 [120408.597734] ? nfsd_destroy+0x60/0x60 [nfsd] [120408.598626] ? kthread_park+0x90/0x90 [120408.599448] ret_from_fork+0x22/0x30 Fixes: 1d658336b05f "SUNRPC: Add RPC based upcall mechanism for RPCGSS auth" Cc: stable@vger.kernel.org Cc: Simo Sorce <simo@redhat.com> Reported-by: Olga Kornievskaia <kolga@netapp.com> Tested-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>