util.c (fc1878ec70ede56ee48f2d65525d4f7c6888b496) util.c (3033cd4307681c60db6d08f398a64484b36e0b0f)
1// SPDX-License-Identifier: GPL-2.0-only
2#include <linux/mm.h>
3#include <linux/slab.h>
4#include <linux/string.h>
5#include <linux/compiler.h>
6#include <linux/export.h>
7#include <linux/err.h>
8#include <linux/sched.h>

--- 382 unchanged lines hidden (view full) ---

391 return rnd << PAGE_SHIFT;
392}
393
394static int mmap_is_legacy(struct rlimit *rlim_stack)
395{
396 if (current->personality & ADDR_COMPAT_LAYOUT)
397 return 1;
398
1// SPDX-License-Identifier: GPL-2.0-only
2#include <linux/mm.h>
3#include <linux/slab.h>
4#include <linux/string.h>
5#include <linux/compiler.h>
6#include <linux/export.h>
7#include <linux/err.h>
8#include <linux/sched.h>

--- 382 unchanged lines hidden (view full) ---

391 return rnd << PAGE_SHIFT;
392}
393
394static int mmap_is_legacy(struct rlimit *rlim_stack)
395{
396 if (current->personality & ADDR_COMPAT_LAYOUT)
397 return 1;
398
399 if (rlim_stack->rlim_cur == RLIM_INFINITY)
399 /* On parisc the stack always grows up - so a unlimited stack should
400 * not be an indicator to use the legacy memory layout. */
401 if (rlim_stack->rlim_cur == RLIM_INFINITY &&
402 !IS_ENABLED(CONFIG_STACK_GROWSUP))
400 return 1;
401
402 return sysctl_legacy_va_layout;
403}
404
405/*
406 * Leave enough space between the mmap area and the stack to honour ulimit in
407 * the face of randomisation.

--- 321 unchanged lines hidden (view full) ---

729 * @size: element size.
730 */
731void *vcalloc(size_t n, size_t size)
732{
733 return __vmalloc_array(n, size, GFP_KERNEL | __GFP_ZERO);
734}
735EXPORT_SYMBOL(vcalloc);
736
403 return 1;
404
405 return sysctl_legacy_va_layout;
406}
407
408/*
409 * Leave enough space between the mmap area and the stack to honour ulimit in
410 * the face of randomisation.

--- 321 unchanged lines hidden (view full) ---

732 * @size: element size.
733 */
734void *vcalloc(size_t n, size_t size)
735{
736 return __vmalloc_array(n, size, GFP_KERNEL | __GFP_ZERO);
737}
738EXPORT_SYMBOL(vcalloc);
739
740/* Neutral page->mapping pointer to address_space or anon_vma or other */
741void *page_rmapping(struct page *page)
742{
743 return folio_raw_mapping(page_folio(page));
744}
745
737struct anon_vma *folio_anon_vma(struct folio *folio)
738{
739 unsigned long mapping = (unsigned long)folio->mapping;
740
741 if ((mapping & PAGE_MAPPING_FLAGS) != PAGE_MAPPING_ANON)
742 return NULL;
743 return (void *)(mapping - PAGE_MAPPING_ANON);
744}

--- 387 unchanged lines hidden ---
746struct anon_vma *folio_anon_vma(struct folio *folio)
747{
748 unsigned long mapping = (unsigned long)folio->mapping;
749
750 if ((mapping & PAGE_MAPPING_FLAGS) != PAGE_MAPPING_ANON)
751 return NULL;
752 return (void *)(mapping - PAGE_MAPPING_ANON);
753}

--- 387 unchanged lines hidden ---