lkml.org 
[lkml]   [2020]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v2 seccomp 2/6] asm/syscall.h: Add syscall_arches[] array
Date
From: YiFei Zhu
> Sent: 24 September 2020 15:17
>
> On Thu, Sep 24, 2020 at 8:47 AM David Laight <David.Laight@aculab.com> wrote:
> > I doubt the compiler will do what you want.
> > Looking at it, in most cases there are one or two entries.
> > I think only MIPS has three.
>
> It does ;) GCC 10.2.0:
>
> $ objdump -d kernel/seccomp.o | less
> [...]
> 0000000000001520 <__seccomp_filter>:
> [...]
> 1587: 41 8b 54 24 04 mov 0x4(%r12),%edx
> 158c: b9 08 01 00 00 mov $0x108,%ecx
> 1591: 81 fa 3e 00 00 c0 cmp $0xc000003e,%edx
> 1597: 75 2e jne 15c7 <__seccomp_filter+0xa7>
> [...]
> 15c7: 81 fa 03 00 00 40 cmp $0x40000003,%edx
> 15cd: b9 40 01 00 00 mov $0x140,%ecx
> 15d2: 74 c5 je 1599 <__seccomp_filter+0x79>
> 15d4: 0f 0b ud2
> [...]
> 0000000000001cb0 <seccomp_cache_prepare>:
> [...]
> 1cc4: 41 b9 3e 00 00 c0 mov $0xc000003e,%r9d
> [...]
> 1dba: 41 b9 03 00 00 40 mov $0x40000003,%r9d
> [...]
> 0000000000002e30 <proc_pid_seccomp_cache>:
> [...]
> 2e72: ba 3e 00 00 c0 mov $0xc000003e,%edx
> [...]
> 2eb5: ba 03 00 00 40 mov $0x40000003,%edx
>
> Granted, I have CC_OPTIMIZE_FOR_PERFORMANCE rather than
> CC_OPTIMIZE_FOR_SIZE, but this patch itself is trying to sacrifice
> some of the memory for speed.

Don't both CC_OPTIMIZE_FOR_PERFORMANCE (-??) and CC_OPTIMIZE_FOR_SIZE (-s)
generate terrible code?

Try with a slghtly older gcc.
I think that entire optimisation (discarding const arrays)
is very recent.

David


-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
\
 
 \ /
  Last update: 2020-09-24 16:21    [W:0.089 / U:3.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site