Hi Nguyen,

The fix looks good to me, ack.

Thanks,
Nagendra, [email protected] 
<mailto:[email protected]> 
[email protected] <mailto:[email protected]> 
High Availability Solutions

From: Nguyen Tran Trung Hau via Opensaf-tickets 
<[email protected]> 
Sent: 19 October 2026 13:57
To: [email protected]
Cc: Nguyen Tran Trung Hau <[email protected]>
Subject: [tickets] [opensaf:tickets] #3406 amf: amfd crashes on delete of 
non-matching type attribute value (attr-=)

 

*       status: assigned --> review

  _____  

[tickets:#3406] <https://sourceforge.net/p/opensaf/tickets/3406/>  amf: amfd 
crashes on delete of non-matching type attribute value (attr-=)

Status: review
Milestone: 5.27.01
Created: Fri Oct 09, 2026 07:27 AM UTC by Nguyen Tran Trung Hau
Last Updated: Fri Oct 09, 2026 10:23 AM UTC
Owner: Nguyen Tran Trung Hau

osafamfd NULL-pointer dereference at sg.cc:930 - nonmatching DELETE of 
saAmfSGType on locked SG crashes the active AMF director and reboots the node.
>From sg.cc, ccb_apply_modify_hdlr walks the attrMods list of the CCB modify 
>operation. For each mod it sets up 2 things:

void *value = nullptr;
...
if ((attr_mod->modType == SA_IMM_ATTR_VALUES_DELETE) ||
          (attribute->attrValues == nullptr)) {
        /* Attribute value is deleted, revert to default value */
        value_is_deleted = true; // value stays NULL
 } else {
        /* Attribute value is modified */
        value_is_deleted = false;
        value = attribute->attrValues[0];
 }

For DELETE mods, value is never assigned, every attribute branch checks 
value_is_deleted and reverts to a default instead of touching value, except the 
saAmfSGType:

if (!strcmp(attribute->attrName, "saAmfSGType")) {
        SaNameT sg_type_name = *((SaNameT *)value); // NULL deref on DELTE

The execution flow for saAmfSGType:

1.      sg_ccb_completed_modify_hdlr() sees value_is_deleted for saAmfSGType
and does "continue" (sg.cc:617-618) — DELETE approved unchecked.
2.      sg_ccb_apply_modify_hdlr() leaves value=NULL for the DELETE mod
(sg.cc:919-927).
3.      The saAmfSGType branch is the only attribute branch that dereferences
value without checking value_is_deleted (sg.cc:929-930):
"SaNameT sg_type_name = ((SaNameT )value)" — NULL deref.
4.      amfd dies with SIGSEGV; osafamfnd sees POLLERR on the amfd fifo and
calls opensaf_reboot() — the node reboots. rc=0 at the client because
immModel_ccbCommit completes before the apply upcall reaches the OI.

Test scenario:

1.      Cluster running, SC-1 as Active controller.
2.      Create an empty SG under a non-OpenSAF app (SGs under safApp=OpenSAF
reject admin operations)
3.      Lock the SG (admin state != UNLOCKED selects the vulnerable arm)
4.      Delete a value that is NOT the current value

Expected: CCB rejected with a validation error.
Observed: "The system is going down for reboot NOW!" —
amfd SIGSEGV, nid reboots the node.

Reproduced output:

#1. create an empty SG:
SC-2-1:~ # immcfg -c SaAmfSG \
  -a 'saAmfSGType=safVersion=4.0.0,safSgType=OpenSafSgTypeNoRed' \
  safSg=repro930,safApp=safAmfService
SC-2-1:~ # immlist -a saAmfSGAdminState safSg=repro930,safApp=safAmfService
saAmfSGAdminState=1
 
#2. lock the SG
SC-2-1:~ # immadm -o 2 safSg=repro930,safApp=safAmfService
SC-2-1:~ # immlist -a saAmfSGAdminState safSg=repro930,safApp=safAmfService
saAmfSGAdminState=2
 
#3. delete a value that isn't there (SG is NoRed, delete 2N)
SC-2-1:~ # immcfg -a 'saAmfSGType-=safVersion=4.0.0,safSgType=OpenSafSgType2N' \
>   safSg=repro930,safApp=safAmfService ; echo "rc=$?"
rc=0
The system is going down for reboot NOW!

The same single command also crashes saAmfSUType and saAmfCompType:

1.      su.cc:2055-2066 saAmfSUType — identical continue/deref pattern, but
NO admin-state gate: crashes in any SU state.
2.      comp.cc:2138 + comptype.cc:49 saAmfCompType — deleted DN resolves to
no comptype, avd_comptype_add_comp() derefs comp->comp_type=NULL.
3.      csi.cc:655/1010 saAmfCSType — no crash but silent divergence

  _____  

Sent from sourceforge.net because [email protected] 
<mailto:[email protected]>  is subscribed to 
https://sourceforge.net/p/opensaf/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/opensaf/admin/tickets/options. Or, if this is a 
mailing list, you can unsubscribe from the mailing list.

_______________________________________________
Opensaf-tickets mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to