@@ -2146,13 +2146,10 @@ module Make<
21462146 }
21472147
21482148 /**
2149- * Holds if the guard `g` validates the expression `e` upon evaluating to `val`.
2150- *
2151- * The expression `e` is expected to be a syntactic part of the guard `g`.
2152- * For example, the guard `g` might be a call `isSafe(x)` and the expression `e`
2153- * the argument `x`.
2149+ * Holds if the guard `g` validates the SSA definition `def` upon
2150+ * evaluating to `val`.
21542151 */
2155- signature predicate guardChecksSig ( DfInput:: Guard g , DfInput :: Expr e , DfInput:: GuardValue val ) ;
2152+ signature predicate guardChecksSig ( DfInput:: Guard g , Definition def , DfInput:: GuardValue val ) ;
21562153
21572154 pragma [ nomagic]
21582155 private Definition getAPhiInputDef ( SsaInputNodeImpl n ) {
@@ -2166,80 +2163,47 @@ module Make<
21662163 signature class StateSig ;
21672164
21682165 private module WithState< StateSig State> {
2169- /**
2170- * Holds if the guard `g` validates the expression `e` upon evaluating to `val`, blocking
2171- * flow in the given `state`.
2172- *
2173- * The expression `e` is expected to be a syntactic part of the guard `g`.
2174- * For example, the guard `g` might be a call `isSafe(x)` and the expression `e`
2175- * the argument `x`.
2176- */
2177- signature predicate guardChecksSig (
2178- DfInput:: Guard g , DfInput:: Expr e , DfInput:: GuardValue val , State state
2179- ) ;
2180-
21812166 /**
21822167 * Holds if the guard `g` validates the SSA definition `def` upon
21832168 * evaluating to `val`, blocking flow in the given `state`.
21842169 */
2185- signature predicate guardChecksDefSig (
2170+ signature predicate guardChecksSig (
21862171 DfInput:: Guard g , Definition def , DfInput:: GuardValue val , State state
21872172 ) ;
21882173 }
21892174
21902175 /**
2191- * Provides a set of barrier nodes for a guard that validates an expression .
2176+ * Provides a set of barrier nodes for a guard that validates an SSA definition .
21922177 *
21932178 * This is expected to be used in `isBarrier`/`isSanitizer` definitions
21942179 * in data flow and taint tracking.
21952180 */
2196- module BarrierGuard < guardChecksSig / 3 guardChecks> {
2181+ module SsaBarrierGuard < guardChecksSig / 3 guardChecks> {
21972182 private predicate guardChecksWithState (
2198- DfInput:: Guard g , DfInput :: Expr e , DfInput:: GuardValue val , Unit state
2183+ DfInput:: Guard g , Definition def , DfInput:: GuardValue val , Unit state
21992184 ) {
2200- guardChecks ( g , e , val ) and exists ( state )
2185+ guardChecks ( g , def , val ) and exists ( state )
22012186 }
22022187
2203- private module StatefulBarrier = BarrierGuardWithState < Unit , guardChecksWithState / 4 > ;
2188+ private module StatefulBarrier = SsaBarrierGuardWithState < Unit , guardChecksWithState / 4 > ;
22042189
22052190 /** Gets a node that is safely guarded by the given guard check. */
22062191 pragma [ nomagic]
22072192 Node getABarrierNode ( ) { result = StatefulBarrier:: getABarrierNode ( _) }
22082193 }
22092194
22102195 /**
2211- * Provides a set of barrier nodes for a guard that validates an expression.
2212- *
2213- * This is expected to be used in `isBarrier`/`isSanitizer` definitions
2214- * in data flow and taint tracking.
2215- */
2216- module BarrierGuardWithState< StateSig State, WithState< State > :: guardChecksSig / 4 guardChecks> {
2217- pragma [ nomagic]
2218- private predicate guardChecksSsaDef (
2219- DfInput:: Guard g , Definition def , DfInput:: GuardValue val , State state
2220- ) {
2221- guardChecks ( g , getARead ( def ) , val , state )
2222- }
2223-
2224- private module Barrier = BarrierGuardDefWithState< State , guardChecksSsaDef / 4 > ;
2225-
2226- predicate getABarrierNode = Barrier:: getABarrierNode / 1 ;
2227- }
2228-
2229- /**
2230- * Provides a set of barrier nodes for a guard that validates an expression.
2196+ * Provides a set of barrier nodes for a guard that validates an SSA definition.
22312197 *
22322198 * This is expected to be used in `isBarrier`/`isSanitizer` definitions
22332199 * in data flow and taint tracking.
22342200 */
2235- module BarrierGuardDefWithState<
2236- StateSig State, WithState< State > :: guardChecksDefSig / 4 guardChecksSsaDef>
2237- {
2201+ module SsaBarrierGuardWithState< StateSig State, WithState< State > :: guardChecksSig / 4 guardChecks> {
22382202 /** Gets a node that is safely guarded by the given guard check. */
22392203 pragma [ nomagic]
22402204 Node getABarrierNode ( State state ) {
22412205 exists ( DfInput:: Guard g , DfInput:: GuardValue val , Definition def , BasicBlock bb |
2242- guardChecksSsaDef ( g , def , val , state )
2206+ guardChecks ( g , def , val , state )
22432207 |
22442208 // guard controls a read
22452209 exists ( DfInput:: Expr e |
0 commit comments