[OpenAFS] Compilation problems

Kenan Avdic kavdic@gmail.com
Wed, 25 Feb 2015 22:51:57 +0100


Thanks for the detailed info.

I rebuilt the kernel with GRKERNSEC_RANDSTRUCT=n and was able to
compile. I got a new problem with linking though:

make -f /usr/src/linux-3.2.65-hardened-r2/scripts/Makefile.modpost
  scripts/mod/modpost -m  -i
/usr/src/linux-3.2.65-hardened-r2/Module.symvers -I
/home/xyko/openafs/openafs-git/src/libafs/MODLOAD-3.2.65-hardened-r2-MP/Module.symvers
 -o /home/xyko/openafs/openafs-git/src/libafs/MODLOAD-3.2.65-hardened-r2-MP/Module.symvers
-S -w  -s
WARNING: modpost: Found 265 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
  ld -r -m elf_x86_64 -T
/usr/src/linux-3.2.65-hardened-r2/scripts/module-common.lds --build-id
 -o /home/xyko/openafs/openafs-git/src/libafs/MODLOAD-3.2.65-hardened-r2-MP/afspag.ko
/home/xyko/openafs/openafs-git/src/libafs/MODLOAD-3.2.65-hardened-r2-MP/afspag.o
/home/xyko/openafs/openafs-git/src/libafs/MODLOAD-3.2.65-hardened-r2-MP/afspag.mod.o
  ld -r -m elf_x86_64 -T
/usr/src/linux-3.2.65-hardened-r2/scripts/module-common.lds --build-id
 -o /home/xyko/openafs/openafs-git/src/libafs/MODLOAD-3.2.65-hardened-r2-MP/libafs.ko
/home/xyko/openafs/openafs-git/src/libafs/MODLOAD-3.2.65-hardened-r2-MP/libafs.o
/home/xyko/openafs/openafs-git/src/libafs/MODLOAD-3.2.65-hardened-r2-MP/libafs.mod.o
make[5]: Leaving directory '/usr/src/linux-3.2.65-hardened-r2'
Error: Undefined symbols in modules
Makefile.afs:280: recipe for target 'libafs.ko' failed
make[4]: *** [libafs.ko] Error 1

I was able to solve this by reverting
dbdee60a83d72d38a04a0eeb2a5324cf497e57e3
(http://gerrit.openafs.org/#change,8981). Could I get in trouble for
that?

/Kenan

On 22 February 2015 at 23:15, Jeffrey Altman
<jaltman@secure-endpoints.com> wrote:
> On 2/22/2015 4:32 PM, Benjamin Kaduk wrote:
>>
>> I suspect that the struct layout randomization code is triggering on the
>> RAND_METHOD structure (see, e.g., is_pure_ops_struct() on the linked
>> patch), and the use of an ordered initializer is incompatible with the
>> layout randomization.  The bulk of the linked patch is converting struct
>> initializers to the C99 .member syntax, which is compatible with the
>> random layout.  OpenAFS cannot switch to that C99 syntax because it is not
>> fully supported on all the platforms OpenAFS attempts to support.  (This
>> code is actually code imported from Heimdal, anyway, so Heimdal would need
>> to make the change first.)
>
> The primary reason that Heimdal and OpenAFS do not use the C99 .member
> syntax is because the Windows compilers required to support Windows XP
> through Windows 7/Server 2008 R2 do not implement that portion of C99.
> Heimdal supports Windows C/C++ back to 15.00 and OpenAFS supports
> Windows C/C++ back to 14.00.
>
> I believe there are also older UNIX platforms that are still supported
> that do not have C99 compilers.
>
> Looking at the referenced patch you might want to add
>
>  #if GCC_VERSION >= 40500
>  # ifdef RANDSTRUCT_PLUGIN
>  # define __randomize_layout __attribute__((randomize_layout))
>  # define __no_randomize_layout __attribute__((no_randomize_layout))
>  # endif
>  #endif
>
> into the build and add the __no_randomize_layout macro to structures
> that are failing to build.   If you can construct an appropriate patch
> for Heimdal you can submit it as a pullup request via github.com.
>
> Jeffrey Altman
>
>



-- 
Kenan Avdic, M.Sc          Most people would sooner die than think;
kavdic@gmail.com             in fact, they do so. /Russell