Skip to content

Commit 7b1a79f

Browse files
authored
Merge pull request #1132 from milroy/match-overflow
Fix overflow in `calc_factor`
2 parents f5f99c5 + 6cff96e commit 7b1a79f

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed

resource/policies/dfu_match_multilevel_id_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ int64_t multilevel_id_t<FOLD>::score_factor_t::calc_factor (
5555
return -1;
5656
}
5757
mul = add * m_multiply_by;
58-
tie = break_tie % m_multiply_by - 1;
58+
tie = abs (break_tie % static_cast<int64_t> (m_multiply_by) - 1);
5959

6060
if (mul > (std::numeric_limits<int64_t>::max () - tie)) {
6161
errno = EOVERFLOW;

t/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ set(ALL_TESTS
8080
t4011-match-duration.t
8181
t4012-set-status.t
8282
t5000-valgrind.t
83+
t5100-issues-test-driver.t
8384
t6000-graph-size.t
8485
t6001-match-formats.t
8586
t6002-graph-hwloc.t

t/issues/t1035-fluxion-reload.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ fi
1616
test $(flux resource list -no {nnodes}) -eq 4 || die "test requires 4 nodes"
1717

1818
log "Unloading modules..."
19-
flux module remove sched-fluxion-qmanager
20-
flux module remove sched-fluxion-resource
19+
flux module remove sched-simple
2120
flux module remove resource
2221

2322
log "Amending instance resource set with properties: batch, debug..."

t/issues/t1129-match-overflow.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
#
3+
# Ensure fluxion calc_factor executes without overflow
4+
#
5+
6+
log() { printf "issue#1129: $@\n" >&2; }
7+
8+
TEST_SIZE=${TEST_SIZE:-900}
9+
10+
log "Unloading modules..."
11+
flux module remove sched-simple
12+
flux module remove resource
13+
14+
flux config load <<EOF
15+
[sched-fluxion-qmanager]
16+
queue-policy = "easy"
17+
18+
[resource]
19+
noverify = true
20+
norestrict = true
21+
22+
[[resource.config]]
23+
hosts = "test[1-${TEST_SIZE}]"
24+
cores = "0-112"
25+
gpus = "0-8"
26+
EOF
27+
28+
flux module load resource monitor-force-up
29+
flux module load sched-fluxion-resource
30+
flux module load sched-fluxion-qmanager
31+
flux queue start --all --quiet
32+
flux resource list
33+
flux resource status
34+
35+
log "Running test job."
36+
flux run -vvv -N${TEST_SIZE} -n${TEST_SIZE} \
37+
--setattr=exec.test.run_duration=1ms \
38+
true
39+
40+
log "reloading sched-simple..."
41+
flux module remove sched-fluxion-qmanager
42+
flux module remove sched-fluxion-resource
43+
flux module load sched-simple

0 commit comments

Comments
 (0)