[LTP] [PATCH v6] hugemmap37: Migrate truncate_sigbus_versus_oom from libhugetlbfs
Andrea Cervesato
andrea.cervesato@suse.com
Wed May 6 14:11:46 CEST 2026
Hi Samir,
> +/*
> + * Copyright (C) 2005-2006 David Gibson & Adam Litke, IBM Corporation.
> + */
New file; please add a 2026 copyright line for yourself as the migration
author.
> + p = SAFE_MMAP(NULL, hpage_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
> + SAFE_FTRUNCATE(fd, 0);
> +
> + fdx = tst_creat_unlinked(MNTPOINT, 0, 0600);
> + totpages = SAFE_READ_MEMINFO(MEMINFO_HPAGE_FREE);
> + q = SAFE_MMAP(NULL, totpages * hpage_size, PROT_READ | PROT_WRITE, MAP_SHARED,
> + fdx, 0);
If the second SAFE_MMAP (or anything between the two) aborts, p is still
mapped but cleanup() only handles fds. Move p and q to file scope and add
SAFE_MUNMAP guards in cleanup().
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
More information about the ltp
mailing list