ANDROID: cgroup: Fix cgroup_root backport padding calculation
ANDROID_BACKPORT_USE_ARRAY() needs to reserve enough space to fit a struct rcu_head at a minimum, and it reserves enough space for CGROUP_SUBSYS_COUNT atomic_ts. This works well on kernel configurations where the number of CGROUP_SUBSYS_COUNT is big enough to cause more space than what is needed for struct rcu_head to be reserved. However, for kernel configurations where CGROUP_SUBSYS_COUNT is too small and doesn't reserve enough space, the following build error is triggered: error: static assertion failed due to requirement 'sizeof(struct cgroup_root::(unnamed ...) <= sizeof(struct cgroup_root::(unnamed at ...))': struct callback_head rcu is larger than u8 __attribute__((__aligned__(8))) android_backport_reserved1[CGROUP_SUBSYS_COUNT * sizeof(atomic_t)] Instead of assuming CGROUP_SUBSYS_COUNT is large enough, given that the minimum size if the size of struct rcu_head, always make sure that much space is reserved if CGROUP_SUBSYS_COUNT is too small. Bug: 422866230 Fixes: d66e9166 ("ANDROID: fix ABI-break in struct cgroup_root") Change-Id: Ib34c9249c05c4ecfbf9c6d18b613afdd7dff5cb2 Signed-off-by:Isaac J. Manjarres <isaacmanjarres@google.com>
Loading
Please sign in to comment