1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-06 15:42:38 -05:00

Compare commits

...

21 Commits

Author SHA1 Message Date
XMRig
acca8f79cf v2.9.4 2019-01-19 23:55:30 +07:00
XMRig
2c38f693d7 Merge branch 'dev' 2019-01-19 23:54:50 +07:00
xmrig
4faa95b460 Update CHANGELOG.md 2019-01-19 23:53:39 +07:00
xmrig
5f9ebdf149 Merge pull request #915 from SChernykh/dev
Make JIT memory read-only after patching is done
2019-01-19 17:55:54 +07:00
SChernykh
31a571dc70 Make JIT memory read-only after patching is done 2019-01-19 11:22:54 +01:00
XMRig
897ff83dcd #913 Increase max blob size for MSR secor upgrade. 2019-01-18 21:44:44 +07:00
XMRig
a63794ccd6 v2.9.4-dev 2019-01-17 20:43:25 +07:00
XMRig
b15e605614 Merge branch 'master' into dev 2019-01-17 20:41:52 +07:00
XMRig
18335392a1 Merge branch 'master' of github.com:xmrig/xmrig 2019-01-17 12:22:00 +07:00
XMRig
b1c22da6a1 v2.9.3 2019-01-17 12:21:39 +07:00
xmrig
b95ff65eae Update CHANGELOG.md 2019-01-17 12:20:37 +07:00
xmrig
005a09cd98 Merge pull request #912 from SChernykh/master
Correct FP rounding mode for cn/half
2019-01-17 12:12:03 +07:00
SChernykh
e0f5066ded Correct FP rounding mode for cn/half 2019-01-17 00:49:48 +01:00
XMRig
2b15bcbb4f Don't use __builtin___clear_cache on FreeBSD. 2019-01-16 17:53:47 +07:00
xmrig
db646d5d2d Merge pull request #910 from ehaupt/patch-1
FreeBSD needs pthread
2019-01-16 17:50:53 +07:00
Emanuel Haupt
b58e20dde4 FreeBSD needs pthread
FreeBSD needs the pthread linker flag.
2019-01-16 10:55:45 +01:00
XMRig
b11e772acc v2.9.2 2019-01-16 09:17:35 +07:00
xmrig
d1bc03351b Merge pull request #907 from SChernykh/master
Fixed crash in patchCode() on Linux
2019-01-16 09:09:51 +07:00
SChernykh
d1f551da2c Fixed compilation error on Windows 2019-01-16 00:24:34 +01:00
SChernykh
6425c53d61 Fixed crash in patchCode() on Linux 2019-01-16 00:09:00 +01:00
XMRig
118e547175 Restored compatibility with https://stellite.hashvault.pro. 2019-01-16 02:22:29 +07:00
15 changed files with 64 additions and 75 deletions

View File

@@ -1,3 +1,17 @@
# v2.9.4
- [#913](https://github.com/xmrig/xmrig/issues/913) Fixed Masari (MSR) support (this update required for upcoming fork).
- [#915](https://github.com/xmrig/xmrig/pull/915) Improved security, JIT memory now read-only after patching.
# v2.9.3
- [#909](https://github.com/xmrig/xmrig/issues/909) Fixed compile errors on FreeBSD.
- [#912](https://github.com/xmrig/xmrig/pull/912) Fixed, C++ implementation of `cn/half` was produce up to 13% of invalid hashes.
# v2.9.2
- [#907](https://github.com/xmrig/xmrig/pull/907) Fixed crash on Linux.
# v2.9.1
- Restored compatibility with https://stellite.hashvault.pro.
# v2.9.0
- [#899](https://github.com/xmrig/xmrig/issues/899) Added support for new algorithm `cn/half` for Masari and Stellite forks.
- [#834](https://github.com/xmrig/xmrig/pull/834) Added ASM optimized code for AMD Bulldozer.

View File

@@ -158,7 +158,7 @@ else()
)
if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(EXTRA_LIBS kvm)
set(EXTRA_LIBS kvm pthread)
else()
set(EXTRA_LIBS pthread rt dl)
endif()

View File

@@ -61,6 +61,7 @@ public:
static void release(cryptonight_ctx **ctx, size_t count, MemInfo &info);
static void *allocateExecutableMemory(size_t size);
static void protectExecutableMemory(void *p, size_t size);
static void flushInstructionCache(void *p, size_t size);
static inline bool isHugepagesAvailable() { return (m_flags & HugepagesAvailable) != 0; }

View File

@@ -100,7 +100,15 @@ void *Mem::allocateExecutableMemory(size_t size)
}
void Mem::protectExecutableMemory(void *p, size_t size)
{
mprotect(p, size, PROT_READ | PROT_EXEC);
}
void Mem::flushInstructionCache(void *p, size_t size)
{
# ifndef __FreeBSD__
__builtin___clear_cache(reinterpret_cast<char*>(p), reinterpret_cast<char*>(p) + size);
# endif
}

View File

@@ -191,6 +191,13 @@ void *Mem::allocateExecutableMemory(size_t size)
}
void Mem::protectExecutableMemory(void *p, size_t size)
{
DWORD oldProtect;
VirtualProtect(p, size, PAGE_EXECUTE_READ, &oldProtect);
}
void Mem::flushInstructionCache(void *p, size_t size)
{
::FlushInstructionCache(GetCurrentProcess(), p, size);

View File

@@ -342,7 +342,8 @@ bool Client::parseJob(const rapidjson::Value &params, int *code)
if (params.HasMember("algo")) {
job.setAlgorithm(params["algo"].GetString());
}
else if (params.HasMember("variant")) {
if (params.HasMember("variant")) {
const rapidjson::Value &variant = params["variant"];
if (variant.IsInt()) {

View File

@@ -6,7 +6,7 @@
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2018 SChernykh <https://github.com/SChernykh>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -38,6 +38,10 @@
class Job
{
public:
// Max blob size is 84 (75 fixed + 9 variable), aligned to 96. https://github.com/xmrig/xmrig/issues/1 Thanks fireice-uk.
// SECOR increase requirements for blob size: https://github.com/xmrig/xmrig/issues/913
static constexpr const size_t kMaxBlobSize = 128;
Job();
Job(int poolId, bool nicehash, const xmrig::Algorithm &algorithm, const xmrig::Id &clientId);
~Job();
@@ -95,7 +99,7 @@ private:
size_t m_size;
uint64_t m_diff;
uint64_t m_target;
uint8_t m_blob[96]; // Max blob size is 84 (75 fixed + 9 variable), aligned to 96. https://github.com/xmrig/xmrig/issues/1 Thanks fireice-uk.
uint8_t m_blob[kMaxBlobSize];
xmrig::Algorithm m_algorithm;
xmrig::Id m_clientId;
xmrig::Id m_id;

View File

@@ -66,9 +66,9 @@
__m128i sqrt_result_xmm_##part = _mm_cvtsi64_si128(h##part[13]);
#ifdef _MSC_VER
# define VARIANT2_SET_ROUNDING_MODE() if (VARIANT == xmrig::VARIANT_2) { _control87(RC_DOWN, MCW_RC); }
# define VARIANT2_SET_ROUNDING_MODE() if (BASE == xmrig::VARIANT_2) { _control87(RC_DOWN, MCW_RC); }
#else
# define VARIANT2_SET_ROUNDING_MODE() if (VARIANT == xmrig::VARIANT_2) { fesetround(FE_DOWNWARD); }
# define VARIANT2_SET_ROUNDING_MODE() if (BASE == xmrig::VARIANT_2) { fesetround(FE_DOWNWARD); }
#endif
# define VARIANT2_INTEGER_MATH(part, cl, cx) \

View File

@@ -23,10 +23,7 @@ FN_PREFIX(cnv2_mainloop_ivybridge_asm):
#include "cn2/cnv2_main_loop_ivybridge.inc"
add rsp, 48
ret 0
nop
nop
nop
nop
mov eax, 3735929054
ALIGN(64)
FN_PREFIX(cnv2_mainloop_ryzen_asm):
@@ -35,10 +32,7 @@ FN_PREFIX(cnv2_mainloop_ryzen_asm):
#include "cn2/cnv2_main_loop_ryzen.inc"
add rsp, 48
ret 0
nop
nop
nop
nop
mov eax, 3735929054
ALIGN(64)
FN_PREFIX(cnv2_mainloop_bulldozer_asm):
@@ -47,10 +41,7 @@ FN_PREFIX(cnv2_mainloop_bulldozer_asm):
#include "cn2/cnv2_main_loop_bulldozer.inc"
add rsp, 48
ret 0
nop
nop
nop
nop
mov eax, 3735929054
ALIGN(64)
FN_PREFIX(cnv2_double_mainloop_sandybridge_asm):
@@ -60,7 +51,4 @@ FN_PREFIX(cnv2_double_mainloop_sandybridge_asm):
#include "cn2/cnv2_double_main_loop_sandybridge.inc"
add rsp, 48
ret 0
nop
nop
nop
nop
mov eax, 3735929054

View File

@@ -8,40 +8,28 @@ ALIGN(64)
cnv2_mainloop_ivybridge_asm PROC
INCLUDE cn2/cnv2_main_loop_ivybridge.inc
ret 0
nop
nop
nop
nop
mov eax, 3735929054
cnv2_mainloop_ivybridge_asm ENDP
ALIGN(64)
cnv2_mainloop_ryzen_asm PROC
INCLUDE cn2/cnv2_main_loop_ryzen.inc
ret 0
nop
nop
nop
nop
mov eax, 3735929054
cnv2_mainloop_ryzen_asm ENDP
ALIGN(64)
cnv2_mainloop_bulldozer_asm PROC
INCLUDE cn2/cnv2_main_loop_bulldozer.inc
ret 0
nop
nop
nop
nop
mov eax, 3735929054
cnv2_mainloop_bulldozer_asm ENDP
ALIGN(64)
cnv2_double_mainloop_sandybridge_asm PROC
INCLUDE cn2/cnv2_double_main_loop_sandybridge.inc
ret 0
nop
nop
nop
nop
mov eax, 3735929054
cnv2_double_mainloop_sandybridge_asm ENDP
_TEXT_CNV2_MAINLOOP ENDS

View File

@@ -10,34 +10,22 @@ ALIGN(64)
cnv2_mainloop_ivybridge_asm:
#include "../cn2/cnv2_main_loop_ivybridge.inc"
ret 0
nop
nop
nop
nop
mov eax, 3735929054
ALIGN(64)
cnv2_mainloop_ryzen_asm:
#include "../cn2/cnv2_main_loop_ryzen.inc"
ret 0
nop
nop
nop
nop
mov eax, 3735929054
ALIGN(64)
cnv2_mainloop_bulldozer_asm:
#include "../cn2/cnv2_main_loop_bulldozer.inc"
ret 0
nop
nop
nop
nop
mov eax, 3735929054
ALIGN(64)
cnv2_double_mainloop_sandybridge_asm:
#include "../cn2/cnv2_double_main_loop_sandybridge.inc"
ret 0
nop
nop
nop
nop
mov eax, 3735929054

View File

@@ -8,40 +8,28 @@ ALIGN 64
cnv2_mainloop_ivybridge_asm PROC
INCLUDE cn2/cnv2_main_loop_ivybridge.inc
ret 0
nop
nop
nop
nop
mov eax, 3735929054
cnv2_mainloop_ivybridge_asm ENDP
ALIGN 64
cnv2_mainloop_ryzen_asm PROC
INCLUDE cn2/cnv2_main_loop_ryzen.inc
ret 0
nop
nop
nop
nop
mov eax, 3735929054
cnv2_mainloop_ryzen_asm ENDP
ALIGN 64
cnv2_mainloop_bulldozer_asm PROC
INCLUDE cn2/cnv2_main_loop_bulldozer.inc
ret 0
nop
nop
nop
nop
mov eax, 3735929054
cnv2_mainloop_bulldozer_asm ENDP
ALIGN 64
cnv2_double_mainloop_sandybridge_asm PROC
INCLUDE cn2/cnv2_double_main_loop_sandybridge.inc
ret 0
nop
nop
nop
nop
mov eax, 3735929054
cnv2_double_mainloop_sandybridge_asm ENDP
_TEXT_CNV2_MAINLOOP ENDS

View File

@@ -28,7 +28,7 @@
#define APP_ID "xmrig"
#define APP_NAME "XMRig"
#define APP_DESC "XMRig CPU miner"
#define APP_VERSION "2.9.0"
#define APP_VERSION "2.9.4"
#define APP_DOMAIN "xmrig.com"
#define APP_SITE "www.xmrig.com"
#define APP_COPYRIGHT "Copyright (C) 2016-2019 xmrig.com"
@@ -36,7 +36,7 @@
#define APP_VER_MAJOR 2
#define APP_VER_MINOR 9
#define APP_VER_PATCH 0
#define APP_VER_PATCH 4
#ifdef _MSC_VER
# if (_MSC_VER >= 1910)

View File

@@ -69,9 +69,10 @@ static void patchCode(T dst, U src, const uint32_t iterations, const uint32_t ma
# endif
size_t size = 0;
while (*(uint32_t*)(p + size) != 0x90909090) {
while (*(uint32_t*)(p + size) != 0xDEADC0DE) {
++size;
}
size += sizeof(uint32_t);
memcpy((void*) dst, (const void*) src, size);
@@ -117,6 +118,7 @@ void xmrig::CpuThread::patchAsmVariants()
patchCode(cn_half_mainloop_bulldozer_asm, cnv2_mainloop_bulldozer_asm, xmrig::CRYPTONIGHT_HALF_ITER, xmrig::CRYPTONIGHT_MASK);
patchCode(cn_half_double_mainloop_sandybridge_asm, cnv2_double_mainloop_sandybridge_asm, xmrig::CRYPTONIGHT_HALF_ITER, xmrig::CRYPTONIGHT_MASK);
Mem::protectExecutableMemory(base, allocation_size);
Mem::flushInstructionCache(base, allocation_size);
}
#endif

View File

@@ -6,7 +6,7 @@
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2018 SChernykh <https://github.com/SChernykh>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -60,7 +60,7 @@ private:
struct State
{
alignas(16) uint8_t blob[96 * N];
alignas(16) uint8_t blob[Job::kMaxBlobSize * N];
Job job;
};