lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230725141602.7759-1-l3b2w1@gmail.com>
Date:   Tue, 25 Jul 2023 22:16:02 +0800
From:   Binglei Wang <l3b2w1@...il.com>
To:     hch@....de
Cc:     m.szyprowski@...sung.com, robin.murphy@....com,
        iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
        l3b2w1@...il.com
Subject: [PATCH v2] cma: check for memory region overlapping

From: l3b2w1 <l3b2w1@...il.com>

Add a overlapping check in the program flow of paring dts.
Check if cma area overlaps with memblock-reserved areas
(kenrel code area for example)before calling 
early_init_fdt_scan_reserved_mem.

Signed-off-by: l3b2w1 <l3b2w1@...il.com>
---

Notes:
    v2: delete the logic code for handling return EBUSY.
    
    v1: return EBUSY when detect overlapping and handle the return case.

 kernel/dma/contiguous.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
index 6ea80ae42..20ebbcefd 100644
--- a/kernel/dma/contiguous.c
+++ b/kernel/dma/contiguous.c
@@ -410,6 +410,11 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem)
 		return -EBUSY;
 	}
 
+	if (memblock_is_region_reserved(rmem->base, rmem->size)) {
+		pr_info("Reserved memory: overlap with other memblock reserved region\n",
+		return -EBUSY;
+	}
+
 	if (!of_get_flat_dt_prop(node, "reusable", NULL) ||
 	    of_get_flat_dt_prop(node, "no-map", NULL))
 		return -EINVAL;
-- 
2.39.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ