-
Notifications
You must be signed in to change notification settings - Fork 78
78 lines (64 loc) · 2.38 KB
/
stack_size.yml
File metadata and controls
78 lines (64 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Check Update Default Stack Size
on:
push:
pull_request:
workflow_dispatch:
jobs:
stack_size:
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04, ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # 6.0.0
- name: Download Monero
uses: ./.github/actions/monero
- name: Verify expected behavior
shell: bash
run: |
cp /usr/bin/monerod monerod
STACK=$((8 * 1024 * 1024))
cp monerod monerod-chelf
git clone https://github.com/Gottox/chelf
cd chelf
git checkout b2994186cea7b7d61a588fd06c1cc1ae75bcc21a
make
./chelf -s $STACK ../monerod-chelf
cd ..
cp monerod monerod-muslstack
GOBIN=$(pwd) go install github.com/yaegashi/muslstack@d19cc5866abce3ca59dfc1666df7cc97097d0933
./muslstack -s $STACK ./monerod-muslstack
sudo apt install bash dash zsh busybox
alias ash="busybox ash"
for shell in sh bash dash zsh ash; do
cp monerod monerod-idss-$shell
$shell ./orchestration/increase_default_stack_size.sh monerod-idss-$shell
done
find . -iname "monerod-*" | while read -r bin; do
readelf $bin -l
sha256sum $bin
done
find . -iname "monerod-*" | while read -r bin; do
if [ ! $(sha256sum monerod-chelf | cut -d' ' -f1) = $(sha256sum $bin | cut -d' ' -f1) ]; then
exit 1
fi
done
read_stack() {
printf "%i" $((readelf $1 -l | grep STACK -A1 | tail -n1 | sed -E s/^[[:space:]]*//g | cut -f2 -d' '))
}
INITIAL_STACK=$(read_stack monerod)
if [ "$INITIAL_STACK" -ne "0" ]; then
echo "Initial \`PT_GNU_STACK\` wasn't 0"
exit 2
fi
UPDATED_STACK=$(read_stack monerod-chelf)
if [ "$UPDATED_STACK" -ne "$STACK" ]; then
echo "Updated \`PT_GNU_STACK\` wasn't 8 MB"
exit 3
fi
# Only one byte should be different due to the bit pattern of 8 MB
BYTES_DIFFERENT=$(cmp -l monerod monerod-chelf | wc -l)
if [ "$BYTES_DIFFERENT" -ne 1 ]; then
echo "More than one byte was different between the two binaries"
exit 4
fi