#!/bin/sh
# DF-0243 setup2: #!/bin/sh script that checks the sentinel env var survived.
set -e
cat > /tmp/df0243_s2 <<'EOF'
#!/bin/sh
# After a correct exec_shell_imgact, our argv must be ["/bin/sh", "/tmp/df0243_s2"]
# and the DF0243_SENTINEL env var must be intact. If the bcopy at imgact_shell.c
# corrupted the env block (OOB shift), this check fails or the kernel panicked.
if [ "$DF0243_SENTINEL" = "CANARY-7B3F" ]; then
    echo "DF0243_ENV_OK argv=$# sentinel_intact"
else
    echo "DF0243_ENV_BROKEN sentinel_missing_or_corrupt"
fi
EOF
chmod +x /tmp/df0243_s2
echo "setup2: created /tmp/df0243_s2"
ls -l /tmp/df0243_s2
