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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 29 Oct 2015 09:26:06 +0100
From:	Thierry Reding <thierry.reding@...il.com>
To:	Arnd Bergmann <arnd@...db.de>,
	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Joe Perches <joe@...ches.com>, linux-arch@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] asm/sections: Add helpers to check for section data

From: Thierry Reding <treding@...dia.com>

Add a helper to check if an object (given an address and a size) is part
of a section (given beginning and end addresses). For convenience, also
provide a helper that performs this check for __init data using the
__init_begin and __init_end limits.

Signed-off-by: Thierry Reding <treding@...dia.com>
---
 include/asm-generic/sections.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index b58fd667f87b..529909090cd6 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -63,4 +63,15 @@ static inline int arch_is_kernel_data(unsigned long addr)
 }
 #endif
 
+static inline bool section_contains(void *virt, size_t size, void *begin,
+				    void *end)
+{
+	return virt >= begin && virt + size <= end;
+}
+
+static inline bool init_section_contains(void *virt, size_t size)
+{
+	return section_contains(virt, size, __init_begin, __init_end);
+}
+
 #endif /* _ASM_GENERIC_SECTIONS_H_ */
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ