kernel_optimize_test/crypto
Waiman Long 453431a549 mm, treewide: rename kzfree() to kfree_sensitive()
As said by Linus:

  A symmetric naming is only helpful if it implies symmetries in use.
  Otherwise it's actively misleading.

  In "kzalloc()", the z is meaningful and an important part of what the
  caller wants.

  In "kzfree()", the z is actively detrimental, because maybe in the
  future we really _might_ want to use that "memfill(0xdeadbeef)" or
  something. The "zero" part of the interface isn't even _relevant_.

The main reason that kzfree() exists is to clear sensitive information
that should not be leaked to other future users of the same memory
objects.

Rename kzfree() to kfree_sensitive() to follow the example of the recently
added kvfree_sensitive() and make the intention of the API more explicit.
In addition, memzero_explicit() is used to clear the memory to make sure
that it won't get optimized away by the compiler.

The renaming is done by using the command sequence:

  git grep -w --name-only kzfree |\
  xargs sed -i 's/kzfree/kfree_sensitive/'

followed by some editing of the kfree_sensitive() kerneldoc and adding
a kzfree backward compatibility macro in slab.h.

[akpm@linux-foundation.org: fs/crypto/inline_crypt.c needs linux/slab.h]
[akpm@linux-foundation.org: fix fs/crypto/inline_crypt.c some more]

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: James Morris <jmorris@namei.org>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Joe Perches <joe@perches.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Jason A . Donenfeld" <Jason@zx2c4.com>
Link: http://lkml.kernel.org/r/20200616154311.12314-3-longman@redhat.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-08-07 11:33:22 -07:00
..
asymmetric_keys mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
async_tx
842.c
acompress.c
adiantum.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
aead.c
aegis.h
aegis128-core.c
aegis128-neon-inner.c
aegis128-neon.c
aes_generic.c
aes_ti.c
af_alg.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-08-05 20:13:21 -07:00
ahash.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
akcipher.c
algapi.c
algboss.c
algif_aead.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-08-05 20:13:21 -07:00
algif_hash.c
algif_rng.c
algif_skcipher.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-08-05 20:13:21 -07:00
ansi_cprng.c
anubis.c
api.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
arc4.c
authenc.c
authencesn.c
blake2b_generic.c crypto: Replace HTTP links with HTTPS ones 2020-07-23 17:34:20 +10:00
blake2s_generic.c
blowfish_common.c
blowfish_generic.c
camellia_generic.c crypto: Replace HTTP links with HTTPS ones 2020-07-23 17:34:20 +10:00
cast_common.c
cast5_generic.c
cast6_generic.c
cbc.c
ccm.c
cfb.c
chacha_generic.c
chacha20poly1305.c
cipher.c
cmac.c
compress.c
crc32_generic.c
crc32c_generic.c
crct10dif_common.c
crct10dif_generic.c
cryptd.c
crypto_engine.c
crypto_null.c
crypto_user_base.c
crypto_user_stat.c
ctr.c
cts.c
curve25519-generic.c
deflate.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
des_generic.c
dh_helper.c
dh.c crypto: dh - SP800-56A rev 3 local public key validation 2020-07-31 18:08:59 +10:00
drbg.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
ecb.c
ecc_curve_defs.h
ecc.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
ecc.h crypto: ecc - SP800-56A rev 3 local public key validation 2020-07-31 18:08:59 +10:00
ecdh_helper.c
ecdh.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
echainiv.c
ecrdsa_defs.h
ecrdsa_params.asn1
ecrdsa_pub_key.asn1
ecrdsa.c
essiv.c
fcrypt.c
fips.c
gcm.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
geniv.c
gf128mul.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
ghash-generic.c
hash_info.c
hmac.c
internal.h
jitterentropy-kcapi.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
jitterentropy.c crypto: Replace HTTP links with HTTPS ones 2020-07-23 17:34:20 +10:00
jitterentropy.h
Kconfig crypto: Replace HTTP links with HTTPS ones 2020-07-23 17:34:20 +10:00
keywrap.c
khazad.c
kpp.c
lrw.c crypto: Replace HTTP links with HTTPS ones 2020-07-23 17:34:20 +10:00
lz4.c
lz4hc.c
lzo-rle.c
lzo.c
Makefile
md4.c
md5.c
memneq.c
michael_mic.c
nhpoly1305.c
ofb.c
pcbc.c
pcrypt.c padata: fold padata_alloc_possible() into padata_alloc() 2020-07-23 17:34:18 +10:00
poly1305_generic.c
proc.c
ripemd.h
rmd128.c
rmd160.c
rmd256.c
rmd320.c
rng.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
rsa_helper.c
rsa-pkcs1pad.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
rsa.c
rsaprivkey.asn1
rsapubkey.asn1
salsa20_generic.c crypto: Replace HTTP links with HTTPS ones 2020-07-23 17:34:20 +10:00
scatterwalk.c
scompress.c
seed.c
seqiv.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
serpent_generic.c
sha1_generic.c
sha3_generic.c crypto: Replace HTTP links with HTTPS ones 2020-07-23 17:34:20 +10:00
sha256_generic.c
sha512_generic.c
shash.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
simd.c
skcipher.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
sm3_generic.c
sm4_generic.c
streebog_generic.c
tcrypt.c
tcrypt.h
tea.c
testmgr.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
testmgr.h crypto: testmgr - delete duplicated words 2020-07-23 17:34:20 +10:00
tgr192.c
twofish_common.c
twofish_generic.c
vmac.c
wp512.c
xcbc.c
xor.c
xts.c crypto: xts - Replace memcpy() invocation with simple assignment 2020-07-31 18:09:00 +10:00
xxhash_generic.c
zstd.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00