2

I am trying to use a grsecurity gcc plugin that I found on their unofficial linux kernel source tree (the respectre_plugin/ one). My GCC version is 4.7, I modified scripts/gcc-plugins/Makefile to make it compile the plugin, and I built it with the root Makefile using make gcc-plugins, that shows no error. Then, when I try to compile a C file that has a Spectre-like flaw, I got the following build error:

file.c:36:31: error: array_index_mask_nospec is not defined

This function is defined in respectre_plugin/respectre_plugin.c, and I have no idea why I've got this strange build error, if anyone knows about it... My build invocation is the following:

gcc -Wall -Wextra -std=c99 -fplugin=/path/to/respectre_plugin.so -c file.c -o file.o

Thanks for any help !

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Lurricane
  • 21
  • 3
  • Since the problem occurs during the compile step, it means that the header file for the plug-in was not included. – user3629249 Apr 22 '20 at 14:11
  • `respectre_plugin.c` is converted into a shared object (dynamic library). This is where the function definition (of array_index_mask_nospec) is. That gcc command is unable to locate the `.so` file properly. Usually to utilize any `.so`, you need to provide path to linker and also the name of the `so` with a `-l` option. – Syed Waris Apr 26 '20 at 00:29
  • Alright I fixed it,`array_index_mask_nospec` was defined in the linux kernel sources, so I just redefined the symbol in `file.c`. I thought that gcc plugins automatically exported symbols to the source files in order to let the plugin use them – Lurricane Apr 27 '20 at 12:26

0 Answers0