Reproduced saAmfCSType — same DELETE mishandling, but no crash.
Instead it silently diverges the amfd-internal model from IMM.
~~~~
SC-2-1:~ # immcfg -c SaAmfCSBaseType safCSType=cst930
SC-2-1:~ # immcfg -c SaAmfCSType safVersion=4.0.0,safCSType=cst930
SC-2-1:~ # immcfg -c SaAmfCSBaseType safCSType=cst931
SC-2-1:~ # immcfg -c SaAmfCSType safVersion=4.0.0,safCSType=cst931
SC-2-1:~ # immcfg -c SaAmfCSI \
>   -a 'saAmfCSType=safVersion=4.0.0,safCSType=cst930' \
>   safCsi=csi930,safSi=si930,safApp=safAmfService
SC-2-1:~ # immadm -o 2 safSi=si930,safApp=safAmfService
~~~~

Trigger — DELETE

~~~~
SC-2-1:~ # immcfg -a 'saAmfCSType-=safVersion=4.0.0,safCSType=cst931' \
>   safCsi=csi930,safSi=si930,safApp=safAmfService ; echo "rc=$?"
rc=0

SC-2-1:~ # immlist -a saAmfCSType safCsi=csi930,safSi=si930,safApp=safAmfService
saAmfCSType=safVersion=4.0.0,safCSType=cst930
~~~~


---

**[tickets:#3406] amf: amfd crashes on delete of non-matching type attribute 
value \(attr-=\)**

**Status:** assigned
**Milestone:** 5.27.01
**Created:** Fri Oct 09, 2026 07:27 AM UTC by Nguyen Tran Trung Hau
**Last Updated:** Fri Oct 09, 2026 09:47 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

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] 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