From ddf077f140f12e6f0c7de3bd45cc4b1ea4ce4875 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 7 Oct 2021 15:45:28 +0200 Subject: [PATCH] ANDROID: Fix up KABI breakage in 4.19.209 in struct sock Commit 35306eb23814 ("af_unix: fix races in sk_peer_pid and sk_peer_cred accesses") was backported to 4.19.209 and it adds a new field to struct sock. We want to keep this commit, so rework it using the reserved fields we have set up for this very issue. However, putting a spinlock_t into a 64bit value breaks when building with some debugging options enabled, so we have to disable them when doing build testing for the allmodconfig builds. In order to do that, the following config options are forced off: DEBUG_SPINLOCK DEBUG_LOCK_ALLOC LOCK_STAT DEBUG_WW_MUTEX_SLOWPATH DEBUG_LOCK_ALLOC PROVE_LOCKING We only really want to disable DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC as those affect the size of spinlock_t, but the other options need to be disabled as well because they try to force on the locking debug config options when selected. Note, this does not affect any device's behavior, those options are only being disabled for the test systems when doing allmodconfig builds. They are not enabled in the normal GKI builds, so all is fine there. Bug: 161946584 Signed-off-by: Greg Kroah-Hartman Change-Id: I23df70a6bcbbc9d773e790cdf0377c1c67cdf682 --- build.config.allmodconfig | 6 ++++++ include/net/sock.h | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build.config.allmodconfig b/build.config.allmodconfig index 103d1cdf4edc..dd01f6a34425 100644 --- a/build.config.allmodconfig +++ b/build.config.allmodconfig @@ -7,6 +7,12 @@ function update_config() { -d CPU_BIG_ENDIAN \ -d STM \ -d TEST_MEMCAT_P \ + -d DEBUG_SPINLOCK \ + -d DEBUG_LOCK_ALLOC \ + -d LOCK_STAT \ + -d DEBUG_WW_MUTEX_SLOWPATH \ + -d DEBUG_LOCK_ALLOC \ + -d PROVE_LOCKING \ -e UNWINDER_FRAME_POINTER \ (cd ${OUT_DIR} && \ diff --git a/include/net/sock.h b/include/net/sock.h index d6c281dc66ca..7d619a898ccb 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -472,7 +472,6 @@ struct sock { u32 sk_ack_backlog; u32 sk_max_ack_backlog; kuid_t sk_uid; - spinlock_t sk_peer_lock; struct pid *sk_peer_pid; const struct cred *sk_peer_cred; @@ -513,7 +512,7 @@ struct sock { struct sock_reuseport __rcu *sk_reuseport_cb; struct rcu_head sk_rcu; - ANDROID_KABI_RESERVE(1); + ANDROID_KABI_USE(1, spinlock_t sk_peer_lock); ANDROID_KABI_RESERVE(2); ANDROID_KABI_RESERVE(3); ANDROID_KABI_RESERVE(4);