PluginVC::process_write_side reads the peer's read VIO before locking it
Les mainteneurs répondent en général sous 2 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 52/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- cpp
- Domaine
- backend, networking
Piste de recherche
Read src/proxy/PluginVC.cc, especially process_write_side() around lines 517–590 and the VIO setup in do_io_read() around lines 266–273. Check how the peer read VIO mutex protects op, closed, shutdown, nbytes, and ndone, then verify the transfer size is calculated under that lock. Done means the peer state is rechecked after locking and the read completion behavior remains correct.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
PluginVC::process_write_side() moves data from this side's write VIO into the other side's read VIO. The other side's read VIO is owned by a different continuation, so its fields are protected by that VIO's mutex, which the function try-locks at PluginVC.cc#L542. Before taking that lock, it already reads the peer's VIO state:
other_side->read_state.vio.op(PluginVC.cc#L517)other_side->read_state.vio.ntodo(), i.e.nbytesandndone(PluginVC.cc#L532). The result capsact_onand is reused after the lock is taken.
Those fields are written by the peer's consumer under its own mutex, not the PluginVC core mutex: do_io_read() sets them (PluginVC.cc#L266-L273), and the consumer may change nbytes at any time. The comments there say op is "set last" so that process_*_side can read it as an activity flag. That ordering is not guaranteed for plain fields, so the unlocked reads are data races when the peer's consumer runs on another thread, such as an intercept or TSHttpConnect plugin. In that case, an nbytes lowered concurrently by the peer can be overrun, because the transfer size was computed from the pre-lock value. The peer then ends up with ndone > nbytes and never gets VC_EVENT_READ_COMPLETE from the ntodo() == 0 check at PluginVC.cc#L590.
process_read_side() doesn't have this problem: it takes the peer write VIO lock and then calls other_side->process_write_side(), which re-reads everything.
Suggested fix: after the try-lock succeeds, re-check op/closed/shutdown and compute other_ntodo. Only the mutex pointer itself has to be read before locking.
generated with Claude Opus 5.5 by Josiah VanderZee
- Langage dominant
- C++
- Étoiles
- 2k
- Forks
- 903
- Merge moyen
- 4 j 4 h
- PR mergées (30 j)
- 135
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/trafficserver
-
UnixNetVConnection::do_io_write with a null reader leaves the previous reader in the write VIOPeut-être pris @NginxL l’a pris aujourd’hui. OuverteBug Good First Issue IOBuffer Network
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/trafficserver#14220 ·
Les mainteneurs répondent en général sous 2 jours
-
MallocAllocator does not check for allocation failurePeut-être pris @umrndem l’a pris aujourd’hui. OuverteBug Core Good First Issue
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/trafficserver#14218 · 2 commentaires ·
Les mainteneurs répondent en général sous 2 jours
-
THREAD_ALLOC dereferences a null thread while THREAD_FREE falls back to the global allocatorOuverteBug Event System Threads
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/trafficserver#14217 ·
Les mainteneurs répondent en général sous 2 jours
-
TSContScheduleEveryOnPool and TSContScheduleEveryOnThread accept a zero or negative periodPeut-être pris @rajeetvk l’a pris il y a 1 jour. OuverteBug Event System Good First Issue TS API
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
apache/trafficserver#14214 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours
-
HostDBContinuation::init memsets a polymorphic ActionPeut-être pris @ANMOLSCRIPT l’a pris aujourd’hui. OuverteBug Good First Issue HostDB
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
apache/trafficserver#14204 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de apache/trafficserver
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
Les mainteneurs répondent en général sous 2 jours
-
bug data-types
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
ClickHouse/clickhouse-cpp#645 ·
Les mainteneurs répondent en général sous 1 jour
-
bug compatibility difficulty:easy prio:normal
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
NatronGitHub/openfx-misc#524 ·
Les mainteneurs répondent en général sous 1 jour
-
[内容提案] 现在C++模块的CMake支持有更新,需要进行同步Ouvertedocumentation enhancement help wanted P0
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#359 ·
Les mainteneurs répondent en général sous 1 jour
-
Type: Bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
openscad/openscad#7360 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour