Giter Site home page Giter Site logo

Potential bug/vulnerability about sel4 HOT 6 CLOSED

JorgeMVP avatar JorgeMVP commented on June 6, 2024
Potential bug/vulnerability

from sel4.

Comments (6)

lsf37 avatar lsf37 commented on June 6, 2024 1

I think you might be right, there is nothing in the decode path that says that the VCPU must be currently associated with a TCB, and therefore vcpu->vcpuTCB could be NULL.

That means invokeVCPUInjectIRQ should definitely guard against this case, and write to the VCPU object register instead of doing a remote call when there is no TCB (same as in the unicore case).

I.e. it should be:

exception_t invokeVCPUInjectIRQ(vcpu_t *vcpu, unsigned long index, virq_t virq)
{
    if (likely(ARCH_NODE_STATE(armHSCurVCPU) == vcpu)) {
        set_gic_vcpu_ctrl_lr(index, virq);
#ifdef ENABLE_SMP_SUPPORT
    } else if (vcpu->vcpuTCB != NULL && vcpu->vcpuTCB->tcbAffinity != getCurrentCPUIndex()) {
        doRemoteOp3Arg(IpiRemoteCall_VCPUInjectInterrupt, (word_t)vcpu, index, virq.words[0],      vcpu->vcpuTCB->tcbAffinity);
#endif /* CONFIG_ENABLE_SMP */
    } else {
        vcpu->vgic.lr[index] = virq;
    }

    return EXCEPTION_NONE;
}

Well spotted. Goes to show that the SMP kernel really is not that mature yet esp with HYP features or MCS.

Did you run into a crash with that or did you see it in the code?

from sel4.

andybui01 avatar andybui01 commented on June 6, 2024 1

Did you run into a crash with that or did you see it in the code?

Code inspection.

from sel4.

lsf37 avatar lsf37 commented on June 6, 2024

If it can really trigger a NULL pointer access in the kernel, that would definitely be a major bug, yes. That should not be possible. Since it is the unverified SMP config of the kernel, there is no proof that this doesn't happen and we should definitely investigate.

from sel4.

Ivan-Velickovic avatar Ivan-Velickovic commented on June 6, 2024

A reproducible test is here, Ivan-Velickovic/sel4test@49d1aab (tested with ../init-build.sh -DPLATFORM=odroidc4 -DSMP=1 -DARM_HYP=1).

I believe Jorge's claim is correct.

from sel4.

JorgeMVP avatar JorgeMVP commented on June 6, 2024

@andybui01 also helped to find this one, so we can assign it to him, he can fix it I believe :)

from sel4.

lsf37 avatar lsf37 commented on June 6, 2024

Fix should be up here now: #1200. Will wait to confirm that the test now passes.

from sel4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.