1# Seccomp-BPF Kernel Self-Test Suite 2 3This repository contains a mirror of the upstream Linux kernel test suite for the Seccomp-BPF 4system call filter. The test suite runs as part of CTS, but it is maintained in a separate 5repository because the code is GPL. 6 7## Syncing to Upstream 8 9Rather than hold the entire Linux history in this repository, only the subdirectory for the Seccomp 10selftests are preserved here. In order to sync this repository to the upstream Linux, follow these 11instructions. 12 13The pristine copy of the upstream source is kept on a branch called upstream-master. This branch is 14then merged into an Android development branch. 15 16### First-Time Setup 17 18These instructions only need to be followed for the first time you are updating the repository from 19a checkout. 20 211. Configure a remote to use as the source repository (limited to only syncing the master branch): 22 ``` 23 git remote add upstream-linux git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git -t master --no-tags 24 ``` 25 26### Updating the Source 27 28Perform these steps every time you need to update the test suite from upstream. 29 301. Update the remote to fetch the latest sources: 31 ``` 32 git remote update upstream-linux 33 ``` 34 352. Create a new local branch from the updated source, replacing YYYYMMDD with today's date: 36 ``` 37 git checkout -b update-YYYYMMDD upstream-linux/master 38 ``` 39 403. Filter the branch to just the subtree containing the Seccomp test suite: 41 ``` 42 git filter-branch --subdirectory-filter tools/testing/selftests/seccomp 43 ``` 44 454. Check out the upstream-master branch, which contains the pristine, filter-branch'd copy of the 46source code. Pushing non-merge commits with a "forged" author/committer can only be done against 47the upstream-master branch. 48 ``` 49 git checkout -b upstream-master aosp/upstream-master 50 ```` 51 525. Update this upstream-master branch to the newly filtered branch of upstream-linux. 53 ``` 54 git merge --ff-only update-YYYYMMDD 55 ``` 56 576. Upload the changes on upstream-master for review and submit them. 58 597. Merge the changes from upstream-master into the Android development branch (typically master). 60Resolve any conflicts with the local modifications present in the repository. 61 ``` 62 repo start sync-upstream . 63 git subtree merge -P linux/ upstream-master 64 ``` 65 66Now build and test the changes by running CTS: 67 68 $ mmma cts/tests/tests/os 69 $ cts-tradefed run singleCommand cts -m CtsOsTestCases -t android.os.cts.SeccompTest 70 71The tests are expected to pass on arm, arm64, x86, and x86\_64. If they pass, then repo 72upload/submit the CL branch. Afterwards, you can remove the update-YYYYMMDD branch. 73 74### Linux Space-Saving 75 76If you already have a Linux kernel checkout, you can skip adding Linux as a remote and instead 77perform steps 1-3 of "Updating the Source" in the kernel checkout. Then simply fetch the filtered 78branch into the seccomp-tests repository and subtree merge it (as FETCH\_HEAD). This will avoid 79copying the entire kernel history into your local checkout. 80