Re: [PATCH v2 seccomp 2/6] asm/syscall.h: Add syscall_arches[] array

From: YiFei Zhu
Date: Thu Sep 24 2020 - 12:02:48 EST


On Thu, Sep 24, 2020 at 9:37 AM YiFei Zhu <zhuyifei1999@xxxxxxxxx> wrote:
> > Try with a slghtly older gcc.
> > I think that entire optimisation (discarding const arrays)
> > is very recent.
>
> Will try, will take a while to get an old GCC to run, however :/

Possibly one of the oldest I can easily get to work is GCC 6.5.0, and
unrolling seems is still the case:

0000000000001560 <__seccomp_filter>:
[...]
15d4: 41 8b 74 24 04 mov 0x4(%r12),%esi
15d9: bf 08 01 00 00 mov $0x108,%edi
15de: 81 fe 3e 00 00 c0 cmp $0xc000003e,%esi
15e4: 75 30 jne 1616 <__seccomp_filter+0xb6>
[...]
1616: 81 fe 03 00 00 40 cmp $0x40000003,%esi
161c: bf 40 01 00 00 mov $0x140,%edi
1621: 74 c3 je 15e6 <__seccomp_filter+0x86>
1623: 0f 0b ud2

Am I overlooking something or should I go further back in the compiler version?

YiFei Zhu