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

Add vectorscan (same abi as hyperscan) for arm 64 #29881

Conversation

sambercovici
Copy link
Contributor

@sambercovici sambercovici commented Sep 30, 2023

Commit Message: Fix #29276
Additional Description: Use Vectorscan for Arm 64 CPUs
Risk Level: Low
Testing: Covered by original commit
Docs Changes:
Release Notes:
Platform Specific Features: aarch64

@repokitteh-read-only
Copy link

Hi @sambercovici, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #29881 was opened by sambercovici.

see: more, trace.

@repokitteh-read-only repokitteh-read-only bot added the deps Approval required for changes to Envoy's external dependencies label Sep 30, 2023
@repokitteh-read-only
Copy link

CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).
envoyproxy/dependency-shepherds assignee is @htuch

🐱

Caused by: #29881 was opened by sambercovici.

see: more, trace.

sambercovici and others added 6 commits September 30, 2023 03:01
Signed-off-by: Samuel Bercovici <[email protected]>
this is now handled downstream

Signed-off-by: Ryan Northey <[email protected]>
Signed-off-by: Samuel Bercovici <[email protected]>
Signed-off-by: Samuel Bercovici <[email protected]>
Signed-off-by: Samuel Bercovici <[email protected]>
@sambercovici sambercovici force-pushed the Add-Vectorscan-(same-ABI-as-Hyperscan)-for-Arm-64 branch from c909e2a to 8b34041 Compare September 30, 2023 03:03
#define AARCH64_CPUID_INLINE_H_

#if defined(__linux__)
+#include <asm/hwcap.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix this upstream?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opened VectorCamp/vectorscan#176 waiting for response on ISSUE-1 there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this be fixed before we merge?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to wait a few days, it will be included yes, but I'm fixing clang 15/16 issues right now as they are higher priority and ironing out a few issues with the new CI. I'll post an update here when that happens.

@@ -484,6 +484,24 @@ REPOSITORY_LOCATIONS_SPEC = dict(
license = "BSD-3-Clause",
license_url = "https:/intel/hyperscan/blob/v{version}/LICENSE",
),
io_vectorscan = dict(
project_name = "Vectorscan",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you run through https:/envoyproxy/envoy/blob/main/DEPENDENCY_POLICY.md?

Given regex processing can in many paces be considered security sensitive (correctness of rule matching, CPU/memory DoS for example), I'd like to weigh up the win we're getting from this dependency, which seems to be a community fork.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @htuch

The vectorscan is a company (https://www.vectorcamp.gr/) and community led fork (under paid contract: https://www.vectorcamp.gr/2020/05/09/we-are-thrilled-to-announce-our-first-customer/) to support hyperscan ABI in Arm CPUs and additional CPUs with the same license, same tests, scans and fixes.
see: #29276 (comment) for additional information on CI builds, tests, etc.

Let me know if you want me to fill the items as described in: https:/envoyproxy/envoy/blob/main/DEPENDENCY_POLICY.md

-Sam.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - yeah, please fill in the table so we can evaluate this new dep.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding VectorCamp/vectorscan#177 as reference.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OSSF Scorecard result is low. Security policy and code review would help.

scorecard --repo=https:/VectorCamp/vectorscan/
RESULTS
-------
Aggregate score: 4.1 / 10

Check scores:
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
|  SCORE  |          NAME          |             REASON             |                                               DOCUMENTATION/REMEDIATION                                               |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| 10 / 10 | Binary-Artifacts       | no binaries found in the repo  | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#binary-artifacts       |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| 1 / 10  | Branch-Protection      | branch protection is not       | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#branch-protection      |
|         |                        | maximal on development and all |                                                                                                                       |
|         |                        | release branches               |                                                                                                                       |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| 0 / 10  | CI-Tests               | 0 out of 6 merged PRs          | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#ci-tests               |
|         |                        | checked by a CI test -- score  |                                                                                                                       |
|         |                        | normalized to 0                |                                                                                                                       |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| 0 / 10  | CII-Best-Practices     | no effort to earn an OpenSSF   | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#cii-best-practices     |
|         |                        | best practices badge detected  |                                                                                                                       |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| 1 / 10  | Code-Review            | found 6 unreviewed changesets  | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#code-review            |
|         |                        | out of 7 -- score normalized   |                                                                                                                       |
|         |                        | to 1                           |                                                                                                                       |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| 10 / 10 | Contributors           | 6 different organizations      | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#contributors           |
|         |                        | found -- score normalized to   |                                                                                                                       |
|         |                        | 10                             |                                                                                                                       |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| ?       | Dangerous-Workflow     | no workflows found             | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#dangerous-workflow     |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| 0 / 10  | Dependency-Update-Tool | no update tool detected        | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#dependency-update-tool |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| 0 / 10  | Fuzzing                | project is not fuzzed          | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#fuzzing                |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| 9 / 10  | License                | license file detected          | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#license                |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| 10 / 10 | Maintained             | 30 commit(s) out of 30 and 0   | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#maintained             |
|         |                        | issue activity out of 30 found |                                                                                                                       |
|         |                        | in the last 90 days -- score   |                                                                                                                       |
|         |                        | normalized to 10               |                                                                                                                       |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| ?       | Packaging              | no published package detected  | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#packaging              |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| ?       | Pinned-Dependencies    | no dependencies found          | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#pinned-dependencies    |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| 0 / 10  | SAST                   | SAST tool is not run on all    | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#sast                   |
|         |                        | commits -- score normalized to |                                                                                                                       |
|         |                        | 0                              |                                                                                                                       |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| 0 / 10  | Security-Policy        | security policy file not       | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#security-policy        |
|         |                        | detected                       |                                                                                                                       |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| ?       | Signed-Releases        | no releases found              | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#signed-releases        |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| ?       | Token-Permissions      | no github tokens found         | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#token-permissions      |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| 10 / 10 | Vulnerabilities        | no vulnerabilities detected    | https:/ossf/scorecard/blob/7a94273ba14c1c702688f9efb57754d9fe112519/docs/checks.md#vulnerabilities        |
|---------|------------------------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|

Copy link

@markos markos Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, all PRs are CI tested (about 100 configurations), unfortunately there is a new CI in development now (buildbot-based) which is not yet integrated with Github. This was already in progress for weeks and it should be ready the next days. FTR, here is the new CI: https://buildbot-ci.vectorcamp.gr/

Copy link

@markos markos Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we do the Debian packaging ourselves, it's directly uploaded to Debian and Ubuntu, there is a debian branch for that purpose. We will not produce Binary releases, signed or unsigned within Github. For the same reason, dependency tracking is either done in the CMakeFile or the debian package.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The score is artificially low. see: #29276 (comment)

@sambercovici
Copy link
Contributor Author

Hi @htuch , how can we progress?

@htuch
Copy link
Member

htuch commented Oct 6, 2023

I think that given we're in the same position as Hyperscan, this is contrib/ only anyway and most tablestakes from our policy are there, we should go ahead. Thanks everyone (including the Vectorscan folks) for your inputs.

@jmarantz
Copy link
Contributor

jmarantz commented Oct 12, 2023

@htuch what's the next step; are more changes required or should we add more review comments? Or is it time to close or merge this?

I have no horse in this race and have not read the code; just trying to figure out how triage the PR as maintainer oncall.

@htuch
Copy link
Member

htuch commented Oct 13, 2023

I was waiting for https:/envoyproxy/envoy/pull/29881/files#r1348331292 to be resolved, CC @markos who has the AI on that. LGTM when that is fixed, or if the fix is going to be substantively delayed, we can merge now if a followup issue is filed.

@alyssawilk
Copy link
Contributor

/wait-any on the unresolved issues being resolved

@markos
Copy link

markos commented Oct 30, 2023

@htuch the new release of vectorscan with this fix, will happen the next days. In the meantime, I just learned myself about recent changes in hyperscan license: https://networkbuilders.intel.com/docs/networkbuilders/accelerate-snort-performance-with-hyperscan-and-intel-xeon-processors-on-public-clouds-1680176363.pdf (section 2.2)
In essence, versions 5.5 onwards are closed/proprietary license.

You might want to consider that for the future.

@htuch
Copy link
Member

htuch commented Oct 31, 2023

Relevant passage is:

The latest open-source version (BSD-3 license) of Hyperscan on Github is 5.4. Intel conducts continuous internal
development and delivers new Hyperscan releases under Intel Proprietary License (IPL) beginning from 5.5 for interested
customers. Please contact authors to learn more about getting new Hyperscan releases.

I think this means we will be unable to promote Hyperscan to a non-contrib extension, unless there is some LTS assurance on security releases. What will Vectorscan do going forward?

CC @envoyproxy/dependency-shepherds

@htuch
Copy link
Member

htuch commented Nov 21, 2023

@markos LMK when fixed and I can merge.

/wait

@markos
Copy link

markos commented Nov 21, 2023

Signed-off-by: Samuel Bercovici <[email protected]>
@repokitteh-read-only repokitteh-read-only bot added deps Approval required for changes to Envoy's external dependencies and removed waiting labels Nov 21, 2023
@sambercovici
Copy link
Contributor Author

updated sha256 to use the latest 5.4.11 tar.gz.
@htuch , @markos , let me know if anything else is needed.
Otherwise, please approve and merge.

@markos
Copy link

markos commented Nov 21, 2023

@sambercovici @htuch I've already uploaded it to Debian: https://buildd.debian.org/status/package.php?p=vectorscan nothing else is left on my side. Thanks for supporting the project.

@htuch htuch enabled auto-merge (squash) November 21, 2023 16:06
auto-merge was automatically disabled November 25, 2023 01:18

Head branch was pushed to by a user without write access

@sambercovici
Copy link
Contributor Author

Hi @htuch ,

@markos added for vectorscan 5.4.11 mandatory dependencies on pkg-config and libsqlite3-dev.
The original hyperscan does not mandate pgk-config and sqlite3.

Envoy dev/build environment does not include those dependency.
I don't feel comfortable adding those dependencies to address the changes in 5.4.11.
Instead, I created a patch that
(a) reverts VectorCamp/vectorscan#188 and
(b) adds a flag to disable the detection of sqlite3 altogether.

@markos , please consider making pkg-config optional and detect that sqlite3 does not exists, so I can remove that patches.
@htuch, please let me know if you want to handle this differently, or otherwise please approve.

-Sam.

@markos
Copy link

markos commented Nov 25, 2023

@markos , please consider making pkg-config optional and detect that sqlite3 does not exists, so I can remove that patches. @htuch, please let me know if you want to handle this differently, or otherwise please approve.

I have no objections making sqlite optional, but pkg-config will stay. I find no reason to duplicate its functionality in the cmakefiles and in the future other possible dependencies will also be able to use it. It's in every distro and it's a really small dependency.

@sambercovici
Copy link
Contributor Author

@htuch , I suggest we merge as is and when the build container(s) / dev instructions adds pkg-config, I will remove the patch part NOT mandating it, ok?

Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but please followup to remove this patch!

@repokitteh-read-only repokitteh-read-only bot removed the deps Approval required for changes to Envoy's external dependencies label Nov 28, 2023
@htuch
Copy link
Member

htuch commented Nov 28, 2023

OK, this has lingered for super long so let's jut merge but I think we shouldn't need an sqlite dependency and I'm hoping there is some clean way to resolve the pkgconfig thing.

@htuch htuch enabled auto-merge (squash) November 28, 2023 23:10
@htuch htuch merged commit dcf8850 into envoyproxy:main Nov 28, 2023
109 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Vectorscan (same ABI as Hyperscan) for Arm 64
9 participants