Changeset 66424 in vbox
- Timestamp:
- Apr 5, 2017 9:27:55 AM (8 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/linux/Makefile
r66415 r66424 90 90 r0drv/linux/mpnotification-r0drv-linux.o \ 91 91 r0drv/linux/process-r0drv-linux.o \ 92 r0drv/linux/rtStrFormatKernelAddress-r0drv-linux.o \ 92 93 r0drv/linux/semevent-r0drv-linux.o \ 93 94 r0drv/linux/semeventmulti-r0drv-linux.o \ … … 149 150 generic/RTSemEventMultiWaitNoResume-2-ex-generic.o \ 150 151 generic/RTTimerCreate-generic.o \ 151 generic/rtStrFormatKernelAddress-generic.o \152 152 generic/errvars-generic.o \ 153 153 generic/mppresent-generic.o \ -
trunk/src/VBox/HostDrivers/Support/linux/files_vboxdrv
r66415 r66424 153 153 ${PATH_ROOT}/src/VBox/Runtime/include/internal/thread.h=>include/internal/thread.h \ 154 154 ${PATH_ROOT}/src/VBox/Runtime/include/internal/time.h=>include/internal/time.h \ 155 ${PATH_ROOT}/src/VBox/Runtime/generic/rtStrFormatKernelAddress-generic.cpp=>generic/rtStrFormatKernelAddress-generic.c \156 155 ${PATH_ROOT}/src/VBox/Runtime/generic/RTAssertShouldPanic-generic.cpp=>generic/RTAssertShouldPanic-generic.c \ 157 156 ${PATH_ROOT}/src/VBox/Runtime/generic/RTLogWriteStdErr-stub-generic.cpp=>generic/RTLogWriteStdErr-stub-generic.c \ … … 175 174 ${PATH_ROOT}/src/VBox/Runtime/r0drv/power-r0drv.h=>r0drv/power-r0drv.h \ 176 175 ${PATH_ROOT}/src/VBox/Runtime/r0drv/powernotification-r0drv.c=>r0drv/powernotification-r0drv.c \ 176 ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/rtStrFormatKernelAddress-r0drv-linux.c=>r0drv/linux/rtStrFormatKernelAddress-r0drv-linux.c \ 177 177 ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c=>r0drv/linux/RTLogWriteDebugger-r0drv-linux.c \ 178 178 ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c=>r0drv/linux/assert-r0drv-linux.c \ -
trunk/src/VBox/Runtime/r0drv/linux/rtStrFormatKernelAddress-r0drv-linux.c
r66423 r66424 30 30 *********************************************************************************************************************************/ 31 31 #define LOG_GROUP RTLOGGROUP_STRING 32 #include <iprt/string.h> 32 #include "the-linux-kernel.h" 33 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) 34 # include <linux/capability.h> 35 # include <linux/security.h> 36 #endif 33 37 #include "internal/iprt.h" 34 38 … … 39 43 40 44 41 42 45 DECLHIDDEN(size_t) rtStrFormatKernelAddress(char *pszBuf, size_t cbBuf, RTR0INTPTR uPtr, signed int cchWidth, 43 46 signed int cchPrecision, unsigned int fFlags) 44 47 { 45 #ifndef DEBUG 46 RT_NOREF(uPtr, cchWidth, cchPrecision); 48 #if !defined(DEBUG) && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) 49 bool fRestrict = false; 50 if (kptr_restrict > 1) 51 fRestrict = true; 52 else if (kptr_restrict == 1) 53 { 54 const struct cred *cred = current_cred(); 55 if ( !has_capability_noaudit(current, CAP_SYSLOG) 56 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) 57 || !uid_eq(cred->euid, cred->uid) 58 || !gid_eq(cred->egid, cred->gid) 59 # endif 60 ) 61 fRestrict = true; 62 } 63 64 if (fRestrict) 65 { 66 RT_NOREF(uPtr, cchWidth, cchPrecision); 47 67 # if R0_ARCH_BITS == 64 48 static const char s_szObfuscated[] = "0xXXXXXXXXXXXXXXXX";68 static const char s_szObfuscated[] = "0xXXXXXXXXXXXXXXXX"; 49 69 # else 50 static const char s_szObfuscated[] = "0xXXXXXXXX";70 static const char s_szObfuscated[] = "0xXXXXXXXX"; 51 71 # endif 52 size_t cbSrc = sizeof(s_szObfuscated); 53 const char *pszSrc = s_szObfuscated; 54 if (!(fFlags & RTSTR_F_SPECIAL)) 55 { 56 pszSrc += 2; 57 cbSrc -= 2; 72 size_t cbSrc = sizeof(s_szObfuscated); 73 const char *pszSrc = s_szObfuscated; 74 if (!(fFlags & RTSTR_F_SPECIAL)) 75 { 76 pszSrc += 2; 77 cbSrc -= 2; 78 } 79 if (cbSrc <= cbBuf) 80 { 81 memcpy(pszBuf, pszSrc, cbSrc); 82 return cbSrc; 83 } 84 AssertFailed(); 85 memcpy(pszBuf, pszSrc, cbBuf); 86 pszBuf[cbBuf - 1] = '\0'; 87 return cbBuf - 1; 58 88 } 59 if (cbSrc <= cbBuf) 60 { 61 memcpy(pszBuf, pszSrc, cbSrc); 62 return cbSrc; 63 } 64 AssertFailed(); 65 memcpy(pszBuf, pszSrc, cbBuf); 66 pszBuf[cbBuf - 1] = '\0'; 67 return cbBuf - 1; 68 69 #else /* DEBUG */ 89 #endif /* DEBUG && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) */ 70 90 Assert(cbBuf >= 64); 71 91 return RTStrFormatNumber(pszBuf, uPtr, 16, cchWidth, cchPrecision, fFlags); 72 #endif /* DEBUG */73 92 } 74
Note:
See TracChangeset
for help on using the changeset viewer.