Skip to content

affinity: handle NULL set name from --set affinity path - #16096

Closed
victorjulien wants to merge 1 commit into
OISF:mainfrom
victorjulien:bug-6735/v1
Closed

affinity: handle NULL set name from --set affinity path#16096
victorjulien wants to merge 1 commit into
OISF:mainfrom
victorjulien:bug-6735/v1

Conversation

@victorjulien

Copy link
Copy Markdown
Member

Setting a cpu-affinity path with --set, like

--set threading.cpu-affinity.worker-cpu-set.threads=28

creates an intermediate node under cpu-affinity whose val is NULL.

With a legacy list format cpu-affinity, AffinitySetupLoadFromConfig() red the set name from the node val and passed it to GetAffinitySetName(), which then dereferenced the NULL pointer.

Address it by simply checking for the NULL.

Ticket: #6735.

SV_BRANCH=OISF/suricata-verify#3310

Setting a cpu-affinity path with --set, like

  --set threading.cpu-affinity.worker-cpu-set.threads=28

creates an intermediate node under cpu-affinity whose val is NULL.

With a legacy list format cpu-affinity, AffinitySetupLoadFromConfig()
red the set name from the node val and passed it to
GetAffinitySetName(), which then dereferenced the NULL pointer.

Address it by simply checking for the NULL.

Ticket: OISF#6735.
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.02%. Comparing base (acd9d3a) to head (09d4509).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16096      +/-   ##
==========================================
- Coverage   83.05%   83.02%   -0.04%     
==========================================
  Files        1004     1004              
  Lines      277359   277361       +2     
==========================================
- Hits       230370   230273      -97     
- Misses      46989    47088      +99     
Flag Coverage Δ
fuzzcorpus 61.51% <0.00%> (-0.03%) ⬇️
livemode 18.41% <50.00%> (-0.19%) ⬇️
netns 22.84% <0.00%> (-0.07%) ⬇️
pcap 45.36% <0.00%> (-0.05%) ⬇️
suricata-verify 67.17% <100.00%> (+0.02%) ⬆️
unittests 58.53% <50.00%> (+<0.01%) ⬆️

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@suricata-qa

Copy link
Copy Markdown

Information: QA ran without warnings.

Pipeline = 33273

@victorjulien
victorjulien marked this pull request as ready for review August 25, 2026 05:32
Comment thread src/util-affinity.c
*/
static const char *GetAffinitySetName(const char *val)
{
if (val == NULL) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With a legacy list format cpu-affinity

so, this might not be needed if we remove the legacy format in 9?

related ticket: https://redmine.openinfosecfoundation.org/issues/7721

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could be potentially directly merged to main-8 branch though

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Might as well fix it while it isn't removed yet.

@victorjulien victorjulien added this to the 9.0 milestone Aug 25, 2026
@victorjulien

Copy link
Copy Markdown
Member Author

@lukashino please check the SV test as well.

@victorjulien

Copy link
Copy Markdown
Member Author

Merged in #16118, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants