Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F158263782
D4964.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D4964.diff
View Options
Index: sys/libkern/explicit_bzero.c
===================================================================
--- sys/libkern/explicit_bzero.c
+++ sys/libkern/explicit_bzero.c
@@ -1,28 +1,42 @@
-/* $OpenBSD: explicit_bzero.c,v 1.3 2014/06/21 02:34:26 matthew Exp $ */
-/*
- * Public domain.
- * Written by Matthew Dempsky.
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (C) 2018 Rubicon Communications, LLC (Netgate) All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
*/
-
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#ifdef _KERNEL
#include <sys/libkern.h>
#else
#include <string.h>
#endif /* _KERNEL */
-__attribute__((weak)) void __explicit_bzero_hook(void *, size_t);
-
-__attribute__((weak)) void
-__explicit_bzero_hook(void *buf, size_t len)
-{
-}
-
void
explicit_bzero(void *buf, size_t len)
{
memset(buf, 0, len);
- __explicit_bzero_hook(buf, len);
+ __asm__ __volatile__("" ::"r"(buf): "memory");
}
+
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 31, 1:18 PM (14 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33651757
Default Alt Text
D4964.diff (2 KB)
Attached To
Mode
D4964: Protect calls to explicit_bzero() via by explicitly disabling the link-time and other optimizations that can cause code elimination.
Attached
Detach File
Event Timeline
Log In to Comment