suricata icon indicating copy to clipboard operation
suricata copied to clipboard

src: make Suricata build on Solaris

Open l1gi opened this issue 1 year ago • 12 comments

Make sure these boxes are signed before submitting your Pull Request -- thank you.

  • [X] I have read the contributing guide lines at https://docs.suricata.io/en/latest/devguide/contributing/contribution-process.html
  • [X] I have signed the Open Information Security Foundation contribution agreement at https://suricata.io/about/contribution-agreement/ (note: this is only required once)
  • [X] I have updated the user guide (in doc/userguide/) to reflect the changes made (if applicable)
  • [X] I have created a ticket at https://redmine.openinfosecfoundation.org/projects/suricata/issues (if applicable)

Link to ticket: https://redmine.openinfosecfoundation.org/issues/7005

Describe changes:

  • src/main.c: Fix alignment problems on SPARC. Based on similar fixes found at: https://lists.debian.org/debian-sparc/2012/01/msg00012.html and: https://www.winehq.org/pipermail/wine-patches/2011-February/098547.html
  • src/source-pcap-file-directory-helper.c, src/util-path.c: Solaris doesn't define d_type dirent member and DT_REG type.
  • src/suricata.c: Only Linux and the BSDs support the RLIMIT_NPROC resource limit.
  • src/util-syslog.c: Solaris syslog.h doesn't define LOG_FTP.
  • src/util-time.c: Solaris tm doesn't define tm_gmtoff member.

l1gi avatar Jun 12 '24 09:06 l1gi

What's the difference between __sun and __sparc?

Hi Jeff,

__sun means SunOS, in other words Solaris OS. __sparc means hardware platform with SPARC CPU inside.

That part relates just to SPARC. I have hit a memory miss-align. That is quite common and that ta 6 is the easiest solution/workaround. Once the CPU detects the address alignment issue, that instruction just causes CPU to emulate that particular instruction with multiple instructions. There is slight hardware penalty, but it works reliably.

Regards, m.

l1gi avatar Jun 12 '24 13:06 l1gi

NOTE: This PR may contain new authors.

github-actions[bot] avatar Jun 12 '24 14:06 github-actions[bot]

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 79.10%. Comparing base (304271e) to head (453c734). Report is 243 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11297      +/-   ##
==========================================
- Coverage   82.61%   79.10%   -3.52%     
==========================================
  Files         919      919              
  Lines      248997   248821     -176     
==========================================
- Hits       205717   196826    -8891     
- Misses      43280    51995    +8715     
Flag Coverage Δ
fuzzcorpus 60.60% <0.00%> (-0.29%) :arrow_down:
livemode 18.66% <42.85%> (+<0.01%) :arrow_up:
pcap 44.16% <28.57%> (+0.02%) :arrow_up:
suricata-verify ?
unittests 59.01% <42.85%> (+<0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

codecov[bot] avatar Jun 12 '24 14:06 codecov[bot]

Run ./scripts/clang-format.sh check-branch --diffstat --show-commits  >> check_formatting_log.txt 2>&1
 src/threads.h     |  4 +---
 src/util-path.c   |  2 +-
 src/util-syslog.c | 32 ++++++++------------------------
 3 files changed, 10 insertions(+), 28 deletions(-)

Commits on branch (new -> old):
23bbfe2d3 src: make Suricata build on Solaris

ERROR: Branch requires formatting
ERROR: View required changes with: clang-format.sh check-branch --diff
ERROR: Use ./scripts/clang-format.sh branch to fix formatting,
            then add formatting changes to a new commit
Error: Formatting is not following code style guide!
Error: Process completed with exit code 1.

Do I understand correctly, that the commit message is wrong(ly formatted)? Could anyone guide me how to correct it?

Thank you, m.

l1gi avatar Jun 14 '24 10:06 l1gi

Run ./scripts/clang-format.sh check-branch --diffstat --show-commits  >> check_formatting_log.txt 2>&1
 src/threads.h     |  4 +---
 src/util-path.c   |  2 +-
 src/util-syslog.c | 32 ++++++++------------------------
 3 files changed, 10 insertions(+), 28 deletions(-)

Commits on branch (new -> old):
23bbfe2d3 src: make Suricata build on Solaris

ERROR: Branch requires formatting
ERROR: View required changes with: clang-format.sh check-branch --diff
ERROR: Use ./scripts/clang-format.sh branch to fix formatting,
            then add formatting changes to a new commit
Error: Formatting is not following code style guide!
Error: Process completed with exit code 1.

Do I understand correctly, that the commit message is wrong(ly formatted)? Could anyone guide me how to correct it?

Thank you, m.

This should help: https://docs.suricata.io/en/latest/devguide/codebase/code-style.html

jlucovsky avatar Jun 14 '24 13:06 jlucovsky

What's the difference between __sun and __sparc?

Hi Jeff,

__sun means SunOS, in other words Solaris OS. __sparc means hardware platform with SPARC CPU inside.

That part relates just to SPARC. I have hit a memory miss-align. That is quite common and that ta 6 is the easiest solution/workaround. Once the CPU detects the address alignment issue, that instruction just causes CPU to emulate that particular instruction with multiple instructions. There is slight hardware penalty, but it works reliably.

Regards, m.

Is there a use case when __sun is defined but __sparc isn't?

jlucovsky avatar Jun 14 '24 13:06 jlucovsky

Is there a use case when __sun is defined but __sparc isn't?

Yes, Solaris supports all kind of Intel architecture like __i386, __amd64 but also __x86_64: GCC architectures.

l1gi avatar Jun 18 '24 16:06 l1gi

Sorry for an extra commit.

l1gi avatar Jun 18 '24 16:06 l1gi

friendly ping @l1gi will you work further on this ?

catenacyber avatar Aug 28 '24 08:08 catenacyber

friendly ping @l1gi will you work further on this ?

Yes, sorry for delay. Will try to prepare the new change today or tomorrow.

Thank you, m.

l1gi avatar Aug 28 '24 09:08 l1gi

Thanks for the changes, we expect a new PR instead of pushing on the existing one cf https://docs.suricata.io/en/latest/devguide/contributing/code-submission-process.html#pull-requests

catenacyber avatar Sep 23 '24 13:09 catenacyber

NOTE: This PR may contain new authors.

github-actions[bot] avatar Sep 23 '24 15:09 github-actions[bot]

CI is red, please open a new rebased PR

catenacyber avatar Nov 18 '24 15:11 catenacyber