@@ -411,30 +411,6 @@ static const MemoryMapParams Linux_X86_64_MemoryMapParams = {
411
411
0x100000000000 , // OriginBase
412
412
};
413
413
414
- // riscv32 Linux
415
- static const MemoryMapParams Linux_RISCV32_MemoryMapParams = {
416
- 0x000080000000 , // AndMask
417
- 0 , // XorMask (not used)
418
- 0 , // ShadowBase (not used)
419
- 0x000040000000 , // OriginBase
420
- };
421
-
422
- // riscv64 Linux
423
- static const MemoryMapParams Linux_RISCV64_MemoryMapParams = {
424
- 0 , // AndMask (not used)
425
- 0x008000000000 , // XorMask
426
- 0 , // ShadowBase (not used)
427
- 0x002000000000 , // OriginBase
428
- };
429
-
430
- // mips32 Linux
431
- static const MemoryMapParams Linux_MIPS32_MemoryMapParams = {
432
- 0x000080000000 , // AndMask
433
- 0 , // XorMask (not used)
434
- 0 , // ShadowBase (not used)
435
- 0x000040000000 , // OriginBase
436
- };
437
-
438
414
// mips64 Linux
439
415
static const MemoryMapParams Linux_MIPS64_MemoryMapParams = {
440
416
0 , // AndMask (not used)
@@ -443,14 +419,6 @@ static const MemoryMapParams Linux_MIPS64_MemoryMapParams = {
443
419
0x002000000000 , // OriginBase
444
420
};
445
421
446
- // ppc32 Linux
447
- static const MemoryMapParams Linux_PowerPC32_MemoryMapParams = {
448
- 0x000080000000 , // AndMask
449
- 0 , // XorMask (not used)
450
- 0 , // ShadowBase (not used)
451
- 0x000040000000 , // OriginBase
452
- };
453
-
454
422
// ppc64 Linux
455
423
static const MemoryMapParams Linux_PowerPC64_MemoryMapParams = {
456
424
0xE00000000000 , // AndMask
@@ -467,14 +435,6 @@ static const MemoryMapParams Linux_S390X_MemoryMapParams = {
467
435
0x1C0000000000 , // OriginBase
468
436
};
469
437
470
- // ARM32 Linux
471
- static const MemoryMapParams Linux_ARM32_MemoryMapParams = {
472
- 0x000080000000 , // AndMask
473
- 0 , // XorMask (not used)
474
- 0 , // ShadowBase (not used)
475
- 0x000040000000 , // OriginBase
476
- };
477
-
478
438
// aarch64 Linux
479
439
static const MemoryMapParams Linux_AArch64_MemoryMapParams = {
480
440
0 , // AndMask (not used)
@@ -528,18 +488,13 @@ static const PlatformMemoryMapParams Linux_X86_MemoryMapParams = {
528
488
&Linux_X86_64_MemoryMapParams,
529
489
};
530
490
531
- static const PlatformMemoryMapParams Linux_RISCV_MemoryMapParams = {
532
- &Linux_RISCV32_MemoryMapParams,
533
- &Linux_RISCV64_MemoryMapParams,
534
- };
535
-
536
491
static const PlatformMemoryMapParams Linux_MIPS_MemoryMapParams = {
537
- &Linux_MIPS32_MemoryMapParams ,
492
+ nullptr ,
538
493
&Linux_MIPS64_MemoryMapParams,
539
494
};
540
495
541
496
static const PlatformMemoryMapParams Linux_PowerPC_MemoryMapParams = {
542
- &Linux_PowerPC32_MemoryMapParams ,
497
+ nullptr ,
543
498
&Linux_PowerPC64_MemoryMapParams,
544
499
};
545
500
@@ -549,7 +504,7 @@ static const PlatformMemoryMapParams Linux_S390_MemoryMapParams = {
549
504
};
550
505
551
506
static const PlatformMemoryMapParams Linux_ARM_MemoryMapParams = {
552
- &Linux_ARM32_MemoryMapParams ,
507
+ nullptr ,
553
508
&Linux_AArch64_MemoryMapParams,
554
509
};
555
510
@@ -1059,35 +1014,17 @@ void MemorySanitizer::initializeModule(Module &M) {
1059
1014
case Triple::x86_64:
1060
1015
MapParams = Linux_X86_MemoryMapParams.bits64 ;
1061
1016
break ;
1062
- case Triple::riscv32:
1063
- MapParams = Linux_RISCV_MemoryMapParams.bits32 ;
1064
- break ;
1065
- case Triple::riscv64:
1066
- MapParams = Linux_RISCV_MemoryMapParams.bits64 ;
1067
- break ;
1068
- case Triple::mips:
1069
- case Triple::mipsel:
1070
- MapParams = Linux_MIPS_MemoryMapParams.bits32 ;
1071
- break ;
1072
1017
case Triple::mips64:
1073
1018
case Triple::mips64el:
1074
1019
MapParams = Linux_MIPS_MemoryMapParams.bits64 ;
1075
1020
break ;
1076
- case Triple::ppc:
1077
- case Triple::ppcle:
1078
- MapParams = Linux_PowerPC_MemoryMapParams.bits32 ;
1079
- break ;
1080
1021
case Triple::ppc64:
1081
1022
case Triple::ppc64le:
1082
1023
MapParams = Linux_PowerPC_MemoryMapParams.bits64 ;
1083
1024
break ;
1084
1025
case Triple::systemz:
1085
1026
MapParams = Linux_S390_MemoryMapParams.bits64 ;
1086
1027
break ;
1087
- case Triple::arm:
1088
- case Triple::armeb:
1089
- MapParams = Linux_ARM_MemoryMapParams.bits32 ;
1090
- break ;
1091
1028
case Triple::aarch64:
1092
1029
case Triple::aarch64_be:
1093
1030
MapParams = Linux_ARM_MemoryMapParams.bits64 ;
@@ -4605,10 +4542,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
4605
4542
Size = DL.getTypeAllocSize (A->getType ());
4606
4543
if (ArgOffset + Size > kParamTLSSize )
4607
4544
break ;
4608
-
4609
- Value *ArgShadow = getShadow (A);
4610
- Value *ArgShadowBase = getShadowPtrForArgument (IRB, ArgOffset);
4611
- IRB.CreateAlignedStore (ArgShadow, ArgShadowBase, kShadowTLSAlignment );
4612
4545
} else {
4613
4546
Value *Store = nullptr ;
4614
4547
// Compute the Shadow for arg even if it is ByVal, because
@@ -5159,13 +5092,13 @@ struct VarArgHelperBase : public VarArgHelper {
5159
5092
Value *TailSize =
5160
5093
ConstantInt::getSigned (IRB.getInt32Ty (), kParamTLSSize - BaseOffset);
5161
5094
IRB.CreateMemSet (ShadowBase, ConstantInt::getNullValue (IRB.getInt8Ty ()),
5162
- TailSize, Align (4 ));
5095
+ TailSize, Align (8 ));
5163
5096
}
5164
5097
5165
5098
void unpoisonVAListTagForInst (IntrinsicInst &I) {
5166
5099
IRBuilder<> IRB (&I);
5167
5100
Value *VAListTag = I.getArgOperand (0 );
5168
- const Align Alignment = Align (4 );
5101
+ const Align Alignment = Align (8 );
5169
5102
auto [ShadowPtr, OriginPtr] = MSV.getShadowOriginPtr (
5170
5103
VAListTag, IRB, IRB.getInt8Ty (), Alignment, /* isStore*/ true );
5171
5104
// Unpoison the whole __va_list_tag.
@@ -6146,7 +6079,7 @@ struct VarArgI386Helper : public VarArgHelperBase {
6146
6079
if (!IsFixed) {
6147
6080
Base = getShadowPtrForVAArgument (IRB, VAArgOffset, ArgSize);
6148
6081
if (Base)
6149
- IRB.CreateStore (MSV.getShadow (A), Base);
6082
+ IRB.CreateAlignedStore (MSV.getShadow (A), Base, kShadowTLSAlignment );
6150
6083
VAArgOffset += ArgSize;
6151
6084
VAArgOffset = alignTo (VAArgOffset, Align (IntptrSize));
6152
6085
}
@@ -6237,7 +6170,7 @@ struct VarArgGenericHelper : public VarArgHelperBase {
6237
6170
continue ;
6238
6171
}
6239
6172
Value *Shadow = MSV.getShadow (A);
6240
- IRB.CreateStore (Shadow, Base);
6173
+ IRB.CreateAlignedStore (Shadow, Base, kShadowTLSAlignment );
6241
6174
}
6242
6175
6243
6176
Constant *TotalVAArgSize = ConstantInt::get (MS.IntptrTy , VAArgOffset);
0 commit comments