Re: arch/arm64/kernel/signal.c:1300: undefined reference to `preserve_gcs_context'

Catalin Marinas
2025-09-25T10:28:45Z

On Wed, Sep 24, 2025 at 06:30:53PM +0800, kernel test robot wrote:
> FYI, the error/warning still remains.
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: cec1e6e5d1ab33403b809f79cd20d6aff124ccfe
> commit: f00b53f1614f7be554fd28b9594ef4e63e2686c5 arm64: cpufeature: Add GCS to cpucap_is_possible()
> date: 10 months ago
> config: arm64-randconfig-r132-20250924 (https://download.01.org/0day-ci/archive/20250924/202509241856.XvV8zSHD-lkp@intel.com/config)
> compiler: aarch64-linux-gcc (GCC) 10.5.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250924/202509241856.XvV8zSHD-lkp@intel.com/reproduce)

Robin's commit was supposed to fix this.

> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202509241856.XvV8zSHD-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> aarch64-linux-ld: Unexpected GOT/PLT entries detected!
> aarch64-linux-ld: Unexpected run-time procedure linkages detected!
> aarch64-linux-ld: arch/arm64/kernel/signal.o: in function `setup_sigframe':
> >> arch/arm64/kernel/signal.c:1300: undefined reference to `preserve_gcs_context'
> aarch64-linux-ld: arch/arm64/kernel/signal.o: in function `restore_sigframe':
> >> arch/arm64/kernel/signal.c:1042: undefined reference to `restore_gcs_context'
>
>
> vim +1300 arch/arm64/kernel/signal.c
>
> bb4891a6c3551f Dave Martin 2017-06-15 1258
> 20987de3c2c45c Dave Martin 2017-06-15 1259 static int setup_sigframe(struct rt_sigframe_user_layout *user,
> 2e8a1acea8597f Kevin Brodsky 2024-10-29 1260 struct pt_regs *regs, sigset_t *set,
> 2e8a1acea8597f Kevin Brodsky 2024-10-29 1261 const struct user_access_state *ua_state)
> 2c020ed8d148f7 Catalin Marinas 2012-03-05 1262 {
[...]
> 16f47bb9ac8afe Mark Brown 2024-10-01 1297 if (system_supports_gcs() && err == 0 && user->gcs_offset) {
> 16f47bb9ac8afe Mark Brown 2024-10-01 1298 struct gcs_context __user *gcs_ctx =
> 16f47bb9ac8afe Mark Brown 2024-10-01 1299 apply_user_offset(user, user->gcs_offset);
> 16f47bb9ac8afe Mark Brown 2024-10-01 @1300 err |= preserve_gcs_context(gcs_ctx);
> 16f47bb9ac8afe Mark Brown 2024-10-01 1301 }

It looks like the compiler was not able to remove these calls. Is this
compiler-specific?

--
Catalin