This question, and the evidence of the Galatians passage, was hotly contested by mediaeval theologians and canonists, especially during the Western Schism (when there were up to three simultaneous papal claimants). It certainly seems to show that dissent is possible, and that an individual Pope might not always practice what he preaches.
Beyond ordinary criticism of a particular Pope, the passage was read in the context of an ongoing debate about papal fallibility and power. A rebuke might imply the ability to censure or even remove a Pope. It was generally accepted that there was no regular authority which could judge the Pope - any such tribunal would be ipso facto superior to him if it could command his obedience. Some believed that a general council could do it in an emergency, as a special exception; the council might possess some kind of legitimacy as a representative assembly of the church, even if it was not convened by the Pope himself. The college of cardinals was another possibility, for the same reason, and because of its direct institutional association with the Holy See.
The scope of this emergency power was probably imagined as being limited to two cases:
- Manifest grave crimes (including acts destructive of the constitution of the Church, the classic hypothetical being a Pope who tried to depose all bishops in order to cut off the apostolic succession)
For the first, the point is that heretics are automatically excommunicated, and also forfeit any church office they might have held. The influential canon lawyer Huguccio of Pisa argued that cases of papal heresy should be treated differently, depending on whether the Pope has fallen into an old heresy (already anathematized by a general council, etc.) or a new one (in which case the Pope could not be automatically removed). The other case distinguishes manifest crimes from clandestine ones. Legally, the idea is that if the crime is public knowledge, then the question of a trial does not arise, obviating the need for a Pope to be judged by another authority at all. In such cases, there may be some "declaratory" action by the college of cardinals (say) which amounts to recognizing that the Pope has forfeited his office, rather than them actually ordering his removal.
Contemporary canon law does not allow a general council to be constituted except by papal authority (CIC 338 §1), and does not give any express power to anyone to declare that a Pope has forfeited the papacy. It has recently been demonstrated that a Pope can resign of his own accord. Automatic excommunication for heresy is still applicable to the Pope, according to some commentators - although this is very much a hypothetical. The argument is that although the Pope is the supreme legislator of the Church, and the final interpreter of its law - therefore potentially able to exempt himself from the juridical consequences of heresy - he only has authority to legislate or interpret according to divine law. God's law (in this interpretation) does not permit a heretic to be in charge of the Church.
The Galatians case touches the "heresy" idea. Early commentators questioned the extent to which the disagreement here might be counted as heresy, and its relation to the Petrine office. It was agreed that the Pope did not teach with his supreme authority in all circumstances, and in particular, he could have legitimate scholarly or theological disagreements without any question of heresy arising for either party. (Good news for the theologians!) This is obviously an attractive option in reading the interaction between Peter and Paul, because neither of them are doing wrong. Jerome even suggested that the disagreement might have been staged (Commentarium in Epistolam Beati Pauli ad Galatas; in Migne's Patrologia Latina vol. 26). In any case, this kind of rebuke does not necessarily amount to bringing down the full force of anathema on an errant Pope.
For the Church today, the relevant law is Canon 212 of the Code of Canon Law:
Can. 212 §1. Conscious of their own responsibility, the Christian faithful are bound to follow with Christian obedience those things which the sacred pastors, inasmuch as they represent Christ, declare as teachers of the faith or establish as rulers of the Church.
§2. The Christian faithful are free to make known to the pastors of the Church their needs, especially spiritual ones, and their desires.
§3. According to the knowledge, competence, and prestige which they possess, they have the right and even at times the duty to manifest to the sacred pastors their opinion on matters which pertain to the good of the Church and to make their opinion known to the rest of the Christian faithful, without prejudice to the integrity of faith and morals, with reverence toward their pastors, and attentive to common advantage and the dignity of persons.
This should obviously be read in combination with an understanding of what the Church teaches about its own Magisterium, including the differentiated roles of the Pope, the bishops, etc. See especially canons 747-755 on the obligation to respect the authentic doctrine that the Church expounds. But the basic tenor is that people are bound to follow the teaching of the Church and respect its discipline, but can still make their opinions known if they are doing it in an orderly way. This does not amount to license to contradict the established doctrine of the Church. Publicly denouncing the Pope on the steps of St Peter's with a megaphone - no. Polite conversation, writing scholarly articles, and so on - yes.
As Paul Clayton mentions in comments below, the Pope also has a regular confessor, who has a specific duty in the examination of his conscience. This creates a situation where he could be rebuked for sinful behaviour, though obviously in private. His advisors, especially the cardinals, could also raise concerns in a discreet way (as opposed to calling him out in public).
References and further reading
The Church, the Councils and Reform: The Legacy of the Fifteenth Century. Gerald Christianson, Thomas M. Izbicki, and Christopher M. Bellitto (eds.). Catholic University of America Press, 2008.
Fallibility instead of infallibility? A brief history of the interpretation of Galatians 2:11-14. Karlfried Froehlich. In: Teaching Authority and Infallibility of the Church, ed. Paul C. Empie, T. Austin Murphy, and Joseph A. Burgess. Augsburg Fortress, 1980.
The Bible in Medieval Tradition: The Letter to the Galatians. Ian Christopher Levy. Wm. Eerdmans, 2011.
St Paul's Epistle to the Galatians. J. B. Lightfoot. Warren F. Draper, 1870.
Foundations of the Conciliar Theory. Brian Tierney. Cambridge University Press, 1995.
Origins of Papal Infallibility 1150-1350. Brian Tierney. Brill, 1972.