Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: improve the internal syscall tables (gperf,CSV) #223

Closed
wants to merge 3 commits into from

Commits on Mar 22, 2020

  1. arch: add an automatically generated syscall table in CSV format

    Later patches will make use of this new syscall table format instead
    of the manually maintained tables.
    
    The new CSV syscall table was generated with the following command:
    
      # ./arch-syscall-validate -c <kernel_source_dir> > syscalls.csv
    
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    pcmoore committed Mar 22, 2020
    Configuration menu
    Copy the full SHA
    a394668 View commit details
    Browse the repository at this point in the history
  2. arch: use gperf to generate a perfact hash to lookup syscall names

    This patch significantly improves the performance of
    seccomp_syscall_resolve_name since it replaces the expensive strcmp
    for each syscall in the database, with a lookup table.
    
    The complexity for syscall_resolve_num is not changed and it
    uses the linear search, that is anyway less expensive than
    seccomp_syscall_resolve_name as it uses an index for comparison
    instead of doing a string comparison.
    
    On my machine, calling 1000 seccomp_syscall_resolve_name_arch and
    seccomp_syscall_resolve_num_arch over the entire syscalls DB passed
    from ~0.45 sec to ~0.06s.
    
    PM: After talking with Giuseppe I made a number of additional
    changes, some substantial, the highlights include:
    * various style tweaks
    * .gitignore fixes
    * fixed subject line, tweaked the description
    * dropped the arch-syscall-validate changes as they were masking
      other problems
    * extracted the syscalls.csv and file deletions to other patches
      to keep this one more focused
    * fixed the x86, x32, arm, all the MIPS ABIs, s390, and s390x ABIs as
      the syscall offsets were not properly incorporated into this change
    * cleaned up the ABI specific headers
    * cleaned up generate_syscalls_perf.sh and renamed to
      arch-gperf-generate
    * fixed problems with automake's file packaging
    
    Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
    Reviewed-by: Tom Hromatka <tom.hromatka@oracle.com>
    [PM: see notes in the "PM" section above]
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    giuseppe authored and pcmoore committed Mar 22, 2020
    Configuration menu
    Copy the full SHA
    20887d0 View commit details
    Browse the repository at this point in the history
  3. arch: remove the unused, manually generated syscall tables

    Since the move to gperf and the automatically generated syscall table
    in CSV format, these manually maintained tables are no longer needed.
    
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    pcmoore committed Mar 22, 2020
    Configuration menu
    Copy the full SHA
    c549b64 View commit details
    Browse the repository at this point in the history