What's the matter?
A (1). What’s wrong? A (2). What’s the matter?
B. The internet doesn’t work.
In A (1), ‘what’ is beyond doubt a subject. But in A (2), Which is the subject: ‘what’ or ‘the matter’? Can it be clearly designated? Or ambivalent?
If you take 's to be a normal copular, then what is a subject-complement.
e.g.
What is a car?
What is your name?
Both a car and your name are subjects, similarly to how subject-auxiliary inversion works.
However I would argue that such analysis is incorrect, as "what's the matter?" has become idiomatic and simply means "what's wrong?". So you can, in fact, argue that the matter in that instance can be seen as adjectival.
This is because you can say:
What is [the matter/wrong] is that the house is on fire.
But not
*What is a car is a fridge on wheels.
And thus what is a subject again.