[LTP] [PATCH] security/dirtyc0w: Get and set umask in setup
Xiao Yang
ice_yangxiao@163.com
Sat Mar 28 12:22:09 CET 2020
On 3/28/20 2:56 PM, Zou Wei wrote:
> The case is only successful when system default umask is 0022.
> When umask is 0077, should change the value to 0022 in setup.
>
> Signed-off-by: Zou Wei <zou_wei@huawei.com>
> ---
> testcases/kernel/security/dirtyc0w/dirtyc0w.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/testcases/kernel/security/dirtyc0w/dirtyc0w.c b/testcases/kernel/security/dirtyc0w/dirtyc0w.c
> index a0a81b6..7abb5a2 100644
> --- a/testcases/kernel/security/dirtyc0w/dirtyc0w.c
> +++ b/testcases/kernel/security/dirtyc0w/dirtyc0w.c
> @@ -45,6 +45,10 @@ static void setup(void)
> {
> struct passwd *pw;
>
> + if ((umask(0))==63){
> + umask(18);
> + }
> +
Hi Zou,
just clear current umask by umask(0) here if you want to exclude the
impact of umask.
btw: it is readable to use otcal number(e.g. umask(0022) == 0022)
Thanks,
Xiao Yang
> pw = SAFE_GETPWNAM("nobody");
>
> nobody_uid = pw->pw_uid;
> --
> 2.6.2
>
>
More information about the ltp
mailing list