@@ -12348,6 +12348,7 @@ struct VM {
1234812348 static std::string conclusion (const flagset &flags = core::generate_default ()) {
1234912349 std::string brand_tmp = brand (flags);
1235012350 const u8 percent_tmp = percentage (flags);
12351+ const bool has_hardener = is_hardened ();
1235112352
1235212353 constexpr const char * very_unlikely = " Very unlikely a" ;
1235312354 constexpr const char * unlikely = " Unlikely a" ;
@@ -12362,30 +12363,38 @@ struct VM {
1236212363 return memo::conclusion::fetch ();
1236312364 }
1236412365
12366+ const char * hardener = " " ;
12367+
12368+ if (has_hardener) {
12369+ hardener = " hardened " ;
12370+ }
12371+
1236512372 const char * addition = " a " ;
1236612373
1236712374 // this basically just fixes the grammatical syntax
1236812375 // by either having "a" or "an" before the VM brand
1236912376 // name. It would look weird if the conclusion
1237012377 // message was "an VirtualBox" or "a Anubis", so this
12371- // lambda fixes that issue.
12378+ // condition fixes that issue.
1237212379 if (
12373- (brand_tmp == brands::ACRN ) ||
12374- (brand_tmp == brands::ANUBIS ) ||
12375- (brand_tmp == brands::BSD_VMM ) ||
12376- (brand_tmp == brands::INTEL_HAXM ) ||
12377- (brand_tmp == brands::APPLE_VZ ) ||
12378- (brand_tmp == brands::INTEL_KGT ) ||
12379- (brand_tmp == brands::POWERVM ) ||
12380- (brand_tmp == brands::OPENSTACK ) ||
12381- (brand_tmp == brands::AWS_NITRO ) ||
12382- (brand_tmp == brands::OPENVZ ) ||
12383- (brand_tmp == brands::INTEL_TDX ) ||
12384- (brand_tmp == brands::AMD_SEV ) ||
12385- (brand_tmp == brands::AMD_SEV_ES ) ||
12386- (brand_tmp == brands::AMD_SEV_SNP ) ||
12387- (brand_tmp == brands::NSJAIL ) ||
12388- (brand_tmp == brands::NULL_BRAND )
12380+ !hardener && (
12381+ (brand_tmp == brands::ACRN ) ||
12382+ (brand_tmp == brands::ANUBIS ) ||
12383+ (brand_tmp == brands::BSD_VMM ) ||
12384+ (brand_tmp == brands::INTEL_HAXM ) ||
12385+ (brand_tmp == brands::APPLE_VZ ) ||
12386+ (brand_tmp == brands::INTEL_KGT ) ||
12387+ (brand_tmp == brands::POWERVM ) ||
12388+ (brand_tmp == brands::OPENSTACK ) ||
12389+ (brand_tmp == brands::AWS_NITRO ) ||
12390+ (brand_tmp == brands::OPENVZ ) ||
12391+ (brand_tmp == brands::INTEL_TDX ) ||
12392+ (brand_tmp == brands::AMD_SEV ) ||
12393+ (brand_tmp == brands::AMD_SEV_ES ) ||
12394+ (brand_tmp == brands::AMD_SEV_SNP ) ||
12395+ (brand_tmp == brands::NSJAIL ) ||
12396+ (brand_tmp == brands::NULL_BRAND )
12397+ )
1238912398 ) {
1239012399 addition = " an " ;
1239112400 }
@@ -12399,17 +12408,20 @@ struct VM {
1239912408 // Hyper-V artifacts are an exception due to how unique the circumstance is
1240012409 std::string result;
1240112410 if (brand_tmp == brands::HYPERV_ARTIFACT ) {
12402- result = std::string (category) + addition + brand_tmp;
12403- }
12404- else {
12405- result = std::string (category) + addition + brand_tmp + " VM" ;
12411+ result = std::string (category) + addition + hardener + brand_tmp;
12412+ } else {
12413+ result = std::string (category) + addition + hardener + brand_tmp + " VM" ;
1240612414 }
1240712415
1240812416 memo::conclusion::store (result.c_str ());
1240912417
1241012418 return result;
1241112419 };
1241212420
12421+ if (has_hardener) {
12422+ return make_conclusion (inside_vm);
12423+ }
12424+
1241312425 if (core::is_enabled (flags, DYNAMIC )) {
1241412426 if (percent_tmp == 0 ) { return " Running on baremetal" ; }
1241512427 else if (percent_tmp <= 20 ) { return make_conclusion (very_unlikely); }
@@ -12418,14 +12430,13 @@ struct VM {
1241812430 else if (percent_tmp <= 62 ) { return make_conclusion (might); }
1241912431 else if (percent_tmp <= 75 ) { return make_conclusion (likely); }
1242012432 else if (percent_tmp < 100 ) { return make_conclusion (very_likely); }
12421- else { return make_conclusion (inside_vm); }
1242212433 }
1242312434
1242412435 if (percent_tmp == 100 ) {
1242512436 return make_conclusion (inside_vm);
12426- } else {
12427- return " Running on baremetal" ;
1242812437 }
12438+
12439+ return " Running on baremetal" ;
1242912440 }
1243012441
1243112442
0 commit comments