Great opportunity to think through this in a structured way. Just saying "it's situational" leaves me wanting more planning, so here goes:
My job as a buddy, is to be your buddy. To share resources if necessary, to work out problems with you if they occur, to comfort and help you enjoy our dive. As a buddy, my job does not include risking my life if you panic. I'll comfort you, share resources and even work out problems under water. But if you are hell bent on getting to the surface, I'll try to help you do the right thing, but I won't hold you down.
My job as a dive master could be a number of different things, depending on why you have me as a dive master:
If I'm escorting you on a pleasure dive, my role as your DM is to be a buddy whose responsability is to manage the dive plan and apply specific knowledge of the dive for your benefit. My approach is the same as being your buddy, except I'm responsible for the dive plan. I'll sort out problems and prevent you from panic as best I can, but I will not restrain you if you do panic. I'll make a safe ascent with any other divers and then rescue you.
If I'm helping with a class, my job is to make sure you get the most out of class safely. 'm watching, I know that you
a.) Aren't even aware that you have lost control
b.) Just realized and are surprised
c.) Big eyes and are starting to panic
d.) Are experiencing a full on panic
If you are A. B. or C. I'll take control, make you aware of what is going on and calm you down. If you are already heading to the surface because you lost control... I'll get behind you and ride your tank like a pony while I get control of your BCD. You aren't going anywhere and you are going to know that someone is there to help you.
But,
If you are D., in a full panic, and I have responsibilities to other divers. I'm back to buddy mode for you- at least until I hand off my other divers to an instructor or another DM. Then I'll make a safe ascent and rescue you.
If you are D., in a full panic and you are my only diver the instructor has the ball if the instructor is aware, if not I'll work with you to try to manage a safe ascent, but not at the expense of my safety. If you reject all help and are headed to the surface, I've probably slowed you down trying to help, and you are headed up anyway. I'll back off, let the team know that I'm making a safe ascent and a rescue and proceed to rescue you.
I think that's my plan. Any errors there dive community? If not, I'll formalize with the instructors I work with.