├── SECURITY.md ├── util.h ├── examples ├── correctable ├── fatal ├── nonfatal ├── mixed-corr-nonfatal ├── multiple-corr-nonfatal └── syntax-variations ├── README ├── util.c ├── Makefile ├── aer.h ├── SPEC ├── CONTRIBUTING.md ├── aer.y ├── aer-inject.c ├── aer.lex ├── CODE_OF_CONDUCT.md └── LICENSE /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation. 3 | 4 | ## Reporting a Vulnerability 5 | Please report any security vulnerabilities in this project utilizing the guidelines [here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html). 6 | -------------------------------------------------------------------------------- /util.h: -------------------------------------------------------------------------------- 1 | #ifndef UTIL_H 2 | #define UTIL_H 3 | 4 | void error_exit(char *fmt, ...); 5 | 6 | #define ERROR_EXIT(fmt, x...) \ 7 | do { \ 8 | error_exit(fmt, ## x); \ 9 | } while (0) 10 | 11 | #define ERROR_EXIT_ON(check, fmt, x...) \ 12 | do { \ 13 | if (check) \ 14 | error_exit(fmt, ## x); \ 15 | } while (0) 16 | 17 | #define ARRAY_SIZE(x) (sizeof(x)/sizeof(*(x))) 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /examples/correctable: -------------------------------------------------------------------------------- 1 | # Inject a correctable bad TLP error into the device with header log 2 | # words 0 1 2 3. 3 | # 4 | # Either specify the PCI id on the command-line option or uncomment and edit 5 | # the PCI_ID line below using the correct PCI ID. 6 | # 7 | # Note that system firmware/BIOS may mask certain errors and/or not report 8 | # header log words. 9 | # 10 | AER 11 | # PCI_ID [WWWW:]XX.YY.Z 12 | COR_STATUS BAD_TLP 13 | HEADER_LOG 0 1 2 3 14 | -------------------------------------------------------------------------------- /examples/fatal: -------------------------------------------------------------------------------- 1 | # Inject an uncorrectable/fatal malformed TLP error into the device 2 | # with header log words 0 1 2 3. 3 | # 4 | # Either specify the PCI id on the command-line option or uncomment and edit 5 | # the PCI_ID line below using the correct PCI ID. 6 | # 7 | # Note that system firmware/BIOS may mask certain errors, change their severity 8 | # and/or not report header log words. 9 | # 10 | AER 11 | # PCI_ID [WWWW:]XX.YY.Z 12 | UNCOR_STATUS MALF_TLP 13 | HEADER_LOG 0 1 2 3 14 | -------------------------------------------------------------------------------- /examples/nonfatal: -------------------------------------------------------------------------------- 1 | # Inject an uncorrectable/non-fatal training error into the device 2 | # with header log words 0 1 2 3. 3 | # 4 | # Either specify the PCI id on the command-line option or uncomment and edit 5 | # the PCI_ID line below using the correct PCI ID. 6 | # 7 | # Note that system firmware/BIOS may mask certain errors, change their severity 8 | # and/or not report header log words. 9 | # 10 | AER 11 | # PCI_ID [WWWW:]XX.YY.Z 12 | UNCOR_STATUS COMP_ABORT 13 | HEADER_LOG 0 1 2 3 14 | -------------------------------------------------------------------------------- /examples/mixed-corr-nonfatal: -------------------------------------------------------------------------------- 1 | # Simultaneously inject a correctable bad TLP and an 2 | # uncorrectable/non-fatal completion abort error into the device with header 3 | # log words 0 1 2 3. 4 | # 5 | # Either specify the PCI id on the command-line option or uncomment and edit 6 | # the PCI_ID line below using the correct PCI ID. 7 | # 8 | # Note that system firmware/BIOS may mask certain errors, change their severity 9 | # and/or not report header log words. 10 | # 11 | AER 12 | # PCI_ID [WWWW:]XX.YY.Z 13 | COR_STATUS BAD_TLP 14 | UNCOR_STATUS COMP_ABORT 15 | HEADER_LOG 0 1 2 3 16 | -------------------------------------------------------------------------------- /examples/multiple-corr-nonfatal: -------------------------------------------------------------------------------- 1 | # Sequentially inject a correctable bad TLP and a 2 | # uncorrectable/non-fatal completion abort error into the device with header 3 | # various header log words. 4 | # 5 | # Either specify the PCI id on the command-line option or uncomment and edit 6 | # the PCI_ID line below using the correct PCI ID. 7 | # 8 | # Note that system firmware/BIOS may mask certain errors, change their severity 9 | # and/or not report header log words. 10 | # 11 | AER 12 | # PCI_ID [WWWW:]XX.YY.Z 13 | COR_STATUS BAD_TLP 14 | HEADER_LOG 0 1 2 3 15 | # 16 | AER 17 | # PCI_ID [WWWW:]XX.YY.Z 18 | UNCOR_STATUS COMP_ABORT 19 | HEADER_LOG 4 5 6 7 20 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | aer-inject allows to inject PCIE AER errors on the software level into 2 | a running Linux kernel. This is intended for validation of the PCIE 3 | driver error recovery handler and PCIE AER core handler. 4 | 5 | Syntax: 6 | 7 | aer-inject aer-file 8 | 9 | See SPEC for the input language 10 | 11 | Some simple tests are in test/*. 12 | 13 | Requires a new Linux kernel with PCIE AER error injection patches. 14 | The PCIE AER error injection patches are currently available from 15 | git://git.kernel.org/pub/scm/linux/kernel/git/xxx.git 16 | 17 | 18 | Authors: 19 | 20 | Huang Ying 21 | 22 | Basic design, some code and document are based on Andi Kleen's 23 | mce-inject. 24 | 25 | -------------------------------------------------------------------------------- /util.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Some utility functions 3 | * 4 | * Copyright (C) Intel Corp., 2009 5 | * Author: Huang Ying 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | */ 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include "util.h" 20 | 21 | void error_exit(char *fmt, ...) 22 | { 23 | va_list ap; 24 | 25 | fprintf(stderr, "Error: "); 26 | va_start(ap, fmt); 27 | vfprintf(stderr, fmt, ap); 28 | if (errno) 29 | fprintf(stderr, ", %s\n", strerror(errno)); 30 | else 31 | fprintf(stderr, "\n"); 32 | exit(-1); 33 | } 34 | 35 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PREFIX = /usr/local 2 | CFLAGS := -g -Wall -D_GNU_SOURCE 3 | LDFLAGS += -lpthread 4 | DESTDIR = 5 | 6 | OBJ := aer-inject.o util.o aer.tab.o lex.yy.o 7 | GENSRC := aer.tab.c aer.tab.h lex.yy.c 8 | SRC := aer-inject.c util.c 9 | CLEAN := ${OBJ} ${GENSRC} aer-inject .gdb_history .depend 10 | DISTCLEAN := .depend .gdb_history 11 | 12 | .PHONY: clean depend 13 | 14 | aer-inject: ${OBJ} 15 | 16 | lex.yy.c: aer.lex aer.tab.h 17 | flex aer.lex 18 | 19 | aer.tab.c aer.tab.h: aer.y 20 | bison -d aer.y 21 | 22 | clean: 23 | rm -f ${CLEAN} 24 | 25 | distclean: clean 26 | rm -f ${DISTCLEAN} *~ 27 | 28 | depend: .depend 29 | 30 | .depend: ${SRC} ${GENSRC} 31 | ${CC} -MM -DDEPS_RUN -I. ${SRC} ${GENSRC} > .depend.X && \ 32 | mv .depend.X .depend 33 | 34 | Makefile: .depend 35 | 36 | install: aer-inject 37 | install -d $(DESTDIR)$(PREFIX) 38 | install aer-inject $(DESTDIR)$(PREFIX) 39 | 40 | include .depend 41 | -------------------------------------------------------------------------------- /examples/syntax-variations: -------------------------------------------------------------------------------- 1 | # Variations in syntax 2 | # 3 | # Either specify the PCI id on the command-line option or uncomment and edit 4 | # the PCI_ID line below using the correct PCI ID. 5 | # 6 | # We can use lower-case: 7 | # 8 | aer 9 | # pci_id [WWWW:]XX.YY.Z 10 | cor_status rcvr 11 | header_log 0 1 2 3 12 | # 13 | # We can use aliases for key words: 14 | # 15 | AER 16 | # ID [WWWW:]XX.YY.Z 17 | COR BAD_TLP 18 | HL 4 5 6 7 19 | # 20 | # We can put multiple errors on the same line and use octal and hexadecimal 21 | # numbers: 22 | # 23 | AER 24 | # PCI_ID [WWWW:]XX.YY.Z 25 | COR_STATUS BAD_DLLP REP_ROLL 26 | HEADER_LOG 010 0x9 0xa 0xB 27 | # 28 | # We can use defaults: 29 | # 30 | AER 31 | # PCI_ID [WWWW:]XX.YY.Z 32 | COR_STATUS REP_TIMER 33 | # 34 | # Newlines are ignored and the PCI ID can be specified on the command-line. 35 | # We can also use raw numbers for the error: 36 | # 37 | AER COR_STATUS 0x2 HEADER_LOG 0 1 2 3 38 | -------------------------------------------------------------------------------- /aer.h: -------------------------------------------------------------------------------- 1 | #ifndef AER_H 2 | #define AER_H 3 | 4 | #include 5 | 6 | #define AER_VERSION "0.1" 7 | 8 | struct aer_error_inj 9 | { 10 | int8_t bus; 11 | int8_t dev; 12 | int8_t fn; 13 | int32_t uncor_status; 14 | int32_t cor_status; 15 | int32_t header_log0; 16 | int32_t header_log1; 17 | int32_t header_log2; 18 | int32_t header_log3; 19 | uint16_t domain; 20 | }; 21 | 22 | #define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */ 23 | #define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ 24 | #define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ 25 | #define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ 26 | #define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ 27 | #define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */ 28 | #define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */ 29 | #define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */ 30 | #define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ 31 | #define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ 32 | #define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ 33 | #define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */ 34 | #define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */ 35 | #define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ 36 | #define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ 37 | #define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ 38 | 39 | extern void init_aer(struct aer_error_inj *err); 40 | extern void submit_aer(struct aer_error_inj *err); 41 | extern int parse_pci_id(const char *str, struct aer_error_inj *err); 42 | extern int parse_data(char **argv); 43 | 44 | extern char *filename; 45 | extern int yylineno; 46 | extern void yyerror(char const *msg, ...); 47 | extern int yylex(void); 48 | extern int yyparse(void); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /SPEC: -------------------------------------------------------------------------------- 1 | 2 | aer-inject allows to inject PCIE AER errors in a running kernel. 3 | 4 | Has to run as root. /dev/aer_inject has to exist. 5 | 6 | aer-inject aer-file 7 | aer-inject < aer-file 8 | 9 | Requires a kernel with PCIE AER error injection support. The injection 10 | only happens on the software level and does not simulate full PCIE AER 11 | handling on the platform level. 12 | 13 | The PCIE AER error to be injected are described in an input language 14 | which reflects PCIE AER related registers quite straightforward. 15 | 16 | See the PCI Express Base Specification section 7.10 for details on 17 | PCIE AER related registers. 18 | 19 | The keywords are case-insensitive 20 | 21 | The error always starts with: 22 | 23 | AER 24 | 25 | Followed by 26 | 27 | PCI_ID pci_id 28 | 29 | These specify the PCI device or port via domain number, bus number, 30 | dev number and function number using the same format as the lspci 31 | command: 32 | 33 | WWWW:XX:YY.Z 34 | 35 | Where 36 | 37 | WWWW is the domain (segment) in hexadecimal (optional) 38 | XX is the bus number in hexadecimal 39 | YY is the device number in hexadecimal 40 | Z is the function number in hexadecimal 41 | 42 | Alternatively, you can use: 43 | 44 | BUS number DEV number FN number 45 | 46 | Number can be a decimal or hex (using 0x). 47 | 48 | 49 | COR_STATUS {RCVR|BAD_TLP|BAD_DLLP|REP_ROLL|REP_TIMER|number} 50 | 51 | UNCOR_STATUS {TRAIN|DLP|POISON_TLP|FCP|COMP_TIME|COMP_ABORT|UNX_COMP| 52 | RX_OVER|MALF_TLP|ECRC|UNSUP|number} 53 | 54 | HEADER_LOG number number number number 55 | 56 | These specify the corrected and uncorrected error types to be 57 | injected and corresponding TLP header log. 58 | 59 | multiple fields can be on a line. 60 | 61 | number (except for pci_id) can be hex/octal/decimal in the usual C format. 62 | 63 | Multiple errors can be in a single file, each new one starts with 64 | "AER". 65 | 66 | For all missing fields reasonable default values are filled in 67 | (hopefully). 68 | 69 | Comments start with # until the end of the line. 70 | 71 | Keywords are case-insensitive. 72 | 73 | There are aliases for some of the longer keywords: 74 | 75 | PCI_ID = ID 76 | COR_STATUS = COR = CORRECTABLE 77 | UNCOR_STATUS = UNCOR = UNCORRECTABLE 78 | HEADER_LOG = HL 79 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ### License 4 | 5 | aer-inject is licensed under the terms in [LICENSE]. By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms. 6 | 7 | ### Sign your work 8 | 9 | Please use the sign-off line at the end of the patch. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify 10 | the below (from [developercertificate.org](http://developercertificate.org/)): 11 | 12 | ``` 13 | Developer Certificate of Origin 14 | Version 1.1 15 | 16 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 17 | 660 York Street, Suite 102, 18 | San Francisco, CA 94110 USA 19 | 20 | Everyone is permitted to copy and distribute verbatim copies of this 21 | license document, but changing it is not allowed. 22 | 23 | Developer's Certificate of Origin 1.1 24 | 25 | By making a contribution to this project, I certify that: 26 | 27 | (a) The contribution was created in whole or in part by me and I 28 | have the right to submit it under the open source license 29 | indicated in the file; or 30 | 31 | (b) The contribution is based upon previous work that, to the best 32 | of my knowledge, is covered under an appropriate open source 33 | license and I have the right under that license to submit that 34 | work with modifications, whether created in whole or in part 35 | by me, under the same open source license (unless I am 36 | permitted to submit under a different license), as indicated 37 | in the file; or 38 | 39 | (c) The contribution was provided directly to me by some other 40 | person who certified (a), (b) or (c) and I have not modified 41 | it. 42 | 43 | (d) I understand and agree that this project and the contribution 44 | are public and that a record of the contribution (including all 45 | personal information I submit with it, including my sign-off) is 46 | maintained indefinitely and may be redistributed consistent with 47 | this project or the open source license(s) involved. 48 | ``` 49 | 50 | Then you just add a line to every git commit message: 51 | 52 | Signed-off-by: Joe Smith 53 | 54 | Use your real name (sorry, no pseudonyms or anonymous contributions.) 55 | 56 | If you set your `user.name` and `user.email` git configs, you can sign your 57 | commit automatically with `git commit -s`. 58 | -------------------------------------------------------------------------------- /aer.y: -------------------------------------------------------------------------------- 1 | /* 2 | * Grammar for the PCIE-AER injection. 3 | * 4 | * Copyright (c) 2009 by Intel Corp. 5 | * Author: Huang Ying 6 | * 7 | * Based on mce.y of mce-inject, which is written by Andi Kleen 8 | * . 9 | * 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; version 2 of the 13 | * License. 14 | */ 15 | 16 | %{ 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #include "aer.h" 23 | 24 | static struct aer_error_inj aerr; 25 | 26 | static void init(void); 27 | 28 | %} 29 | 30 | %union { 31 | int num; 32 | char *str; 33 | } 34 | 35 | %token AER DOMAIN BUS DEV FN PCI_ID UNCOR_STATUS COR_STATUS HEADER_LOG 36 | %token TRAIN DLP POISON_TLP FCP COMP_TIME COMP_ABORT UNX_COMP RX_OVER 37 | %token MALF_TLP ECRC UNSUP 38 | %token RCVR BAD_TLP BAD_DLLP REP_ROLL REP_TIMER 39 | %token SYMBOL NUMBER 40 | %token PCI_ID_STR 41 | 42 | %type uncor_status_list uncor_status cor_status_list cor_status 43 | 44 | %% 45 | 46 | input: /* empty */ 47 | | input aer_start aer { submit_aer(&aerr); } 48 | ; 49 | 50 | aer_start: AER { init(); } 51 | ; 52 | 53 | aer: aer_term 54 | | aer aer_term 55 | ; 56 | 57 | aer_term: UNCOR_STATUS uncor_status_list { aerr.uncor_status = $2; } 58 | | COR_STATUS cor_status_list { aerr.cor_status = $2; } 59 | | DOMAIN NUMBER BUS NUMBER DEV NUMBER FN NUMBER { aerr.domain = $2; 60 | aerr.bus = $4; 61 | aerr.dev = $6; 62 | aerr.fn = $8; } 63 | | BUS NUMBER DEV NUMBER FN NUMBER { aerr.domain = 0; 64 | aerr.bus = $2; 65 | aerr.dev = $4; 66 | aerr.fn = $6; } 67 | | PCI_ID PCI_ID_STR { parse_pci_id($2, &aerr); 68 | free($2); } 69 | | HEADER_LOG NUMBER NUMBER NUMBER NUMBER { aerr.header_log0 = $2; 70 | aerr.header_log1 = $3; 71 | aerr.header_log2 = $4; 72 | aerr.header_log3 = $5; } 73 | ; 74 | 75 | uncor_status_list: /* empty */ { $$ = 0; } 76 | | uncor_status_list uncor_status { $$ = $1 | $2; } 77 | ; 78 | 79 | uncor_status: TRAIN | DLP | POISON_TLP | FCP | COMP_TIME | COMP_ABORT 80 | | UNX_COMP | RX_OVER | MALF_TLP | ECRC | UNSUP | NUMBER 81 | ; 82 | 83 | cor_status_list: /* empty */ { $$ = 0; } 84 | | cor_status_list cor_status { $$ = $1 | $2; } 85 | ; 86 | 87 | cor_status: RCVR | BAD_TLP | BAD_DLLP | REP_ROLL | REP_TIMER | NUMBER 88 | ; 89 | 90 | %% 91 | 92 | static void init(void) 93 | { 94 | init_aer(&aerr); 95 | } 96 | 97 | int parse_pci_id(const char *str, struct aer_error_inj *aerr) 98 | { 99 | int cnt; 100 | 101 | cnt = sscanf(str, "%04hx:%02hhx:%02hhx.%01hhx", 102 | &aerr->domain, &aerr->bus, &aerr->dev, &aerr->fn); 103 | if (cnt != 4) { 104 | cnt = sscanf(str, "%02hhx:%02hhx.%01hhx", 105 | &aerr->bus, &aerr->dev, &aerr->fn); 106 | if (cnt == 3) 107 | aerr->domain = 0; 108 | else 109 | return 1; 110 | } 111 | 112 | return 0; 113 | } 114 | 115 | void yyerror(char const *msg, ...) 116 | { 117 | va_list ap; 118 | va_start(ap, msg); 119 | fprintf(stderr, "%s:%d: ", filename, yylineno); 120 | vfprintf(stderr, msg, ap); 121 | fputc('\n', stderr); 122 | va_end(ap); 123 | exit(1); 124 | } 125 | -------------------------------------------------------------------------------- /aer-inject.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Inject PCIE AER error into Linux kernel for testing 3 | * 4 | * Copyright 2009 Intel Corporation. 5 | * Huang Ying 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License as 9 | * published by the Free Software Foundation; version 2 of the 10 | * License. 11 | */ 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include "aer.h" 21 | #include "util.h" 22 | 23 | #define AER_DEV "/dev/aer_inject" 24 | 25 | #define CMDLINE_PCI_ID 0x0001 26 | 27 | const char *prg_name; 28 | 29 | static struct aer_error_inj aerr_cmdline; 30 | static unsigned int cmdline_flags = 0; 31 | 32 | void usage(const char *prgname) 33 | { 34 | fprintf(stderr, 35 | "Usage: %s [-s|--id=PCI_ID] [FILE]\n" 36 | " or: %s -v|--version\n" 37 | " or: %s -h|--help\n" 38 | "Inject an error into a PCIe device\n" 39 | "\n" 40 | " PCI_ID The [:]:. of the device in\n" 41 | " hex (same as lspci)\n" 42 | " FILE Error data file (use stdin if omitted)\n" 43 | , prgname, prgname, prgname); 44 | } 45 | 46 | void version(const char *prgname) 47 | { 48 | fprintf(stderr, 49 | "%s %s\n" 50 | "Copyright 2009 Intel Corporation.\n" 51 | "Huang Ying \n" 52 | "\n" 53 | "This program is free software; you can redistribute it and/or\n" 54 | "modify it under the terms of the GNU General Public License as\n" 55 | "published by the Free Software Foundation; version 2 of the\n" 56 | "License.\n" 57 | , prgname, AER_VERSION); 58 | } 59 | 60 | void init_aer(struct aer_error_inj *aerr) 61 | { 62 | memset(aerr, 0, sizeof(struct aer_error_inj)); 63 | } 64 | 65 | void submit_aer(struct aer_error_inj *err) 66 | { 67 | int fd, ret; 68 | 69 | if (cmdline_flags & CMDLINE_PCI_ID) { 70 | err->domain = aerr_cmdline.domain; 71 | err->bus = aerr_cmdline.bus; 72 | err->dev = aerr_cmdline.dev; 73 | err->fn = aerr_cmdline.fn; 74 | } 75 | fd = open(AER_DEV, O_WRONLY); 76 | ERROR_EXIT_ON(fd <= 0, "Failed to open device file: %s", AER_DEV); 77 | ret = write(fd, err, sizeof(struct aer_error_inj)); 78 | ERROR_EXIT_ON(ret != sizeof(struct aer_error_inj), "Failed to write"); 79 | close(fd); 80 | } 81 | 82 | int parse_options(int argc, char ***argv) 83 | { 84 | int ret; 85 | int c, opt_index; 86 | struct option long_options[] = { 87 | {"version", 0, 0, 'v'}, 88 | {"help", 0, 0, 'h'}, 89 | {"id", 1, 0, 's'}, 90 | {0, 0, 0, 0} 91 | }; 92 | 93 | prg_name = basename(*argv[0]); 94 | 95 | while (1) { 96 | c = getopt_long(argc, *argv, "vhs:", long_options, &opt_index); 97 | if (c == -1) 98 | break; 99 | switch (c) { 100 | case 0: 101 | break; 102 | case 'v': 103 | version(prg_name); 104 | return 1; 105 | case 's': 106 | ret = parse_pci_id(optarg, &aerr_cmdline); 107 | ERROR_EXIT_ON(ret, "Can not parse PCI_ID: %s\n", 108 | optarg); 109 | cmdline_flags |= CMDLINE_PCI_ID; 110 | break; 111 | case 'h': 112 | case '?': 113 | usage(prg_name); 114 | return 1; 115 | default: 116 | usage(prg_name); 117 | break; 118 | } 119 | } 120 | 121 | (*argv) += optind; 122 | return 0; 123 | } 124 | 125 | int main(int argc, char **argv) 126 | { 127 | init_aer(&aerr_cmdline); 128 | if (parse_options(argc, &argv)) 129 | exit(1); 130 | return parse_data(argv); 131 | } 132 | -------------------------------------------------------------------------------- /aer.lex: -------------------------------------------------------------------------------- 1 | /* 2 | * Scanner for the PCIE-AER grammar. 3 | * 4 | * Copyright (c) 2009 by Intel Corp. 5 | * Author: Huang Ying 6 | * 7 | * Based on mce.lex of mce-inject, which is written by Andi Kleen 8 | * . 9 | * 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; version 2 of the 13 | * License. 14 | */ 15 | 16 | %{ 17 | #define _GNU_SOURCE 1 18 | #include 19 | #include 20 | 21 | #include "aer.h" 22 | #include "aer.tab.h" 23 | #include "util.h" 24 | 25 | int yylineno; 26 | 27 | static int lookup_symbol(const char *); 28 | %} 29 | 30 | %option nounput 31 | 32 | HEXC [0-9a-fA-F] 33 | 34 | %% 35 | 36 | #.*\n /* comment */; 37 | \n ++yylineno; 38 | ({HEXC}{4}:)?{HEXC}{2}:{HEXC}{2}\.{HEXC} { yylval.str = strdup(yytext); return PCI_ID_STR; } 39 | 0x{HEXC}+ | 40 | 0[0-7]+ | 41 | [0-9]+ yylval.num = strtoull(yytext, NULL, 0); return NUMBER; 42 | [:{}<>] return yytext[0]; 43 | [_a-zA-Z][_a-zA-Z0-9]* return lookup_symbol(yytext); 44 | [ \t]+ /* white space */; 45 | . yyerror("Unrecognized character '%s'", yytext); 46 | 47 | %% 48 | 49 | /* Keyword handling */ 50 | 51 | static struct key { 52 | const char *name; 53 | int tok; 54 | int32_t val; 55 | } keys[] = { 56 | #define KEY(x) { #x, x } 57 | #define ALIAS(x, y) { #x, y } 58 | #define KEYVAL(x,v) { #x, x, v } 59 | KEY(AER), 60 | KEY(DOMAIN), 61 | KEY(BUS), 62 | KEY(DEV), 63 | KEY(FN), 64 | KEY(PCI_ID), 65 | ALIAS(ID, PCI_ID), 66 | KEY(UNCOR_STATUS), 67 | ALIAS(UNCOR, UNCOR_STATUS), 68 | ALIAS(UNCORRECTABLE, UNCOR_STATUS), 69 | KEY(COR_STATUS), 70 | ALIAS(COR, COR_STATUS), 71 | ALIAS(CORRECTABLE, COR_STATUS), 72 | KEY(HEADER_LOG), 73 | ALIAS(HL, HEADER_LOG), 74 | KEYVAL(TRAIN,PCI_ERR_UNC_TRAIN), 75 | KEYVAL(DLP, PCI_ERR_UNC_DLP), 76 | KEYVAL(POISON_TLP, PCI_ERR_UNC_POISON_TLP), 77 | KEYVAL(FCP, PCI_ERR_UNC_FCP), 78 | KEYVAL(COMP_TIME, PCI_ERR_UNC_COMP_TIME), 79 | KEYVAL(COMP_ABORT, PCI_ERR_UNC_COMP_ABORT), 80 | KEYVAL(UNX_COMP, PCI_ERR_UNC_UNX_COMP), 81 | KEYVAL(RX_OVER, PCI_ERR_UNC_RX_OVER), 82 | KEYVAL(MALF_TLP, PCI_ERR_UNC_MALF_TLP), 83 | KEYVAL(ECRC, PCI_ERR_UNC_ECRC), 84 | KEYVAL(UNSUP, PCI_ERR_UNC_UNSUP), 85 | KEYVAL(RCVR, PCI_ERR_COR_RCVR), 86 | KEYVAL(BAD_TLP, PCI_ERR_COR_BAD_TLP), 87 | KEYVAL(BAD_DLLP, PCI_ERR_COR_BAD_DLLP), 88 | KEYVAL(REP_ROLL, PCI_ERR_COR_REP_ROLL), 89 | KEYVAL(REP_TIMER, PCI_ERR_COR_REP_TIMER), 90 | }; 91 | 92 | static int cmp_key(const void *av, const void *bv) 93 | { 94 | const struct key *a = av; 95 | const struct key *b = bv; 96 | return strcasecmp(a->name, b->name); 97 | } 98 | 99 | static int lookup_symbol(const char *name) 100 | { 101 | struct key *k; 102 | struct key key; 103 | key.name = name; 104 | k = bsearch(&key, keys, ARRAY_SIZE(keys), sizeof(struct key), cmp_key); 105 | if (k != NULL) { 106 | yylval.num = k->val; 107 | return k->tok; 108 | } 109 | return SYMBOL; 110 | } 111 | 112 | static void init_lex(void) 113 | { 114 | qsort(keys, ARRAY_SIZE(keys), sizeof(struct key), cmp_key); 115 | } 116 | 117 | static char **argv; 118 | char *filename = ""; 119 | 120 | int yywrap(void) 121 | { 122 | if (*argv == NULL) 123 | return 1; 124 | filename = *argv; 125 | yyin = fopen(filename, "r"); 126 | ERROR_EXIT_ON(!yyin, "Can not open: %s", filename); 127 | argv++; 128 | return 0; 129 | } 130 | 131 | int parse_data(char **av) 132 | { 133 | init_lex(); 134 | argv = av; 135 | if (*argv) 136 | yywrap(); 137 | return yyparse(); 138 | } 139 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, caste, color, religion, or sexual 10 | identity and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the overall 26 | community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or advances of 31 | any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email address, 35 | without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | CommunityCodeOfConduct AT intel DOT com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series of 86 | actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or permanent 93 | ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within the 113 | community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.1, available at 119 | [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. 120 | 121 | Community Impact Guidelines were inspired by 122 | [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. 123 | 124 | For answers to common questions about this code of conduct, see the FAQ at 125 | [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at 126 | [https://www.contributor-covenant.org/translations][translations]. 127 | 128 | [homepage]: https://www.contributor-covenant.org 129 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html 130 | [Mozilla CoC]: https://github.com/mozilla/diversity 131 | [FAQ]: https://www.contributor-covenant.org/faq 132 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | --------------------------------------------------------------------------------