首页 > 其他分享 >Bad or missing usercopy whitelist? Kernel memory overwrite attempt detected to SLUB object

Bad or missing usercopy whitelist? Kernel memory overwrite attempt detected to SLUB object

时间:2024-09-29 12:46:02浏览次数:1  
标签:Kernel attempt missing kmem cache whitelist flags usercopy region

Linux内核有一个usercopy whitelist机制,只允许这里面的region来做usercopy。如果是用kmem_cache_create申请的kmem_cache申请的内存空间来copy to user或者copy from user,那么就会报这个错。这时要用kmem_cache_create_usercopy,来将申请的区域加入到usercopy whitelist中。

/**
 * kmem_cache_create_usercopy - Create a cache with a region suitable
 * for copying to userspace
 * @name: A string which is used in /proc/slabinfo to identify this cache.
 * @size: The size of objects to be created in this cache.
 * @align: The required alignment for the objects.
 * @flags: SLAB flags
 * @useroffset: Usercopy region offset
 * @usersize: Usercopy region size
 * @ctor: A constructor for the objects.
 *
 * Cannot be called within a interrupt, but can be interrupted.
 * The @ctor is run when new pages are allocated by the cache.
 *
 * The flags are
 *
 * %SLAB_POISON - Poison the slab with a known test pattern (a5a5a5a5)
 * to catch references to uninitialised memory.
 *
 * %SLAB_RED_ZONE - Insert `Red` zones around the allocated memory to check
 * for buffer overruns.
 *
 * %SLAB_HWCACHE_ALIGN - Align the objects in this cache to a hardware
 * cacheline.  This can be beneficial if you're counting cycles as closely
 * as davem.
 *
 * Return: a pointer to the cache on success, NULL on failure.
 */
struct kmem_cache *
kmem_cache_create_usercopy(const char *name,
		  unsigned int size, unsigned int align,
		  slab_flags_t flags,
		  unsigned int useroffset, unsigned int usersize,
		  void (*ctor)(void *))

其中offset是指region相对于申请的内存的首地址的偏移量。如果整个区域都是,那么就设置为0。

标签:Kernel,attempt,missing,kmem,cache,whitelist,flags,usercopy,region
From: https://www.cnblogs.com/searchstar/p/18439466

相关文章

  • /sys/kernel/debug/binder/目录下主要节点含义
    /sys/kernel/debug/binder/目录下主要节点含义state显示binder设备的整体状态信息包括进程数量、线程数量、待处理事务数量等stats展示binder操作的统计信息如事务数量、内存使用情况等transactions列出当前正在处理的binder事务包括发送方、接收方、数据大小......
  • 加速clone linux kernel
    tunagitclonehttps://mirrors.tuna.tsinghua.edu.cn/git/linux.gitgiteegitee.com有一个码云极速下载的用户,id是mirrors。这个用户维护了很多github的仓库的镜像,其中就有linuxkernel:[email protected]:mirrors/linux.git实测可以跑满带宽。建议不要用https的方式......
  • 自动加载类文件时发生错误,类名【core\\basic\\Kernel】
    当你使用PbootCMS时遇到了自动加载类文件时发生的错误,具体错误信息如下:自动加载类文件时发生错误,类名【core\\basic\\Kernel】这个问题通常是由于Kernel.php文件丢失或被误删除导致的。特别是在阿里云虚拟主机环境下,可能会因为安全策略而删除某些文件。以下是详细的解决......
  • 【实用教程】如何使用kernelbase.dll修复工具解决常见问题?利用KernelBase.dll修复工具
    引言:在使用Windows操作系统时,有时会遇到因KernelBase.dll文件损坏或缺失而导致的系统崩溃、程序无响应等问题。KernelBase.dll是Windows核心库文件之一,负责提供许多基本的系统级功能。当这个文件出现问题时,系统的稳定性和性能会受到影响。幸运的是,通过使用KernelBase.dll修复......
  • Photoshop CS8.0启动难题:专家支招Photoshop CS8.0 kernel32.dll文件丢失的应急处理与
    PhotoshopCS8.0(注意:实际上AdobePhotoshop的命名中并没有直接称为“CS8.0”的版本,这里可能是对某个版本或假设版本的指代)启动时遇到kernel32.dll文件丢失的问题,确实是一个令人头疼的难题。针对这一问题,专家提供了以下应急处理与预防措施:应急处理使用系统文件检查器(SFC):......
  • 《勇敢小骑士》游戏闪退弹窗提示“找不到kernel.dll”文件该怎么解决?游戏启动时崩溃提
    当玩《勇敢小骑士》游戏出现闪退并弹窗提示“找不到kernel.dll”文件时,可以在网上搜索可靠的该文件资源进行下载,然后放置到合适的系统目录中。也可尝试检查游戏完整性,看能否自动修复此问题。本篇将为大家带来《勇敢小骑士》游戏闪退弹窗提示“找不到kernel.dll”文件该怎么解决......
  • Kernel Stack栈溢出攻击及保护绕过
    前言本文介绍Linux内核的栈溢出攻击,和内核一些保护的绕过手法,通过一道内核题及其变体从浅入深一步步走进kernel世界。QWB_2018_core题目分析start.shqemu-system-x86_64\-m128M\-kernel./bzImage\-initrd./core.cpio\-append"root=/dev/ramrw......
  • Kernel Stack栈溢出攻击及保护绕过
    前言本文介绍Linux内核的栈溢出攻击,和内核一些保护的绕过手法,通过一道内核题及其变体从浅入深一步步走进kernel世界。QWB_2018_core题目分析start.shqemu-system-x86_64\-m128M\-kernel./bzImage\-initrd./core.cpio\-append"root=/dev/ramrwconsol......
  • Professional Linux Kernel Architecture(一)
    基于linux内核2.6.24版本,书籍:ProfessionalLinuxKernelArchitecture英文版(可在https://github.com/welldef/os_books.git下载)1一些概念1.1微内核和单体内核微内核:只有最基本的功能直接在中央内核(微内核)中实现。所有其他功能都委托给各自独立的进程,这些进程通过通信接口与......
  • 解决React Warning: Function components cannot be given refs. Attempts to access
    问题当我使用如下方式调用组件子组件UploadModal并且绑定Ref时React报错“Warning:Functioncomponentscannotbegivenrefs.Attemptstoaccessthisrefwillfail.DidyoumeantouseReact.forwardRef()?”;constUploadModalRef=useRef(null);constopenUploadModa......