Skip to content

Commit 87d5305

Browse files
committed
Go: Ad-hoc patch the shared libs.
1 parent 406f5b5 commit 87d5305

File tree

4 files changed

+58
-20
lines changed

4 files changed

+58
-20
lines changed

go/ql/lib/semmle/go/dataflow/internal/DataFlowImpl.qll

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,12 @@ abstract class Configuration extends string {
7373
/** Holds if data flow out of `node` is prohibited. */
7474
predicate isBarrierOut(Node node) { none() }
7575

76-
/** Holds if data flow through nodes guarded by `guard` is prohibited. */
77-
predicate isBarrierGuard(BarrierGuard guard) { none() }
76+
/**
77+
* DEPRECATED: Use `isBarrier` and `BarrierGuard` module instead.
78+
*
79+
* Holds if data flow through nodes guarded by `guard` is prohibited.
80+
*/
81+
deprecated predicate isBarrierGuard(BarrierGuard guard) { none() }
7882

7983
/**
8084
* Holds if the additional flow step from `node1` to `node2` must be taken
@@ -289,6 +293,20 @@ private predicate outBarrier(NodeEx node, Configuration config) {
289293
)
290294
}
291295

296+
/** A bridge class to access the deprecated `isBarrierGuard`. */
297+
private class BarrierGuardGuardedNodeBridge extends Unit {
298+
abstract predicate guardedNode(Node n, Configuration config);
299+
}
300+
301+
private class BarrierGuardGuardedNode extends BarrierGuardGuardedNodeBridge {
302+
deprecated override predicate guardedNode(Node n, Configuration config) {
303+
exists(BarrierGuard g |
304+
config.isBarrierGuard(g) and
305+
n = g.getAGuardedNode()
306+
)
307+
}
308+
}
309+
292310
pragma[nomagic]
293311
private predicate fullBarrier(NodeEx node, Configuration config) {
294312
exists(Node n | node.asNode() = n |
@@ -300,10 +318,7 @@ private predicate fullBarrier(NodeEx node, Configuration config) {
300318
config.isBarrierOut(n) and
301319
not config.isSink(n)
302320
or
303-
exists(BarrierGuard g |
304-
config.isBarrierGuard(g) and
305-
n = g.getAGuardedNode()
306-
)
321+
any(BarrierGuardGuardedNodeBridge b).guardedNode(n, config)
307322
)
308323
}
309324

go/ql/lib/semmle/go/dataflow/internal/DataFlowImpl2.qll

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,12 @@ abstract class Configuration extends string {
7373
/** Holds if data flow out of `node` is prohibited. */
7474
predicate isBarrierOut(Node node) { none() }
7575

76-
/** Holds if data flow through nodes guarded by `guard` is prohibited. */
77-
predicate isBarrierGuard(BarrierGuard guard) { none() }
76+
/**
77+
* DEPRECATED: Use `isBarrier` and `BarrierGuard` module instead.
78+
*
79+
* Holds if data flow through nodes guarded by `guard` is prohibited.
80+
*/
81+
deprecated predicate isBarrierGuard(BarrierGuard guard) { none() }
7882

7983
/**
8084
* Holds if the additional flow step from `node1` to `node2` must be taken
@@ -289,6 +293,20 @@ private predicate outBarrier(NodeEx node, Configuration config) {
289293
)
290294
}
291295

296+
/** A bridge class to access the deprecated `isBarrierGuard`. */
297+
private class BarrierGuardGuardedNodeBridge extends Unit {
298+
abstract predicate guardedNode(Node n, Configuration config);
299+
}
300+
301+
private class BarrierGuardGuardedNode extends BarrierGuardGuardedNodeBridge {
302+
deprecated override predicate guardedNode(Node n, Configuration config) {
303+
exists(BarrierGuard g |
304+
config.isBarrierGuard(g) and
305+
n = g.getAGuardedNode()
306+
)
307+
}
308+
}
309+
292310
pragma[nomagic]
293311
private predicate fullBarrier(NodeEx node, Configuration config) {
294312
exists(Node n | node.asNode() = n |
@@ -300,10 +318,7 @@ private predicate fullBarrier(NodeEx node, Configuration config) {
300318
config.isBarrierOut(n) and
301319
not config.isSink(n)
302320
or
303-
exists(BarrierGuard g |
304-
config.isBarrierGuard(g) and
305-
n = g.getAGuardedNode()
306-
)
321+
any(BarrierGuardGuardedNodeBridge b).guardedNode(n, config)
307322
)
308323
}
309324

go/ql/lib/semmle/go/dataflow/internal/tainttracking1/TaintTrackingImpl.qll

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,15 @@ abstract class Configuration extends DataFlow::Configuration {
8989

9090
final override predicate isBarrierOut(DataFlow::Node node) { this.isSanitizerOut(node) }
9191

92-
/** Holds if taint propagation through nodes guarded by `guard` is prohibited. */
93-
predicate isSanitizerGuard(DataFlow::BarrierGuard guard) { none() }
92+
/**
93+
* DEPRECATED: Use `isSanitizer` and `BarrierGuard` module instead.
94+
*
95+
* Holds if taint propagation through nodes guarded by `guard` is prohibited.
96+
*/
97+
deprecated predicate isSanitizerGuard(DataFlow::BarrierGuard guard) { none() }
9498

95-
final override predicate isBarrierGuard(DataFlow::BarrierGuard guard) {
96-
this.isSanitizerGuard(guard) or defaultTaintSanitizerGuard(guard)
99+
deprecated final override predicate isBarrierGuard(DataFlow::BarrierGuard guard) {
100+
this.isSanitizerGuard(guard)
97101
}
98102

99103
/**

go/ql/lib/semmle/go/dataflow/internal/tainttracking2/TaintTrackingImpl.qll

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,15 @@ abstract class Configuration extends DataFlow::Configuration {
8989

9090
final override predicate isBarrierOut(DataFlow::Node node) { this.isSanitizerOut(node) }
9191

92-
/** Holds if taint propagation through nodes guarded by `guard` is prohibited. */
93-
predicate isSanitizerGuard(DataFlow::BarrierGuard guard) { none() }
92+
/**
93+
* DEPRECATED: Use `isSanitizer` and `BarrierGuard` module instead.
94+
*
95+
* Holds if taint propagation through nodes guarded by `guard` is prohibited.
96+
*/
97+
deprecated predicate isSanitizerGuard(DataFlow::BarrierGuard guard) { none() }
9498

95-
final override predicate isBarrierGuard(DataFlow::BarrierGuard guard) {
96-
this.isSanitizerGuard(guard) or defaultTaintSanitizerGuard(guard)
99+
deprecated final override predicate isBarrierGuard(DataFlow::BarrierGuard guard) {
100+
this.isSanitizerGuard(guard)
97101
}
98102

99103
/**

0 commit comments

Comments
 (0)