mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 07:00:48 +00:00
f87cbd0565
- Disable CONFIG_HARDENED_USERCOPY_PAGESPAN - DMA: remove CMA code when not buiding CMA -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEEpcP2jyKd1g9yPm4TiXL039xtwCYFAmJF8n0WHGtlZXNjb29r QGNocm9taXVtLm9yZwAKCRCJcvTf3G3AJtdND/9Ppip+WsqdPi7NfTpMoJTMshMc nFTkmC9jAdvXomXjV0ogXNNJASvWRRKfw+I3dsMJd0qedJG1Cw62qRDIXMBB6VZU A46wG3KVSy6LVTVfNZTb74gUucdoRstAhHzY3NssAD7cuQWi+/A96NV9nII83Ft8 ew1zz1evRUdfrTXZvP4NfzVmJsJ0BfuvSf+7f4jy1rDN/COvAIqB4Oyjv4ehWstX jk3DEDQlr13wtbBX5BO/OihbB1Le/v+EpKnthofF+7myv7u6OqSeYq7RGh0n1hEz Q1BSY54WoW3sHY4sjX5j1uVOwW3d0JDfhd8J8ruf79WPnSfoPmP2d1WtUAmkKQgT dbDFDMbsfzZQ/AAK9Eh9FyQIr46jPqZUZYvFNReJLFOebqb4/34e4Z1sovlrOxQF o4mUGMmzpwvjl96QbQb5wcZ8tno67VQ/Wu0fw6m45mbCyN+Pzyos0IAOnbP4nbnx 8jWheAU92mqAn/rWlq39ORTVH3HGh1MZJTNovf/7Cdu5MkjJEUst0sWUaT1I9ngw EgfQPWoeQ8qNsNPdM+ah3p8JXWZcJUjKQB1vuz1ps9XEBcjP12vaVHa1rqkU2VnJ +IK+wZzbbFFrMzCiW82HrtXhNEN6OROlxy8cENg3GVDAmhN0ocVPaBPeVGQjm6MD B6UEb7wpz7GMweP4MQ== =VR9d -----END PGP SIGNATURE----- Merge tag 'hardening-v5.18-rc1-fix1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux Pull hardening updates from Kees Cook: "This addresses an -Warray-bounds warning found under a few ARM defconfigs, and disables long-broken HARDENED_USERCOPY_PAGESPAN" * tag 'hardening-v5.18-rc1-fix1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: ARM/dma-mapping: Remove CMA code when not built with CMA usercopy: Disable CONFIG_HARDENED_USERCOPY_PAGESPAN
60 lines
2.0 KiB
C
60 lines
2.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __CMA_H__
|
|
#define __CMA_H__
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/types.h>
|
|
#include <linux/numa.h>
|
|
|
|
/*
|
|
* There is always at least global CMA area and a few optional
|
|
* areas configured in kernel .config.
|
|
*/
|
|
#ifdef CONFIG_CMA_AREAS
|
|
#define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS)
|
|
#endif
|
|
|
|
#define CMA_MAX_NAME 64
|
|
|
|
/*
|
|
* TODO: once the buddy -- especially pageblock merging and alloc_contig_range()
|
|
* -- can deal with only some pageblocks of a higher-order page being
|
|
* MIGRATE_CMA, we can use pageblock_nr_pages.
|
|
*/
|
|
#define CMA_MIN_ALIGNMENT_PAGES MAX_ORDER_NR_PAGES
|
|
#define CMA_MIN_ALIGNMENT_BYTES (PAGE_SIZE * CMA_MIN_ALIGNMENT_PAGES)
|
|
|
|
struct cma;
|
|
|
|
extern unsigned long totalcma_pages;
|
|
extern phys_addr_t cma_get_base(const struct cma *cma);
|
|
extern unsigned long cma_get_size(const struct cma *cma);
|
|
extern const char *cma_get_name(const struct cma *cma);
|
|
|
|
extern int __init cma_declare_contiguous_nid(phys_addr_t base,
|
|
phys_addr_t size, phys_addr_t limit,
|
|
phys_addr_t alignment, unsigned int order_per_bit,
|
|
bool fixed, const char *name, struct cma **res_cma,
|
|
int nid);
|
|
static inline int __init cma_declare_contiguous(phys_addr_t base,
|
|
phys_addr_t size, phys_addr_t limit,
|
|
phys_addr_t alignment, unsigned int order_per_bit,
|
|
bool fixed, const char *name, struct cma **res_cma)
|
|
{
|
|
return cma_declare_contiguous_nid(base, size, limit, alignment,
|
|
order_per_bit, fixed, name, res_cma, NUMA_NO_NODE);
|
|
}
|
|
extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,
|
|
unsigned int order_per_bit,
|
|
const char *name,
|
|
struct cma **res_cma);
|
|
extern struct page *cma_alloc(struct cma *cma, unsigned long count, unsigned int align,
|
|
bool no_warn);
|
|
extern bool cma_pages_valid(struct cma *cma, const struct page *pages, unsigned long count);
|
|
extern bool cma_release(struct cma *cma, const struct page *pages, unsigned long count);
|
|
|
|
extern int cma_for_each_area(int (*it)(struct cma *cma, void *data), void *data);
|
|
|
|
extern void cma_reserve_pages_on_error(struct cma *cma);
|
|
#endif
|