Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  bugs.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2024 Rivos Inc.
 */


#include <linux/cpu.h>
#include <linux/device.h>
#include <linux/sprintf.h>

#include <asm/bugs.h>
#include <asm/vendor_extensions/thead.h>

static enum mitigation_state ghostwrite_state;

void ghostwrite_set_vulnerable(void)
{
 ghostwrite_state = VULNERABLE;
}

/*
 * Vendor extension alternatives will use the value set at the time of boot
 * alternative patching, thus this must be called before boot alternatives are
 * patched (and after extension probing) to be effective.
 *
 * Returns true if mitgated, false otherwise.
 */

bool ghostwrite_enable_mitigation(void)
{
 if (IS_ENABLED(CONFIG_RISCV_ISA_XTHEADVECTOR) &&
     ghostwrite_state == VULNERABLE && !cpu_mitigations_off()) {
  disable_xtheadvector();
  ghostwrite_state = MITIGATED;
  return true;
 }

 return false;
}

enum mitigation_state ghostwrite_get_state(void)
{
 return ghostwrite_state;
}

ssize_t cpu_show_ghostwrite(struct device *dev, struct device_attribute *attr, char *buf)
{
 if (IS_ENABLED(CONFIG_RISCV_ISA_XTHEADVECTOR)) {
  switch (ghostwrite_state) {
  case UNAFFECTED:
   return sprintf(buf, "Not affected\n");
  case MITIGATED:
   return sprintf(buf, "Mitigation: xtheadvector disabled\n");
  case VULNERABLE:
   fallthrough;
  default:
   return sprintf(buf, "Vulnerable\n");
  }
 } else {
  return sprintf(buf, "Not affected\n");
 }
}

Messung V0.5
C=95 H=88 G=91

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge