d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe# This file and its contents are supplied under the terms of the
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe# Common Development and Distribution License ("CDDL"), version 1.0.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe# You may only use this file in accordance with the terms of version
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe# 1.0 of the CDDL.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe# A full copy of the text of the CDDL should have accompanied this
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe# source. A copy of the CDDL is also available via the Internet at
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe# Copyright 2015, Richard Lowe.
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe/usr/bin/psecflags -s none $$ # Clear ourselves out
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowediff -u expected output || exit 1 # Make sure the setting of 'none' worked
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe## Tests of manipulating a running process (ourselves)
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe I: aslr,noexecstack
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe I: noexecstack
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe /usr/bin/psecflags $$ | grep -q 'I:.*,.*,' || exit 1 # This is lame, but functional
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe /usr/bin/psecflags -s aslr -e sleep 10000 &
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe /usr/bin/psecflags $pid | grep '[IE]:' > output
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe /usr/bin/psecflags -s current,noexecstack -e sleep 10000 &
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe E: aslr,noexecstack
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe I: aslr,noexecstack
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe /usr/bin/psecflags $pid | grep '[IE]:' > output
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe /usr/bin/psecflags -s current,-aslr -e sleep 10000 &
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe /usr/bin/psecflags $pid | grep '[IE]:' > output
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe /usr/bin/psecflags -s all -e sleep 10000 &
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe /usr/bin/psecflags $pid | grep -q 'E:.*,.*,' # This is lame, but functional
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe /usr/bin/psecflags -s none -e sleep 10000 &
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe /usr/bin/psecflags $pid | grep '[IE]:' > output
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Loweforbidnullmap