Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 483504 - aircrack-ng-9999 build failure due to PIC unfriendly ASM
Summary: aircrack-ng-9999 build failure due to PIC unfriendly ASM
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-03 17:14 UTC by Rick Farina (Zero_Chaos)
Modified: 2013-10-04 23:30 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (128850.txt,26.17 KB, text/plain)
2013-09-03 17:14 UTC, Rick Farina (Zero_Chaos)
Details
0001-aircrack-ptw-lib.c-get-rid-of-textrel-in-rc4test_amd.patch (0001-aircrack-ptw-lib.c-get-rid-of-textrel-in-rc4test_amd.patch,1.59 KB, patch)
2013-09-03 18:17 UTC, Sergei Trofimovich (RETIRED)
Details | Diff
try-2.patch (try-2.patch,911 bytes, patch)
2013-09-29 09:44 UTC, Sergei Trofimovich (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Farina (Zero_Chaos) gentoo-dev 2013-09-03 17:14:14 UTC
Created attachment 357770 [details]
build.log

I know we have been through this before, but can someone please give me a hand fixing this?  I've been all over the build system and I can't figure out what is wrong here
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2013-09-03 18:17:03 UTC
Created attachment 357778 [details, diff]
0001-aircrack-ptw-lib.c-get-rid-of-textrel-in-rc4test_amd.patch

Fixes textrel in assembler bit.

As described in
https://wiki.gentoo.org/wiki/Project:Hardened/HOWTO_locate_and_fix_textrels
("How to make gcc worry about it")

I hope I didn cont parameter count right and dereferenced source args proper amount of times.

So, please test if it works.

Thanks!
Comment 2 Rick Farina (Zero_Chaos) gentoo-dev 2013-09-28 03:45:34 UTC
ozzie aircrack-ng # make      
make -C src all
make[1]: Entering directory `/usr/src/aircrack-ng/src'
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=2333  -Wno-unused-but-set-variable -Wno-array-bounds -Iinclude   -c -o aircrack-ng.o aircrack-ng.c
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=2333  -Wno-unused-but-set-variable -Wno-array-bounds -Iinclude   -c -o crypto.o crypto.c
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=2333  -Wno-unused-but-set-variable -Wno-array-bounds -Iinclude   -c -o common.o common.c
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=2333  -Wno-unused-but-set-variable -Wno-array-bounds -Iinclude   -c -o uniqueiv.o uniqueiv.c
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=2333  -Wno-unused-but-set-variable -Wno-array-bounds -Iinclude   -c -o aircrack-ptw-lib.o aircrack-ptw-lib.c
aircrack-ptw-lib.c: In function ‘rc4test_amd64_sse2’:
aircrack-ptw-lib.c:260:8: error: memory input 9 is not directly addressable
aircrack-ptw-lib.c:260:20: error: memory input 10 is not directly addressable
make[1]: *** [aircrack-ptw-lib.o] Error 1
make[1]: Leaving directory `/usr/src/aircrack-ng/src'
make: *** [all] Error 2


looks to me like this patch doesn't quite hit the mark.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2013-09-29 09:44:38 UTC
Created attachment 359730 [details, diff]
try-2.patch

Added direct memory reference.

objdump -S -d -r aircrack-ptw-lib.o

Before the patch it was immediate encoding:

      81:       66 0f 6f 04 25 00 00    movdqa 0x0,%xmm0
      88:       00 00 
                        86: R_X86_64_32S        .rodata+0x10
      8a:       66 0f 6f 0c 25 00 00    movdqa 0x0,%xmm1
      91:       00 00 
                        8f: R_X86_64_32S        .rodata

gcc inferences RIP-relative addressing both on hardened and on vanilla:

      f5:       66 0f 6f 05 00 00 00    movdqa 0x0(%rip),%xmm0        # fd <compare+0xfd>
      fc:       00 
                        f9: R_X86_64_PC32       .rodata+0xc
      fd:       66 0f 6f 0d 00 00 00    movdqa 0x0(%rip),%xmm1        # 105 <compare+0x105>
     104:       00 
                        101: R_X86_64_PC32      .rodata-0x4

In theory it's even one byte shorter encoding (but a bit more complex) than before.
Comment 4 Rick Farina (Zero_Chaos) gentoo-dev 2013-10-04 17:35:47 UTC
(In reply to Sergei Trofimovich from comment #3)
> Created attachment 359730 [details, diff] [details, diff]
> try-2.patch

This patch seems to work, thanks slyfox, I'll float it by upstream.
Comment 5 Rick Farina (Zero_Chaos) gentoo-dev 2013-10-04 23:30:32 UTC
https://travis-ci.org/aircrack-ng/aircrack-ng/builds/12154259

Thanks slyfox, you are the man.