02 Nov, 2018
1 commit
-
The seq_send & seq_send64 fields in struct krb5_ctx are used as
atomically incrementing counters. This is implemented using cmpxchg() &
cmpxchg64() to implement what amount to custom versions of
atomic_fetch_inc() & atomic64_fetch_inc().Besides the duplication, using cmpxchg64() has another major drawback in
that some 32 bit architectures don't provide it. As such commit
571ed1fd2390 ("SUNRPC: Replace krb5_seq_lock with a lockless scheme")
resulted in build failures for some architectures.Change seq_send to be an atomic_t and seq_send64 to be an atomic64_t,
then use atomic(64)_* functions to manipulate the values. The atomic64_t
type & associated functions are provided even on architectures which
lack real 64 bit atomic memory access via CONFIG_GENERIC_ATOMIC64 which
uses spinlocks to serialize access. This fixes the build failures for
architectures lacking cmpxchg64().A potential alternative that was raised would be to provide cmpxchg64()
on the 32 bit architectures that currently lack it, using spinlocks.
However this would provide a version of cmpxchg64() with semantics a
little different to the implementations on architectures with real 64
bit atomics - the spinlock-based implementation would only work if all
access to the memory used with cmpxchg64() is *always* performed using
cmpxchg64(). That is not currently a requirement for users of
cmpxchg64(), and making it one seems questionable. As such avoiding
cmpxchg64() outside of architecture-specific code seems best,
particularly in cases where atomic64_t seems like a better fit anyway.The CONFIG_GENERIC_ATOMIC64 implementation of atomic64_* functions will
use spinlocks & so faces the same issue, but with the key difference
that the memory backing an atomic64_t ought to always be accessed via
the atomic64_* functions anyway making the issue moot.Signed-off-by: Paul Burton
Fixes: 571ed1fd2390 ("SUNRPC: Replace krb5_seq_lock with a lockless scheme")
Cc: Trond Myklebust
Cc: Anna Schumaker
Cc: J. Bruce Fields
Cc: Jeff Layton
Cc: David S. Miller
Cc: linux-nfs@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Trond Myklebust
19 Oct, 2018
1 commit
-
Signed-off-by: Trond Myklebust
05 Oct, 2018
1 commit
-
The newly introduced gss_seq_send64_fetch_and_inc() fails to build on
32-bit architectures:net/sunrpc/auth_gss/gss_krb5_seal.c:144:14: note: in expansion of macro 'cmpxchg'
seq_send = cmpxchg(&ctx->seq_send64, old, old + 1);
^~~~~~~
arch/x86/include/asm/cmpxchg.h:128:3: error: call to '__cmpxchg_wrong_size' declared with attribute error: Bad argument size for cmpxchg
__cmpxchg_wrong_size(); \As the message tells us, cmpxchg() cannot be used on 64-bit arguments,
that's what cmpxchg64() does.Fixes: 571ed1fd2390 ("SUNRPC: Replace krb5_seq_lock with a lockless scheme")
Signed-off-by: Arnd Bergmann
Signed-off-by: Trond Myklebust
01 Oct, 2018
1 commit
-
Signed-off-by: Trond Myklebust
01 Aug, 2018
1 commit
-
Remove trailing whitespace and blank line at EOF
Signed-off-by: Stephen Hemminger
Signed-off-by: Anna Schumaker
20 Mar, 2018
1 commit
-
Fix unaligned access in gss_{get,verify}_mic_v2() on sparc64
Signed-off-by: James Ettle
Signed-off-by: J. Bruce Fields
25 Nov, 2014
1 commit
-
It's always set to whatever CONFIG_SUNRPC_DEBUG is, so just use that.
Signed-off-by: Jeff Layton
Signed-off-by: Trond Myklebust
04 Aug, 2014
1 commit
-
Use u16 pointer in setup_token and setup_token_v2. None of the fields
are actually handled as __be16, so this simplifies the code a bit. Also
get rid of some unneeded pointer increments.Signed-off-by: Jeff Layton
Signed-off-by: Trond Myklebust
12 Mar, 2012
1 commit
-
net/sunrpc/svcsock.c:412:22: warning: incorrect type in assignment
(different address spaces)
- svc_partial_recvfrom now takes a struct kvec, so the variable
save_iovbase needs to be an ordinary (void *)Make a bunch of variables in net/sunrpc/xprtsock.c static
Fix a couple of "warning: symbol 'foo' was not declared. Should it be
static?" reports.Fix a couple of conflicting function declarations.
Signed-off-by: Trond Myklebust
15 May, 2010
8 commits
-
Add necessary changes to add kernel support for the rc4-hmac Kerberos
encryption type used by Microsoft and described in rfc4757.Signed-off-by: Kevin Coffman
Signed-off-by: Steve Dickson
Signed-off-by: Trond Myklebust -
For the arcfour-hmac support, the make_seq_num and get_seq_num
functions need access to the kerberos context structure.
This will be used in a later patch.Signed-off-by: Kevin Coffman
Signed-off-by: Steve Dickson
Signed-off-by: Trond Myklebust -
For arcfour-hmac support, the make_checksum function needs a usage
field to correctly calculate the checksum differently for MIC and
WRAP tokens.Signed-off-by: Kevin Coffman
Signed-off-by: Steve Dickson
Signed-off-by: Trond Myklebust -
This is a step toward support for AES encryption types which are
required to use the new token formats defined in rfc4121.Signed-off-by: Kevin Coffman
[SteveD: Fixed a typo in gss_verify_mic_v2()]
Signed-off-by: Steve Dickson
[Trond: Got rid of the TEST_ROTATE/TEST_EXTRA_COUNT crap]
Signed-off-by: Trond Myklebust -
Add the final pieces to support the triple-des encryption type.
Signed-off-by: Kevin Coffman
Signed-off-by: Steve Dickson
Signed-off-by: Trond Myklebust -
Encryption types besides DES may use a keyed checksum (hmac).
Modify the make_checksum() function to allow for a key
and take care of enctype-specific processing such as truncating
the resulting hash.Signed-off-by: Kevin Coffman
Signed-off-by: Steve Dickson
Signed-off-by: Trond Myklebust -
Add enctype framework and change functions to use the generic
values from it rather than the values hard-coded for des.Signed-off-by: Kevin Coffman
Signed-off-by: Steve Dickson
Signed-off-by: Trond Myklebust -
Add encryption type to the krb5 context structure and use it to switch
to the correct functions depending on the encryption type.Signed-off-by: Kevin Coffman
Signed-off-by: Steve Dickson
Signed-off-by: Trond Myklebust
30 Mar, 2010
1 commit
-
…it slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
24 Jun, 2008
1 commit
-
cleanup:
Document token header size with a #define instead of open-coding it.Don't needlessly increment "ptr" past the beginning of the header
which makes the values passed to functions more understandable and
eliminates the need for extra "krb5_hdr" pointer.Clean up some intersecting white-space issues flagged by checkpatch.pl.
This leaves the checksum length hard-coded at 8 for DES. A later patch
cleans that up.Signed-off-by: Kevin Coffman
Signed-off-by: J. Bruce Fields
24 Apr, 2008
3 commits
-
g_make_token_header() and g_token_size() add two too many, and
therefore their callers pass in "(logical_value - 2)" rather
than "logical_value" as hard-coded values which causes confusion.This dates back to the original g_make_token_header which took an
optional token type (token_id) value and added it to the token.
This was removed, but the routine always adds room for the token_id
rather than not.Signed-off-by: Kevin Coffman
Signed-off-by: J. Bruce Fields -
Consistently use unsigned (u32 vs. s32) for seqnum.
In get_mic function, send the local copy of seq_send,
rather than the context version.Signed-off-by: Kevin Coffman
Signed-off-by: J. Bruce Fields -
cleanup: When adding new encryption types, the checksum length
can be different for each enctype. Face the fact that the
current code only supports DES which has a checksum length of 8.Signed-off-by: Kevin Coffman
Signed-off-by: J. Bruce Fields
18 Nov, 2007
1 commit
-
Return an error from gss_import_sec_context_kerberos if the
negotiated context contains encryption or checksum types not
supported by the kernel code.This fixes an Oops because success was assumed and later code found
no internal_ctx_id.Signed-off-by: Kevin Coffman
Signed-off-by: Trond Myklebust
02 Nov, 2007
1 commit
-
Not architecture specific code should not #include .
This patch therefore either replaces them with
#include or simply removes them if they were
unused.Signed-off-by: Adrian Bunk
Signed-off-by: Jens Axboe
04 Feb, 2007
1 commit
-
The tk_pid field is an unsigned short. The proper print format specifier for
that type is %5u, not %4d.Also clean up some miscellaneous print formatting nits.
Signed-off-by: Chuck Lever
Signed-off-by: Trond Myklebust
06 Dec, 2006
7 commits
-
Miscellaneous cosmetic fixes.
Signed-off-by: J. Bruce Fields
Signed-off-by: Trond Myklebust -
The sealalg is checked in several places, giving the impression it could be
either SEAL_ALG_NONE or SEAL_ALG_DES. But in fact SEAL_ALG_NONE seems to
be sufficient only for making mic's, and all the contexts we get must be
capable of wrapping as well. So the sealalg must be SEAL_ALG_DES. As
with signalg, just check for the right value on the downcall and ignore it
otherwise. Similarly, tighten expectations for the sealalg on incoming
tokens, in case we do support other values eventually.Signed-off-by: J. Bruce Fields
Signed-off-by: Trond Myklebust -
Remove some unnecessary goto labels; clean up some return values; etc.
Signed-off-by: J. Bruce Fields
Signed-off-by: Trond Myklebust -
We're doing some pointless translation between krb5 constants and kernel
crypto string names.Also clean up some related spkm3 code as necessary.
Signed-off-by: J. Bruce Fields
Signed-off-by: Trond Myklebust -
Previous changes reveal some obvious cruft.
Signed-off-by: J. Bruce Fields
Signed-off-by: Trond Myklebust -
We designed the krb5 context import without completely understanding the
context. Now it's clear that there are a number of fields that we ignore,
or that we depend on having one single value.In particular, we only support one value of signalg currently; so let's
check the signalg field in the downcall (in case we decide there's
something else we could support here eventually), but ignore it otherwise.Signed-off-by: J. Bruce Fields
Signed-off-by: Trond Myklebust -
Dumping all this data to the logs is wasteful (even when debugging is turned
off), and creates too much output to be useful when it's turned on.Fix a minor style bug or two while we're at it.
Signed-off-by: J. Bruce Fields
Signed-off-by: Trond Myklebust
29 Sep, 2006
1 commit
-
pure s/u32/__be32/
[AV: large part based on Alexey's patches]
Signed-off-by: Alexey Dobriyan
Signed-off-by: Al Viro
Signed-off-by: David S. Miller
28 Jun, 2006
1 commit
-
locking init cleanups:
- convert " = SPIN_LOCK_UNLOCKED" to spin_lock_init() or DEFINE_SPINLOCK()
- convert rwlocks in a similar mannerthis patch was generated automatically.
Motivation:
- cleanliness
- lockdep needs control of lock initialization, which the open-coded
variants do not give
- it's also useful for -rt and for lock debugging in generalSigned-off-by: Ingo Molnar
Signed-off-by: Arjan van de Ven
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
21 Mar, 2006
2 commits
-
Use a spinlock to ensure unique sequence numbers when creating krb5 gss tokens.
Signed-off-by: J. Bruce Fields
Signed-off-by: Trond Myklebust -
Remove unnecessary kmalloc of temporary space to hold the md5 result; it's
small enough to just put on the stack.This code may be called to process rpc's necessary to perform writes, so
there's a potential deadlock whenever we kmalloc() here. After this a
couple kmalloc()'s still remain, to be removed soon.This also fixes a rare double-free on error noticed by coverity.
Signed-off-by: J. Bruce Fields
Signed-off-by: Trond Myklebust
09 Nov, 2005
1 commit
-
From: Jesper Juhl
This is the net/ part of the big kfree cleanup patch.
Remove pointless checks for NULL prior to calling kfree() in net/.
Signed-off-by: Jesper Juhl
Cc: "David S. Miller"
Cc: Arnaldo Carvalho de Melo
Acked-by: Marcel Holtmann
Acked-by: YOSHIFUJI Hideaki
Signed-off-by: Andrew Morton
19 Oct, 2005
3 commits
-
Remove some senseless wrappers.
Signed-off-by: J. Bruce Fields
Signed-off-by: Trond Myklebust -
Not only are the qop parameters that are passed around throughout the gssapi
unused by any currently implemented mechanism, but there appears to be some
doubt as to whether they will ever be used. Let's just kill them off for now.Signed-off-by: J. Bruce Fields
Signed-off-by: Trond Myklebust -
Add support for privacy to the krb5 rpcsec_gss mechanism.
Signed-off-by: J. Bruce Fields
Signed-off-by: Trond Myklebust