SMACK: Add sk_clone_security LSM hook
authorLontke Michael <michael.lontke@elektrobit.com>
Wed, 31 Aug 2022 12:03:26 +0000 (14:03 +0200)
committerCasey Schaufler <casey@schaufler-ca.com>
Tue, 27 Sep 2022 17:33:03 +0000 (10:33 -0700)
commit4ca165fc6c49c3b0100f61524ffbca4743d46e8d
treed4173b1c3e8290074b3329be13e39a44d2d51629
parentb90cb1053190353cc30f0fef0ef1f378ccc063c5
SMACK: Add sk_clone_security LSM hook

Using smk_of_current() during sk_alloc_security hook leads in
rare cases to a faulty initialization of the security context
of the created socket.

By adding the LSM hook sk_clone_security to SMACK this initialization
fault is corrected by copying the security context of the old socket
pointer to the newly cloned one.

Co-authored-by: Martin Ostertag: <martin.ostertag@elektrobit.com>
Signed-off-by: Lontke Michael <michael.lontke@elektrobit.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
security/smack/smack_lsm.c