cve-backport-v5-dataset / data /kernel-eval.jsonl
anicka's picture
Upload data/kernel-eval.jsonl with huggingface_hub
493667e verified
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2020-14356, CVE-2020-14331, CVE-2020-16166, CVE-2020-10135, CVE-2020-0305, CVE-2020-15780, CVE-2020-10781\n\nThis patch fix a problem that crash cannot open a dumpfile which is\n\n## Package\ncrash\n\n## Files to modify\n- b/symbols.c\n\n## Target Source Code\n\n### symbols.c\n\n#### symname_hash_install() [lines 1131-1160]\n```c\n * Install a single static kernel symbol into the symname_hash.\n */\nstatic void\nsymname_hash_install(struct syment *spn)\n{\n\tstruct syment *sp;\n int index;\n\n index = SYMNAME_HASH_INDEX(spn->name);\n\tspn->cnt = 1;\n\n if ((sp = st->symname_hash[index]) == NULL) \n \tst->symname_hash[index] = spn;\n\telse {\n\t\twhile (sp) {\n\t \tif (STREQ(sp->name, spn->name)) {\n\t \tsp->cnt++;\n\t \tspn->cnt++;\n\t \t}\n\t\t\tif (sp->name_hash_next)\n\t\t\t\tsp = sp->name_hash_next;\n\t\t\telse {\n\t\t\t\tsp->name_hash_next = spn;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/*\n```\n\n\n### Type definitions\n\n```c\n/* from defs.h */\nstruct syment {\n ulong value;\n char *name;\n\tstruct syment *val_hash_next;\n\tstruct syment *name_hash_next;\n\tchar type;\n\tunsigned char cnt;\n\tunsigned char flags;\n\tunsigned char pad2;\n};\n```\n\n\n## Upstream Fix\n```diff\nThis patch fix a problem that crash cannot open a dumpfile which is\ncaptured by sadump in KASLR enabled kernel.\n\nWhen KASLR feature is enabled, a kernel is placed on the memory randomly\nand therefore crash cannot open a dumpfile captured by sadump because\naddresses of kernel symbols in System.map or vmlinux are different from\nactual addresses.\n\nTo solve this problem, we need to calculate kaslr offset(the difference\nbetween original symbol address and actual address) and phys_base, and\nadjust symbol table of crash. In the case of dumpfile of kdump, these\ninformation is included in the header, but dumpfile of sadump does not\nhave such a information.\n\nThis patch calculate kaslr offset and phys_base to solve this problem.\nPlease see the comment in the calc_kaslr_offset() for the detail idea.\nThe basic idea is getting register (IDTR and CR3) from dump header, and\ncalculate kaslr_offset/phys_base using them.\n\nSigned-off-by: Takao Indoh <indou.takao@jp.fujitsu.com>\n---\n symbols.c | 3 +++\n 1 file changed, 3 insertions(+)\n\nIndex: b/symbols.c\n===================================================================\n--- a/symbols.c\n+++ b/symbols.c\n@@ -1156,6 +1156,9 @@ symname_hash_install(struct syment *spn)\n \t\t\t}\n \t\t}\n \t}\n+\n+\tif (SADUMP_DUMPFILE())\n+\t\tkt->flags2 |= KASLR_CHECK;\n }\n \n /*\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "This patch fix a problem that crash cannot open a dumpfile which is\ncaptured by sadump in KASLR enabled kernel.\n\nWhen KASLR feature is enabled, a kernel is placed on the memory randomly\nand therefore crash cannot open a dumpfile captured by sadump because\naddresses of kernel symbols in System.map or vmlinux are different from\nactual addresses.\n\nTo solve this problem, we need to calculate kaslr offset(the difference\nbetween original symbol address and actual address) and phys_base, and\nadjust symbol table of crash. In the case of dumpfile of kdump, these\ninformation is included in the header, but dumpfile of sadump does not\nhave such a information.\n\nThis patch calculate kaslr offset and phys_base to solve this problem.\nPlease see the comment in the calc_kaslr_offset() for the detail idea.\nThe basic idea is getting register (IDTR and CR3) from dump header, and\ncalculate kaslr_offset/phys_base using them.\n\nSigned-off-by: Takao Indoh <indou.takao@jp.fujitsu.com>\n---\n symbols.c | 3 +++\n 1 file changed, 3 insertions(+)\n\nIndex: b/symbols.c\n===================================================================\n--- a/symbols.c\n+++ b/symbols.c\n@@ -1156,6 +1156,9 @@ symname_hash_install(struct syment *spn)\n \t\t\t}\n \t\t}\n \t}\n+\n+\tif (SADUMP_DUMPFILE())\n+\t\tkt->flags2 |= KASLR_CHECK;\n }\n \n /*\n"}], "metadata": {"id": "crash-13737-crash-allow-use-of-sadump-captured-KASLR-kernel.patch", "cve_id": "CVE-2020-14356", "cves": ["CVE-2020-0305", "CVE-2020-10135", "CVE-2020-10781", "CVE-2020-14331", "CVE-2020-14356", "CVE-2020-15780", "CVE-2020-16166"], "package": "crash", "incident_id": 13737, "patch_name": "crash-allow-use-of-sadump-captured-KASLR-kernel.patch", "tier": "identical", "language": "c", "patch_lines_changed": 3, "patch_files_count": 1, "total_tokens_est": 800, "has_source_context": true, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2020-14356, CVE-2020-14331, CVE-2020-16166, CVE-2020-10135, CVE-2020-0305, CVE-2020-15780, CVE-2020-10781\n\nFrom: Petr Tesarik <ptesarik@suse.cz>\n\n## Package\ncrash\n\n## Files to modify\n- symbols.c\n\n## Target Source Code\n\n### symbols.c\n\n#### symtab_init() [lines 161-255]\n```c\n * sorts, and stores, them in a static table for quick reference.\n */\nvoid\nsymtab_init(void)\n{\n\tchar **matching;\n \tlong symcount;\n \tvoid *minisyms;\n \tunsigned int size;\n\tasymbol *sort_x;\n\tasymbol *sort_y;\n\n \tif ((st->bfd = bfd_openr(pc->namelist, NULL)) == NULL) \n\t\terror(FATAL, \"cannot open object file: %s\\n\", pc->namelist);\n\n \tif (!bfd_check_format_matches(st->bfd, bfd_object, &matching))\n\t\terror(FATAL, \"cannot determine object file format: %s\\n\",\n\t\t\tpc->namelist);\n\t/*\n\t * Check whether the namelist is a kerntypes file built by\n\t * dwarfextract, which places a magic number in e_version.\n\t */\n\tif (file_elf_version(pc->namelist) == EV_DWARFEXTRACT)\n\t\tpc->flags |= KERNTYPES;\n\n\tif (pc->flags & SYSMAP) {\n\t\tbfd_map_over_sections(st->bfd, section_header_info, \n\t\t\tVERIFY_SECTIONS);\n\t\tif ((st->flags & (NO_SEC_LOAD|NO_SEC_CONTENTS)) ==\n\t\t (NO_SEC_LOAD|NO_SEC_CONTENTS)) {\n\t\t\terror(INFO, \"%s: no text and data contents\\n\",\n\t\t\t\tpc->namelist);\n\t\t\terror(FATAL, pc->flags & SYSMAP_ARG ? \n\t\t\t\tDEBUGINFO_ERROR_MESSAGE1 :\n\t\t\t\tDEBUGINFO_ERROR_MESSAGE2);\n\t\t}\n\t\tstore_sysmap_symbols();\n\t\treturn;\n\t} else if (LKCD_KERNTYPES())\n\t\terror(FATAL, \"%s: use of kerntypes requires a system map\\n\",\n\t\t\tpc->namelist);\n\n\t/*\n\t * Pull a bait-and-switch on st->bfd if we've got a separate\n * .gnu_debuglink file that matches the CRC. Not done for kerntypes.\n\t */\n\tif (!(LKCD_KERNTYPES()) &&\n\t !(bfd_get_file_flags(st->bfd) & HAS_SYMS)) {\n\t\tif (!check_gnu_debuglink(st->bfd))\n\t\t\tno_debugging_data(FATAL);\n\t}\n\t\n\t/*\n\t * Gather references to the kernel sections.\n\t */\n if ((st->sections = (struct sec *)\n malloc(st->bfd->section_count * sizeof(struct sec *))) == NULL)\n error(FATAL, \"symbol table section array malloc: %s\\n\",\n strerror(errno));\n\tBZERO(st->sections, st->bfd->section_count * sizeof(struct sec *));\n\tst->first_section_start = st->last_section_end = 0;\n\n\tbfd_map_over_sections(st->bfd, section_header_info, KERNEL_SECTIONS);\n\tif ((st->flags & (NO_SEC_LOAD|NO_SEC_CONTENTS)) ==\n\t (NO_SEC_LOAD|NO_SEC_CONTENTS)) {\n\t\tif (!pc->namelist_debug && !pc->debuginfo_file) {\n\t\t\terror(INFO, \"%s: no text and data contents\\n\",\n\t\t\t\tpc->namelist);\n\t\t\terror(FATAL, DEBUGINFO_ERROR_MESSAGE2);\n\t\t}\n\t}\n\n\tsymcount = bfd_read_minisymbols(st->bfd, FALSE, &minisyms, &size);\n\n\tif (symcount <= 0)\n\t\tno_debugging_data(FATAL);\n\n\tsort_x = bfd_make_empty_symbol(st->bfd);\n\tsort_y = bfd_make_empty_symbol(st->bfd);\n\tif (sort_x == NULL || sort_y == NULL)\n\t\terror(FATAL, \"bfd_make_empty_symbol() failed\\n\");\n\n\tkaslr_init();\n\n\tgnu_qsort(st->bfd, minisyms, symcount, size, sort_x, sort_y);\n\n\tstore_symbols(st->bfd, FALSE, minisyms, symcount, size);\n\n\tfree(minisyms);\n\n\tsymname_hash_init();\n\tsymval_hash_init();\n} \n\n/*\n```\n\n#### check_gnu_debuglink() [lines 206-232]\n```c\n\t */\n\tif (!(LKCD_KERNTYPES()) &&\n\t !(bfd_get_file_flags(st->bfd) & HAS_SYMS)) {\n\t\tif (!check_gnu_debuglink(st->bfd))\n\t\t\tno_debugging_data(FATAL);\n\t}\n\t\n\t/*\n\t * Gather references to the kernel sections.\n\t */\n if ((st->sections = (struct sec *)\n malloc(st->bfd->section_count * sizeof(struct sec *))) == NULL)\n error(FATAL, \"symbol table section array malloc: %s\\n\",\n strerror(errno));\n\tBZERO(st->sections, st->bfd->section_count * sizeof(struct sec *));\n\tst->first_section_start = st->last_section_end = 0;\n\n\tbfd_map_over_sections(st->bfd, section_header_info, KERNEL_SECTIONS);\n\tif ((st->flags & (NO_SEC_LOAD|NO_SEC_CONTENTS)) ==\n\t (NO_SEC_LOAD|NO_SEC_CONTENTS)) {\n\t\tif (!pc->namelist_debug && !pc->debuginfo_file) {\n\t\t\terror(INFO, \"%s: no text and data contents\\n\",\n\t\t\t\tpc->namelist);\n\t\t\terror(FATAL, DEBUGINFO_ERROR_MESSAGE2);\n\t\t}\n\t}\n\n```\n\n\n## Upstream Fix\n```diff\nFrom: Petr Tesarik <ptesarik@suse.cz>\nSubject: Search debuginfo files in the original directory\nReferences: bnc#723639\n\nIf debuginfo is in a separate file and the kernel image is compressed,\nthen it should be found in the same directory as the original (compressed)\nimage, not in the directory with the uncompressed image (TMPDIR).\n\nSigned-off-by: Petr Tesarik <ptesarik@suse.cz>\n\n---\n symbols.c | 17 ++++++++++-------\n 1 file changed, 10 insertions(+), 7 deletions(-)\n\nIndex: crash-7.2.7/symbols.c\n===================================================================\n--- crash-7.2.7.orig/symbols.c\n+++ crash-7.2.7/symbols.c\n@@ -203,9 +203,9 @@ symtab_init(void)\n \t * Pull a bait-and-switch on st->bfd if we've got a separate\n * .gnu_debuglink file that matches the CRC. Not done for kerntypes.\n \t */\n-\tif (!(LKCD_KERNTYPES()) &&\n-\t !(bfd_get_file_flags(st->bfd) & HAS_SYMS)) {\n-\t\tif (!check_gnu_debuglink(st->bfd))\n+\tif (!(LKCD_KERNTYPES())) {\n+\t\tif (!check_gnu_debuglink(st->bfd) &&\n+\t\t !(bfd_get_file_flags(st->bfd) & HAS_SYMS))\n \t\t\tno_debugging_data(FATAL);\n \t}\n \t\n@@ -267,13 +267,16 @@ check_gnu_debuglink(bfd *bfd)\n \tchar *contents;\n \tint crc_offset;\t\n \tunsigned long crc32;\n+\tchar *namelist;\n \tchar *dirname;\n \tchar *namelist_debug;\n char **matching;\n \n+\tnamelist = pc->namelist_orig ? pc->namelist_orig : pc->namelist;\n+\n sect = bfd_get_section_by_name(bfd, \".gnu_debuglink\");\n \tif (!sect) {\n-\t\terror(INFO, \"%s: no .gnu_debuglink section\\n\", pc->namelist);\n+\t\terror(INFO, \"%s: no .gnu_debuglink section\\n\", namelist);\n \t\treturn FALSE;\n \t}\n \n@@ -294,14 +297,14 @@ check_gnu_debuglink(bfd *bfd)\n \t\t\tcontents, crc32);\n \n \tif ((pc->debuginfo_file = (char *)\n-\t malloc(((strlen(pc->namelist) + strlen(\"/.debug/\") +\n+\t malloc(((strlen(namelist) + strlen(\"/.debug/\") +\n \t + strlen(\".debug\") + strlen(\" /usr/lib/debug/boot/ \"))*10)\n \t + strlen(pc->namelist_debug ? pc->namelist_debug : \" \"))) == NULL)\n \t\terror(FATAL, \"debuginfo file name malloc: %s\\n\", \n \t\t\tstrerror(errno));\n \n-\tdirname = GETBUF(strlen(pc->namelist)+1);\n-\tstrcpy(dirname, pc->namelist);\n+\tdirname = GETBUF(strlen(namelist)+1);\n+\tstrcpy(dirname, namelist);\n \n \tfor (i = strlen(dirname)-1; i >= 0; i--)\n \t{\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "From: Petr Tesarik <ptesarik@suse.cz>\nSubject: Search debuginfo files in the original directory\nReferences: bnc#723639\n\nIf debuginfo is in a separate file and the kernel image is compressed,\nthen it should be found in the same directory as the original (compressed)\nimage, not in the directory with the uncompressed image (TMPDIR).\n\nSigned-off-by: Petr Tesarik <ptesarik@suse.cz>\n\n---\n symbols.c | 17 ++++++++++-------\n 1 file changed, 10 insertions(+), 7 deletions(-)\n\nIndex: crash-7.2.7/symbols.c\n===================================================================\n--- crash-7.2.7.orig/symbols.c\n+++ crash-7.2.7/symbols.c\n@@ -203,9 +203,9 @@ symtab_init(void)\n \t * Pull a bait-and-switch on st->bfd if we've got a separate\n * .gnu_debuglink file that matches the CRC. Not done for kerntypes.\n \t */\n-\tif (!(LKCD_KERNTYPES()) &&\n-\t !(bfd_get_file_flags(st->bfd) & HAS_SYMS)) {\n-\t\tif (!check_gnu_debuglink(st->bfd))\n+\tif (!(LKCD_KERNTYPES())) {\n+\t\tif (!check_gnu_debuglink(st->bfd) &&\n+\t\t !(bfd_get_file_flags(st->bfd) & HAS_SYMS))\n \t\t\tno_debugging_data(FATAL);\n \t}\n \t\n@@ -267,13 +267,16 @@ check_gnu_debuglink(bfd *bfd)\n \tchar *contents;\n \tint crc_offset;\t\n \tunsigned long crc32;\n+\tchar *namelist;\n \tchar *dirname;\n \tchar *namelist_debug;\n char **matching;\n \n+\tnamelist = pc->namelist_orig ? pc->namelist_orig : pc->namelist;\n+\n sect = bfd_get_section_by_name(bfd, \".gnu_debuglink\");\n \tif (!sect) {\n-\t\terror(INFO, \"%s: no .gnu_debuglink section\\n\", pc->namelist);\n+\t\terror(INFO, \"%s: no .gnu_debuglink section\\n\", namelist);\n \t\treturn FALSE;\n \t}\n \n@@ -294,14 +297,14 @@ check_gnu_debuglink(bfd *bfd)\n \t\t\tcontents, crc32);\n \n \tif ((pc->debuginfo_file = (char *)\n-\t malloc(((strlen(pc->namelist) + strlen(\"/.debug/\") +\n+\t malloc(((strlen(namelist) + strlen(\"/.debug/\") +\n \t + strlen(\".debug\") + strlen(\" /usr/lib/debug/boot/ \"))*10)\n \t + strlen(pc->namelist_debug ? pc->namelist_debug : \" \"))) == NULL)\n \t\terror(FATAL, \"debuginfo file name malloc: %s\\n\", \n \t\t\tstrerror(errno));\n \n-\tdirname = GETBUF(strlen(pc->namelist)+1);\n-\tstrcpy(dirname, pc->namelist);\n+\tdirname = GETBUF(strlen(namelist)+1);\n+\tstrcpy(dirname, namelist);\n \n \tfor (i = strlen(dirname)-1; i >= 0; i--)\n \t{\n"}], "metadata": {"id": "crash-13737-crash-debuginfo-compressed.patch", "cve_id": "CVE-2020-14356", "cves": ["CVE-2020-0305", "CVE-2020-10135", "CVE-2020-10781", "CVE-2020-14331", "CVE-2020-14356", "CVE-2020-15780", "CVE-2020-16166"], "package": "crash", "incident_id": 13737, "patch_name": "crash-debuginfo-compressed.patch", "tier": "identical", "language": "c", "patch_lines_changed": 17, "patch_files_count": 1, "total_tokens_est": 1258, "has_source_context": true, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2020-14356, CVE-2020-14331, CVE-2020-16166, CVE-2020-10135, CVE-2020-0305, CVE-2020-15780, CVE-2020-10781\n\nFrom: Luc Chouinard <lchouinard@lchouinard-desktop.englab.juniper.net>\n\n## Package\ncrash\n\n## Files to modify\n- extensions/eppic/applications/crash/eppic.c\n\n## Target Source Code\n\n### eppic/applications/crash/eppic.c\n\n#### _init() [lines 984-5]\n```c\n\n```\n\n\n## Upstream Fix\n```diff\nFrom: Luc Chouinard <lchouinard@lchouinard-desktop.englab.juniper.net>\nDate: Thu Jun 19 12:28:40 2014 -0700\nSubject: Support for ARM64\nReferences: FATE#320844\nPatch-mainline: yes\nGit-commit: 5391d3dd0e6710c22ec5801f99a6788a2e4b132a\n\nAcked-by: Petr Tesarik <ptesarik@suse.com>\n\n---\n extensions/eppic/applications/crash/eppic.c | 4 ++++\n 1 file changed, 4 insertions(+)\n\n--- a/extensions/eppic/applications/crash/eppic.c\n+++ b/extensions/eppic/applications/crash/eppic.c\n@@ -1033,10 +1033,14 @@ _init() /* Register the command set. */\n #ifdef PPC64\n #define EPPIC_ABI ABI_PPC64\n #else\n+#ifdef ARM64\n+#define EPPIC_ABI ABI_ARM64\n+#else\n #error eppic: Unkown ABI \n #endif\n #endif\n #endif\n+#endif\n #endif\n #endif\n #endif\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "From: Luc Chouinard <lchouinard@lchouinard-desktop.englab.juniper.net>\nDate: Thu Jun 19 12:28:40 2014 -0700\nSubject: Support for ARM64\nReferences: FATE#320844\nPatch-mainline: yes\nGit-commit: 5391d3dd0e6710c22ec5801f99a6788a2e4b132a\n\nAcked-by: Petr Tesarik <ptesarik@suse.com>\n\n---\n extensions/eppic/applications/crash/eppic.c | 4 ++++\n 1 file changed, 4 insertions(+)\n\n--- a/extensions/eppic/applications/crash/eppic.c\n+++ b/extensions/eppic/applications/crash/eppic.c\n@@ -1033,10 +1033,14 @@ _init() /* Register the command set. */\n #ifdef PPC64\n #define EPPIC_ABI ABI_PPC64\n #else\n+#ifdef ARM64\n+#define EPPIC_ABI ABI_ARM64\n+#else\n #error eppic: Unkown ABI \n #endif\n #endif\n #endif\n+#endif\n #endif\n #endif\n #endif\n"}], "metadata": {"id": "crash-13737-eppic-support-arm64.patch", "cve_id": "CVE-2020-14356", "cves": ["CVE-2020-0305", "CVE-2020-10135", "CVE-2020-10781", "CVE-2020-14331", "CVE-2020-14356", "CVE-2020-15780", "CVE-2020-16166"], "package": "crash", "incident_id": 13737, "patch_name": "eppic-support-arm64.patch", "tier": "identical", "language": "c", "patch_lines_changed": 4, "patch_files_count": 0, "total_tokens_est": 521, "has_source_context": true, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2020-14356, CVE-2020-14331, CVE-2020-16166, CVE-2020-10135, CVE-2020-0305, CVE-2020-15780, CVE-2020-10781\n\nFrom: David Mair <dmair@suse.com>\n\n## Package\ncrash\n\n## Files to modify\n- memory.c\n\n## Upstream Fix\n```diff\nFrom: David Mair <dmair@suse.com>\nDate: 2017-05-25 10:27:21 -0600\nSubject: Avoid printing a read error for a failed read that can be retried\nReferences: bnc#1038839\nUpstream: tbd\n\nWhen reading a memory image fails it may not be an error if it is still\npossible to switch image and retry the read. Fix the error message output\nto only occur if no retries are intended.\n\n---\n\nIndex: crash-7.2.8/memory.c\n===================================================================\n--- crash-7.2.8.orig/memory.c\n+++ crash-7.2.8/memory.c\n@@ -2320,8 +2320,6 @@ readmem(ulonglong addr, int memtype, voi\n goto readmem_error;\n \n \t\tcase READ_ERROR:\n-\t\t\tif (PRINT_ERROR_MESSAGE)\n-\t\t\t\terror(INFO, READ_ERRMSG, memtype_string(memtype, 0), addr, type);\n \t\t\tif ((pc->flags & DEVMEM) && (kt->flags & PRE_KERNEL_INIT) &&\n \t\t\t !(error_handle & NO_DEVMEM_SWITCH) && devmem_is_restricted() && \n \t\t\t switch_to_proc_kcore()) {\n@@ -2329,6 +2327,8 @@ readmem(ulonglong addr, int memtype, voi\n \t\t\t\treturn(readmem(addr, memtype, bufptr, size,\n \t\t\t\t\ttype, error_handle));\n \t\t\t}\n+\t\t\tif (PRINT_ERROR_MESSAGE)\n+\t\t\t\terror(INFO, READ_ERRMSG, memtype_string(memtype, 0), addr, type);\n \t\t\tgoto readmem_error;\n \n \t\tcase PAGE_EXCLUDED:\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "From: David Mair <dmair@suse.com>\nDate: 2017-05-25 10:27:21 -0600\nSubject: Avoid printing a read error for a failed read that can be retried\nReferences: bnc#1038839\nUpstream: tbd\n\nWhen reading a memory image fails it may not be an error if it is still\npossible to switch image and retry the read. Fix the error message output\nto only occur if no retries are intended.\n\n---\n\nIndex: crash-7.2.8/memory.c\n===================================================================\n--- crash-7.2.8.orig/memory.c\n+++ crash-7.2.8/memory.c\n@@ -2320,8 +2320,6 @@ readmem(ulonglong addr, int memtype, voi\n goto readmem_error;\n \n \t\tcase READ_ERROR:\n-\t\t\tif (PRINT_ERROR_MESSAGE)\n-\t\t\t\terror(INFO, READ_ERRMSG, memtype_string(memtype, 0), addr, type);\n \t\t\tif ((pc->flags & DEVMEM) && (kt->flags & PRE_KERNEL_INIT) &&\n \t\t\t !(error_handle & NO_DEVMEM_SWITCH) && devmem_is_restricted() && \n \t\t\t switch_to_proc_kcore()) {\n@@ -2329,6 +2327,8 @@ readmem(ulonglong addr, int memtype, voi\n \t\t\t\treturn(readmem(addr, memtype, bufptr, size,\n \t\t\t\t\ttype, error_handle));\n \t\t\t}\n+\t\t\tif (PRINT_ERROR_MESSAGE)\n+\t\t\t\terror(INFO, READ_ERRMSG, memtype_string(memtype, 0), addr, type);\n \t\t\tgoto readmem_error;\n \n \t\tcase PAGE_EXCLUDED:\n"}], "metadata": {"id": "crash-13737-crash-stop_read_error_when_intent_is_retry.patch", "cve_id": "CVE-2020-14356", "cves": ["CVE-2020-0305", "CVE-2020-10135", "CVE-2020-10781", "CVE-2020-14331", "CVE-2020-14356", "CVE-2020-15780", "CVE-2020-16166"], "package": "crash", "incident_id": 13737, "patch_name": "crash-stop_read_error_when_intent_is_retry.patch", "tier": "identical", "language": "c", "patch_lines_changed": 4, "patch_files_count": 1, "total_tokens_est": 754, "has_source_context": false, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2020-14356, CVE-2020-14331, CVE-2020-16166, CVE-2020-10135, CVE-2020-0305, CVE-2020-15780, CVE-2020-10781\n\nFix for reading compressed kdump dumpfiles from systems with\n\n## Package\ncrash\n\n## Files to modify\n- diskdump.c\n\n## Target Source Code\n\n### diskdump.c\n\n#### clean_diskdump_data() [lines 216-235]\n```c\n}\n\nstatic void \nclean_diskdump_data(void)\n{\n\tint i;\n\n\tif (dd_list == NULL)\n\t\treturn;\n\n\tfor (i=1; i<num_dumpfiles; i++)\n\t\tfree(dd_list[i]); /* NOTE: dd_list[0] is static dd */\n\n\tfree(dd_list);\n\tdd_list = NULL;\n\tnum_dumpfiles = 0;\n\tdd = &diskdump_data;\n}\n\nstatic inline int \n```\n\n#### region() [lines 645-752]\n```c\n\t\t\t\terror(INFO, \"diskdump: cannot lseek dump sub header\\n\");\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t\tif (read(dd->dfd, sub_header, block_size) < block_size) {\n\t\t\t\terror(INFO, \"diskdump: cannot read dump sub header\\n\");\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\t\tdd->sub_header = sub_header;\n\n\t\t/* the 64bit max_mapnr only exists in sub-header of compressed\n\t\t * kdump file, if it's not a compressed kdump file, we have to\n\t\t * use the old 32bit max_mapnr in dumpfile header.\n\t\t * max_mapnr may be truncated here.\n\t\t */\n\t\tdd->max_mapnr = header->max_mapnr;\n\t} else if (KDUMP_CMPRS_VALID()) {\n\t\tif ((sub_header_kdump = malloc(block_size)) == NULL)\n\t\t\terror(FATAL, \"compressed kdump: cannot malloc sub_header_kdump buffer\\n\");\n\n\t\tif (FLAT_FORMAT()) {\n\t\t\tif (!read_flattened_format(dd->dfd, offset, sub_header_kdump, block_size)) {\n\t\t\t\terror(INFO, \"compressed kdump: cannot read dump sub header\\n\");\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t} else {\n\t\t\tif (lseek(dd->dfd, offset, SEEK_SET) == failed) {\n\t\t\t\terror(INFO, \"compressed kdump: cannot lseek dump sub header\\n\");\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t\tif (read(dd->dfd, sub_header_kdump, block_size) < block_size) {\n\t\t\t\terror(INFO, \"compressed kdump: cannot read dump sub header\\n\");\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\t\tdd->sub_header_kdump = sub_header_kdump;\n\n#if defined(__i386__) && (defined(ARM) || defined(MIPS))\n\t\tarm_kdump_header_adjust(header->header_version);\n#endif\n\t\t/* use 64bit max_mapnr in compressed kdump file sub-header */\n\t\tif (header->header_version >= 6)\n\t\t\tdd->max_mapnr = dd->sub_header_kdump->max_mapnr_64;\n\t\telse {\n\t\t\tdd->sub_header_kdump->start_pfn_64\n\t\t\t\t= dd->sub_header_kdump->start_pfn;\n\t\t\tdd->sub_header_kdump->end_pfn_64\n\t\t\t\t= dd->sub_header_kdump->end_pfn;\n\t\t}\n\t}\n\n\tif (header->header_version < 6)\n\t\tdd->max_mapnr = header->max_mapnr;\n\n\t/* read memory bitmap */\n\tbitmap_len = (off_t)block_size * header->bitmap_blocks;\n\tdd->bitmap_len = bitmap_len;\n\n\toffset = (off_t)block_size * (1 + header->sub_hdr_size);\n\n\tif ((dd->bitmap = malloc(bitmap_len)) == NULL)\n\t\terror(FATAL, \"%s: cannot malloc bitmap buffer\\n\",\n\t\t\tDISKDUMP_VALID() ? \"diskdump\" : \"compressed kdump\");\n\n\tdd->dumpable_bitmap = calloc(bitmap_len, 1);\n\n\tif (CRASHDEBUG(8))\n\t\tfprintf(fp, \"%s: memory bitmap offset: %llx\\n\",\n\t\t\tDISKDUMP_VALID() ? \"diskdump\" : \"compressed kdump\",\n\t\t\t(ulonglong)offset);\n\n\tif (FLAT_FORMAT()) {\n\t\tif (!read_flattened_format(dd->dfd, offset, dd->bitmap, bitmap_len)) {\n\t\t\terror(INFO, \"%s: cannot read memory bitmap\\n\",\n\t\t\t\tDISKDUMP_VALID() ? \"diskdump\" : \"compressed kdump\");\n\t\t\tgoto err;\n\t\t}\n\t} else {\n\t\tif (lseek(dd->dfd, offset, SEEK_SET) == failed) {\n\t\t\terror(INFO, \"%s: cannot lseek memory bitmap\\n\",\n\t\t\t\tDISKDUMP_VALID() ? \"diskdump\" : \"compressed kdump\");\n\t\t\tgoto err;\n\t\t}\n\t\tbufptr = dd->bitmap;\n\t\tlen = bitmap_len;\n\t\twhile (len) {\n\t\t\tbytes_read = read(dd->dfd, bufptr, len);\n\t\t\tif (bytes_read <= 0) {\n\t\t\t\terror(INFO, \"%s: cannot read memory bitmap\\n\",\n\t\t\t\t\tDISKDUMP_VALID() ? \"diskdump\"\n\t\t\t\t\t: \"compressed kdump\");\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t\tlen -= bytes_read;\n\t\t\tbufptr += bytes_read;\n\t\t}\n\t}\n\n\tif (dump_is_partial(header))\n\t\tmemcpy(dd->dumpable_bitmap, dd->bitmap + bitmap_len/2,\n\t\t bitmap_len/2);\n\telse\n\t\tmemcpy(dd->dumpable_bitmap, dd->bitmap, bitmap_len);\n\n\tdd->data_offset\n\t\t= (1UL + header->sub_hdr_size + header->bitmap_blocks)\n\t\t* header->block_size;\n\n```\n\n#### region() [lines 695-802]\n```c\n\n\tif (header->header_version < 6)\n\t\tdd->max_mapnr = header->max_mapnr;\n\n\t/* read memory bitmap */\n\tbitmap_len = (off_t)block_size * header->bitmap_blocks;\n\tdd->bitmap_len = bitmap_len;\n\n\toffset = (off_t)block_size * (1 + header->sub_hdr_size);\n\n\tif ((dd->bitmap = malloc(bitmap_len)) == NULL)\n\t\terror(FATAL, \"%s: cannot malloc bitmap buffer\\n\",\n\t\t\tDISKDUMP_VALID() ? \"diskdump\" : \"compressed kdump\");\n\n\tdd->dumpable_bitmap = calloc(bitmap_len, 1);\n\n\tif (CRASHDEBUG(8))\n\t\tfprintf(fp, \"%s: memory bitmap offset: %llx\\n\",\n\t\t\tDISKDUMP_VALID() ? \"diskdump\" : \"compressed kdump\",\n\t\t\t(ulonglong)offset);\n\n\tif (FLAT_FORMAT()) {\n\t\tif (!read_flattened_format(dd->dfd, offset, dd->bitmap, bitmap_len)) {\n\t\t\terror(INFO, \"%s: cannot read memory bitmap\\n\",\n\t\t\t\tDISKDUMP_VALID() ? \"diskdump\" : \"compressed kdump\");\n\t\t\tgoto err;\n\t\t}\n\t} else {\n\t\tif (lseek(dd->dfd, offset, SEEK_SET) == failed) {\n\t\t\terror(INFO, \"%s: cannot lseek memory bitmap\\n\",\n\t\t\t\tDISKDUMP_VALID() ? \"diskdump\" : \"compressed kdump\");\n\t\t\tgoto err;\n\t\t}\n\t\tbufptr = dd->bitmap;\n\t\tlen = bitmap_len;\n\t\twhile (len) {\n\t\t\tbytes_read = read(dd->dfd, bufptr, len);\n\t\t\tif (bytes_read <= 0) {\n\t\t\t\terror(INFO, \"%s: cannot read memory bitmap\\n\",\n\t\t\t\t\tDISKDUMP_VALID() ? \"diskdump\"\n\t\t\t\t\t: \"compressed kdump\");\n\t\t\t\tgoto err;\n\t\t\t}\n\t\t\tlen -= bytes_read;\n\t\t\tbufptr += bytes_read;\n\t\t}\n\t}\n\n\tif (dump_is_partial(header))\n\t\tmemcpy(dd->dumpable_bitmap, dd->bitmap + bitmap_len/2,\n\t\t bitmap_len/2);\n\telse\n\t\tmemcpy(dd->dumpable_bitmap, dd->bitmap, bitmap_len);\n\n\tdd->data_offset\n\t\t= (1UL + header->sub_hdr_size + header->bitmap_blocks)\n\t\t* header->block_size;\n\n\tdd->header = header;\n\n\tif (machine_type(\"ARM\"))\n\t\tdd->machine_type = EM_ARM;\n\telse if (machine_type(\"MIPS\") || machine_type(\"MIPS64\"))\n\t\tdd->machine_type = EM_MIPS;\n\telse if (machine_type(\"X86\"))\n\t\tdd->machine_type = EM_386;\n\telse if (machine_type(\"X86_64\"))\n\t\tdd->machine_type = EM_X86_64;\n\telse if (machine_type(\"IA64\"))\n\t\tdd->machine_type = EM_IA_64;\n\telse if (machine_type(\"PPC\"))\n\t\tdd->machine_type = EM_PPC;\n\telse if (machine_type(\"PPC64\"))\n\t\tdd->machine_type = EM_PPC64;\n\telse if (machine_type(\"S390X\"))\n\t\tdd->machine_type = EM_S390;\n\telse if (machine_type(\"ARM64\"))\n\t\tdd->machine_type = EM_AARCH64;\n\telse if (machine_type(\"SPARC64\"))\n\t\tdd->machine_type = EM_SPARCV9;\n\telse {\n\t\terror(INFO, \"%s: unsupported machine type: %s\\n\", \n\t\t\tDISKDUMP_VALID() ? \"diskdump\" : \"compressed kdump\",\n\t\t\tMACHINE_TYPE);\n\t\tgoto err;\n\t}\n\n\t/* process elf notes data */\n\tif (KDUMP_CMPRS_VALID() && !(dd->flags & NO_ELF_NOTES) &&\n\t\t(dd->header->header_version >= 4) &&\n\t\t(sub_header_kdump->offset_note) &&\n\t\t(sub_header_kdump->size_note) && (machdep->process_elf_notes)) {\n\t\tsize = sub_header_kdump->size_note;\n\t\toffset = sub_header_kdump->offset_note;\n\n\t\tif ((dd->notes_buf = malloc(size)) == NULL)\n\t\t\terror(FATAL, \"compressed kdump: cannot malloc notes\"\n\t\t\t\t\" buffer\\n\");\n\n\t\tif ((dd->nt_prstatus_percpu = malloc(NR_CPUS * sizeof(void *))) == NULL)\n\t\t\terror(FATAL, \"compressed kdump: cannot malloc pointer\"\n\t\t\t\t\" to NT_PRSTATUS notes\\n\");\n\n\t\tif ((dd->nt_qemu_percpu = malloc(NR_CPUS * sizeof(void *))) == NULL)\n\t\t\terror(FATAL, \"qemu mem dump compressed: cannot malloc pointer\"\n\t\t\t\t\" to QEMU notes\\n\");\n\n\t\tif ((dd->nt_qemucs_percpu = malloc(NR_CPUS * sizeof(void *))) == NULL)\n```\n\n\n## Upstream Fix\n```diff\nFrom b80b16549e24769c7d5fe3a10c4b1a1c4b5161f3 Mon Sep 17 00:00:00 2001\nFrom: Dave Anderson <anderson@redhat.com>\nDate: Mon, 23 Mar 2020 15:52:11 -0400\nSubject: [PATCH] Fix for reading compressed kdump dumpfiles from systems with\n physical memory located at extraordinarily high addresses. In a system with\n a physical address range from 0x602770ecf000 to 0x6027ffffffff, the crash\n utility fails during session initialization due to an integer overflow,\n ending with the error message \"crash: vmlinux and vmcore do not match!\".\n (chenjialong@huawei.com)\n\nReferences: bsc#1168233 ltc#184660\nUpstream: merged\nGit-commit: b80b16549e24769c7d5fe3a10c4b1a1c4b5161f3\n\n---\n diskdump.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/diskdump.c b/diskdump.c\nindex e88243e616cc..328c932dad5a 100644\n--- a/diskdump.c\n+++ b/diskdump.c\n@@ -233,7 +233,7 @@ clean_diskdump_data(void)\n }\n \n static inline int \n-get_bit(char *map, int byte, int bit)\n+get_bit(char *map, unsigned long byte, int bit)\n {\n \treturn map[byte] & (1<<bit);\n }\n@@ -694,7 +694,7 @@ restart:\n \t\tdd->max_mapnr = header->max_mapnr;\n \n \t/* read memory bitmap */\n-\tbitmap_len = block_size * header->bitmap_blocks;\n+\tbitmap_len = (off_t)block_size * header->bitmap_blocks;\n \tdd->bitmap_len = bitmap_len;\n \n \toffset = (off_t)block_size * (1 + header->sub_hdr_size);\n@@ -744,7 +744,7 @@ restart:\n \t\tmemcpy(dd->dumpable_bitmap, dd->bitmap, bitmap_len);\n \n \tdd->data_offset\n-\t\t= (1 + header->sub_hdr_size + header->bitmap_blocks)\n+\t\t= (1UL + header->sub_hdr_size + header->bitmap_blocks)\n \t\t* header->block_size;\n \n \tdd->header = header;\n-- \n2.23.0\n\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "From b80b16549e24769c7d5fe3a10c4b1a1c4b5161f3 Mon Sep 17 00:00:00 2001\nFrom: Dave Anderson <anderson@redhat.com>\nDate: Mon, 23 Mar 2020 15:52:11 -0400\nSubject: [PATCH] Fix for reading compressed kdump dumpfiles from systems with\n physical memory located at extraordinarily high addresses. In a system with\n a physical address range from 0x602770ecf000 to 0x6027ffffffff, the crash\n utility fails during session initialization due to an integer overflow,\n ending with the error message \"crash: vmlinux and vmcore do not match!\".\n (chenjialong@huawei.com)\n\nReferences: bsc#1168233 ltc#184660\nUpstream: merged\nGit-commit: b80b16549e24769c7d5fe3a10c4b1a1c4b5161f3\n\n---\n diskdump.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/diskdump.c b/diskdump.c\nindex e88243e616cc..328c932dad5a 100644\n--- a/diskdump.c\n+++ b/diskdump.c\n@@ -233,7 +233,7 @@ clean_diskdump_data(void)\n }\n \n static inline int \n-get_bit(char *map, int byte, int bit)\n+get_bit(char *map, unsigned long byte, int bit)\n {\n \treturn map[byte] & (1<<bit);\n }\n@@ -694,7 +694,7 @@ restart:\n \t\tdd->max_mapnr = header->max_mapnr;\n \n \t/* read memory bitmap */\n-\tbitmap_len = block_size * header->bitmap_blocks;\n+\tbitmap_len = (off_t)block_size * header->bitmap_blocks;\n \tdd->bitmap_len = bitmap_len;\n \n \toffset = (off_t)block_size * (1 + header->sub_hdr_size);\n@@ -744,7 +744,7 @@ restart:\n \t\tmemcpy(dd->dumpable_bitmap, dd->bitmap, bitmap_len);\n \n \tdd->data_offset\n-\t\t= (1 + header->sub_hdr_size + header->bitmap_blocks)\n+\t\t= (1UL + header->sub_hdr_size + header->bitmap_blocks)\n \t\t* header->block_size;\n \n \tdd->header = header;\n-- \n2.23.0\n\n"}], "metadata": {"id": "crash-13737-crash-Fix-for-reading-compressed-kdump-dumpfiles-from-syst.patch", "cve_id": "CVE-2020-14356", "cves": ["CVE-2020-0305", "CVE-2020-10135", "CVE-2020-10781", "CVE-2020-14331", "CVE-2020-14356", "CVE-2020-15780", "CVE-2020-16166"], "package": "crash", "incident_id": 13737, "patch_name": "crash-Fix-for-reading-compressed-kdump-dumpfiles-from-syst.patch", "tier": "identical", "language": "c", "patch_lines_changed": 7, "patch_files_count": 1, "total_tokens_est": 962, "has_source_context": true, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2020-14356, CVE-2020-14331, CVE-2020-16166, CVE-2020-10135, CVE-2020-0305, CVE-2020-15780, CVE-2020-10781\n\nFrom: Petr Tesarik <ptesarik@suse.cz>\n\n## Package\ncrash\n\n## Files to modify\n- filesys.c\n\n## Target Source Code\n\n### filesys.c\n\n#### region() [lines 532-638]\n```c\nredhat_kernel_directory_v2(char *buf)\n{\n char *p1, *p2;\n\n if (!strstr(kt->proc_version, \"Linux version \"))\n return FALSE;\n\n BZERO(buf, BUFSIZE);\n sprintf(buf, \"/usr/src/redhat/BUILD/kernel-\");\n\n p1 = &kt->proc_version[strlen(\"Linux version \")];\n p2 = &buf[strlen(buf)];\n\n while (((*p1 >= '0') && (*p1 <= '9')) || (*p1 == '.'))\n *p2++ = *p1++;\n\n strcat(buf, \"/linux-\");\n\n p1 = &kt->proc_version[strlen(\"Linux version \")];\n p2 = &buf[strlen(buf)];\n\n while (((*p1 >= '0') && (*p1 <= '9')) || (*p1 == '.'))\n *p2++ = *p1++;\n\n return TRUE;\n}\n\n\nstatic int\nredhat_debug_directory(char *buf)\n{\n char *p1, *p2;\n\n if (!strstr(kt->proc_version, \"Linux version \"))\n return FALSE;\n\n BZERO(buf, BUFSIZE);\n sprintf(buf, \"%s/\", pc->redhat_debug_loc);\n\n p1 = &kt->proc_version[strlen(\"Linux version \")];\n p2 = &buf[strlen(buf)];\n\n while (*p1 != ' ')\n *p2++ = *p1++;\n\n return TRUE;\n}\n\n/*\n * If a namelist was not entered, presume we're using the currently-running\n * kernel. Read its version string from /proc/version, and then look in\n * the search directories for a kernel with the same version string embedded\n * in it.\n */\nstatic int\nfind_booted_kernel(void)\n{\n\tchar kernel[BUFSIZE];\n\tchar buffer[BUFSIZE];\n\tchar **searchdirs;\n\tint i, preferred, wrapped;\n DIR *dirp;\n struct dirent *dp;\n\tint found;\n\n\tpc->flags |= FINDKERNEL;\n\n\tfflush(fp);\n\n\tif (!file_exists(\"/proc/version\", NULL)) {\n\t\terror(INFO, \n\t\t \"/proc/version: %s: cannot determine booted kernel\\n\",\n\t\t\tstrerror(ENOENT));\n\t\treturn FALSE;\n\t}\n\n\tif (!get_proc_version()) {\n error(INFO, \"/proc/version: %s\\n\", strerror(errno));\n return FALSE;\n\t}\n\n if (CRASHDEBUG(1))\n fprintf(fp, \"\\nfind_booted_kernel: search for [%s]\\n\", \n\t\t\tkt->proc_version);\n\n searchdirs = build_searchdirs(CREATE, &preferred);\n\n\tfor (i = preferred, wrapped = found = FALSE; !found; i++) { \n\t\tif (!searchdirs[i]) {\n\t\t\tif (preferred && !wrapped) {\n\t\t\t\twrapped = TRUE;\n\t\t\t\ti = 0;\n\t\t\t} else\n\t\t\t\tbreak;\n\t\t} else if (wrapped && (preferred == i))\n\t\t\tbreak;\n\t\n\t dirp = opendir(searchdirs[i]);\n\t\tif (!dirp)\n\t\t\tcontinue;\n\t for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {\n\t\t\tif (dp->d_name[0] == '.')\n\t\t\t\tcontinue;\n\n\t\t\tsprintf(kernel, \"%s%s\", searchdirs[i], dp->d_name);\n\n\t\t\tif (mount_point(kernel) ||\n```\n\n#### find_booted_kernel() [lines 116-197]\n```c\n\t\t\t}\n\t\t\tif (!pc->dumpfile)\n\t\t\t\tcheck_live_arch_mismatch();\n\t\t\tif (!find_booted_kernel())\n\t \tprogram_usage(SHORT_FORM);\n\t\t}\n\t\n\t\tif (!pc->dumpfile) {\n\t\t\tpc->flags |= LIVE_SYSTEM;\n\t\t\tget_live_memory_source();\n\t\t}\n\t\n\t\tif ((pc->nfd = open(pc->namelist, O_RDONLY)) < 0) \n\t\t\terror(FATAL, \"%s: %s\\n\", pc->namelist, strerror(errno));\n\t\telse {\n\t\t\tclose(pc->nfd);\n\t\t\tpc->nfd = -1;\n\t\t}\n\n\t\tif (LOCAL_ACTIVE() && !(pc->namelist_debug || pc->system_map)) {\n\t\t\tmemory_source_init();\n\t\t\tmatch_proc_version();\n\t\t}\n\t\n\t}\n\n\tmemory_source_init();\n\n\tif (ACTIVE())\n\t\tproc_kcore_init(fp, UNUSED);\n\n\tif (CRASHDEBUG(1)) {\n\t\tfprintf(fp, \"readmem: %s() \", readmem_function_name());\n\t\tif (ACTIVE()) {\n\t\t\tfprintf(fp, \"-> %s \", pc->live_memsrc);\n\t\t\tif (pc->flags & MEMMOD)\n\t\t\t\tfprintf(fp, \"(module)\");\n\t\t\telse if (pc->flags & CRASHBUILTIN)\n\t\t\t\tfprintf(fp, \"(built-in)\");\n\t\t}\n\t\tfprintf(fp, \"\\n\");\n\t}\n}\n\n/*\n * Do whatever's necessary to handle the memory source.\n */\nstatic void\nmemory_source_init(void)\n{\n\tif (REMOTE() && !(pc->flags2 & MEMSRC_LOCAL))\n\t\treturn;\n\n\tif (pc->flags & KERNEL_DEBUG_QUERY)\n\t\treturn;\n\n if (LOCAL_ACTIVE()) {\n\t\tif (pc->mfd != -1) /* already been here */\n\t\t\treturn;\n\n\t\tif (!STREQ(pc->live_memsrc, \"/dev/mem\") &&\n\t\t STREQ(pc->live_memsrc, pc->memory_device)) {\n\t\t\tif (memory_driver_init())\n\t\t\t\treturn;\n\n\t\t\terror(INFO, \"cannot initialize crash memory driver\\n\");\n\t\t\terror(INFO, \"using /dev/mem\\n\\n\");\n\t\t\tpc->flags &= ~MEMMOD;\n\t\t\tpc->flags |= DEVMEM;\n\t\t\tpc->readmem = read_dev_mem;\n\t\t\tpc->writemem = write_dev_mem;\n\t\t\tpc->live_memsrc = \"/dev/mem\";\n\t\t} \n\n\t\tif (STREQ(pc->live_memsrc, \"/dev/mem\")) {\n\t if ((pc->mfd = open(\"/dev/mem\", O_RDWR)) < 0) {\n\t if ((pc->mfd = open(\"/dev/mem\", O_RDONLY)) < 0)\n\t error(FATAL, \"/dev/mem: %s\\n\",\n\t strerror(errno));\n\t } else\n\t pc->flags |= MFD_RDWR;\n\t\t} else if (STREQ(pc->live_memsrc, \"/proc/kcore\")) {\n```\n\n\n## Upstream Fix\n```diff\nFrom: Petr Tesarik <ptesarik@suse.cz>\nSubject: Automatically detect compressed booted kernel\nReferences: bnc#777516, bnc#828260\nPatch-mainline: not yet\n\nSigned-off-by: Petr Tesarik <ptesarik@suse.cz>\n\n---\n filesys.c | 26 ++++++++++++++++++++++----\n 1 file changed, 22 insertions(+), 4 deletions(-)\n\nIndex: crash-7.2.7/filesys.c\n===================================================================\n--- crash-7.2.7.orig/filesys.c\n+++ crash-7.2.7/filesys.c\n@@ -581,6 +581,7 @@ static int\n find_booted_kernel(void)\n {\n \tchar kernel[BUFSIZE];\n+\tchar *real_kernel;\n \tchar buffer[BUFSIZE];\n \tchar **searchdirs;\n \tint i, preferred, wrapped;\n@@ -630,16 +631,24 @@ find_booted_kernel(void)\n \t\t\tsprintf(kernel, \"%s%s\", searchdirs[i], dp->d_name);\n \n \t\t\tif (mount_point(kernel) ||\n-\t\t\t !file_readable(kernel) || \n- !is_kernel(kernel))\n+\t\t\t !file_readable(kernel))\n \t\t\t\tcontinue;\n \n+\t\t\tif (!is_compressed_kernel(kernel, &real_kernel))\n+\t\t\t\treal_kernel = kernel;\n+\n \t\t\tif (CRASHDEBUG(1)) \n \t\t\t\tfprintf(fp, \"find_booted_kernel: check: %s\\n\", \n \t\t\t\t\tkernel);\n \n-\t\t\tfound = match_file_string(kernel, kt->proc_version, buffer);\n-\t\n+\t\t\tif (!is_kernel(real_kernel)) {\n+\t\t\t\tif (real_kernel != kernel)\n+\t\t\t\t\tfree(real_kernel);\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\tfound = match_file_string(real_kernel, kt->proc_version, buffer);\n+\n \t\t\tif (found)\n \t\t\t\tbreak;\n \t }\n@@ -659,10 +668,19 @@ find_booted_kernel(void)\n \t\t\tif (CRASHDEBUG(1))\n \t\t\t\tfprintf(fp, \"find_booted_kernel: found: %s\\n\", \n \t\t\t\t\tpc->namelist);\n+\t\t\tif (real_kernel != kernel) {\n+\t\t\t\tpc->namelist_orig = pc->namelist;\n+\t\t\t\tpc->namelist = real_kernel;\n+\t\t\t}\n return TRUE;\n }\n \t}\n \n+\tif (real_kernel != kernel) {\n+\t\tremove(real_kernel);\n+\t\tfree(real_kernel);\n+\t}\n+\n \terror(INFO, \n \"cannot find booted kernel -- please enter namelist argument\\n\\n\");\n \treturn FALSE;\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "From: Petr Tesarik <ptesarik@suse.cz>\nSubject: Automatically detect compressed booted kernel\nReferences: bnc#777516, bnc#828260\nPatch-mainline: not yet\n\nSigned-off-by: Petr Tesarik <ptesarik@suse.cz>\n\n---\n filesys.c | 26 ++++++++++++++++++++++----\n 1 file changed, 22 insertions(+), 4 deletions(-)\n\nIndex: crash-7.2.7/filesys.c\n===================================================================\n--- crash-7.2.7.orig/filesys.c\n+++ crash-7.2.7/filesys.c\n@@ -581,6 +581,7 @@ static int\n find_booted_kernel(void)\n {\n \tchar kernel[BUFSIZE];\n+\tchar *real_kernel;\n \tchar buffer[BUFSIZE];\n \tchar **searchdirs;\n \tint i, preferred, wrapped;\n@@ -630,16 +631,24 @@ find_booted_kernel(void)\n \t\t\tsprintf(kernel, \"%s%s\", searchdirs[i], dp->d_name);\n \n \t\t\tif (mount_point(kernel) ||\n-\t\t\t !file_readable(kernel) || \n- !is_kernel(kernel))\n+\t\t\t !file_readable(kernel))\n \t\t\t\tcontinue;\n \n+\t\t\tif (!is_compressed_kernel(kernel, &real_kernel))\n+\t\t\t\treal_kernel = kernel;\n+\n \t\t\tif (CRASHDEBUG(1)) \n \t\t\t\tfprintf(fp, \"find_booted_kernel: check: %s\\n\", \n \t\t\t\t\tkernel);\n \n-\t\t\tfound = match_file_string(kernel, kt->proc_version, buffer);\n-\t\n+\t\t\tif (!is_kernel(real_kernel)) {\n+\t\t\t\tif (real_kernel != kernel)\n+\t\t\t\t\tfree(real_kernel);\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\tfound = match_file_string(real_kernel, kt->proc_version, buffer);\n+\n \t\t\tif (found)\n \t\t\t\tbreak;\n \t }\n@@ -659,10 +668,19 @@ find_booted_kernel(void)\n \t\t\tif (CRASHDEBUG(1))\n \t\t\t\tfprintf(fp, \"find_booted_kernel: found: %s\\n\", \n \t\t\t\t\tpc->namelist);\n+\t\t\tif (real_kernel != kernel) {\n+\t\t\t\tpc->namelist_orig = pc->namelist;\n+\t\t\t\tpc->namelist = real_kernel;\n+\t\t\t}\n return TRUE;\n }\n \t}\n \n+\tif (real_kernel != kernel) {\n+\t\tremove(real_kernel);\n+\t\tfree(real_kernel);\n+\t}\n+\n \terror(INFO, \n \"cannot find booted kernel -- please enter namelist argument\\n\\n\");\n \treturn FALSE;\n"}], "metadata": {"id": "crash-13737-crash-compressed-booted-kernel.patch", "cve_id": "CVE-2020-14356", "cves": ["CVE-2020-0305", "CVE-2020-10135", "CVE-2020-10781", "CVE-2020-14331", "CVE-2020-14356", "CVE-2020-15780", "CVE-2020-16166"], "package": "crash", "incident_id": 13737, "patch_name": "crash-compressed-booted-kernel.patch", "tier": "identical", "language": "c", "patch_lines_changed": 26, "patch_files_count": 1, "total_tokens_est": 1088, "has_source_context": true, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2020-14356, CVE-2020-14331, CVE-2020-16166, CVE-2020-10135, CVE-2020-0305, CVE-2020-15780, CVE-2020-10781\n\nFix \"uptime\" and \"ps -t\" for SLES9\n\n## Package\ncrash\n\n## Files to modify\n- b/defs.h\n- b/kernel.c\n- b/task.c\n\n## Target Source Code\n\n### defs.h\n\n#### region() [lines 692-798]\n```c\n\tulong stext_init;\n\tulong etext_init;\n\tulong init_begin;\n\tulong init_end;\n\tulong end;\n\tint cpus;\n\tchar *cpus_override;\n\tvoid (*display_bh)(void);\n ulong module_list;\n ulong kernel_module;\n\tint mods_installed;\n\tstruct timespec date;\n\tchar proc_version[BUFSIZE];\n\tstruct new_utsname utsname;\n\tuint kernel_version[3];\n\tuint gcc_version[3];\n\tint runq_siblings;\n\tint kernel_NR_CPUS;\n\tlong __per_cpu_offset[NR_CPUS];\n\tlong *__rq_idx;\n\tlong *__cpu_idx;\n\tulong *cpu_flags;\n#define POSSIBLE (0x1)\n#define PRESENT (0x2)\n#define ONLINE (0x4)\n#define NMI (0x8)\n#define POSSIBLE_MAP (POSSIBLE)\n#define PRESENT_MAP (PRESENT)\n#define ONLINE_MAP (ONLINE)\n#define ACTIVE_MAP (0x10)\n\tint BUG_bytes;\n\tulong xen_flags;\n#define WRITABLE_PAGE_TABLES (0x1)\n#define SHADOW_PAGE_TABLES (0x2)\n#define CANONICAL_PAGE_TABLES (0x4)\n#define XEN_SUSPEND (0x8)\n\tchar *m2p_page;\n\tulong phys_to_machine_mapping;\n\tulong p2m_table_size;\n#define P2M_MAPPING_CACHE (512)\n\tstruct p2m_mapping_cache {\n\t\tulong mapping;\n\t\tulong pfn;\n\t\tulong start;\n\t\tulong end;\n\t} p2m_mapping_cache[P2M_MAPPING_CACHE];\n#define P2M_MAPPING_PAGE_PFN(c) \\\n (PVOPS_XEN() ? kt->p2m_mapping_cache[c].pfn : \\\n (((kt->p2m_mapping_cache[c].mapping - kt->phys_to_machine_mapping)/PAGESIZE()) \\\n * XEN_PFNS_PER_PAGE))\n\tulong last_mapping_read;\n\tulong p2m_cache_index;\n\tulong p2m_pages_searched;\n\tulong p2m_mfn_cache_hits;\n\tulong p2m_page_cache_hits;\n\tulong relocate;\n\tchar *module_tree;\n\tstruct pvops_xen_info {\n\t\tint p2m_top_entries;\n\t\tulong p2m_top;\n\t\tulong p2m_mid_missing;\n\t\tulong p2m_missing;\n\t} pvops_xen;\n\tint highest_irq;\n#define IKCONFIG_AVAIL\t0x1\t/* kernel contains ikconfig data */\n#define IKCONFIG_LOADED\t0x2\t/* ikconfig data is currently loaded */\n\tint ikconfig_flags;\n\tint ikconfig_ents;\n\tchar *hypervisor;\n\tstruct vmcoreinfo_data {\n\t\tulong log_buf_SYMBOL;\n\t\tulong log_end_SYMBOL;\n\t\tulong log_buf_len_SYMBOL;\n\t\tulong logged_chars_SYMBOL;\n\t\tulong log_first_idx_SYMBOL;\n\t\tulong log_next_idx_SYMBOL;\n\t\tlong log_SIZE;\n\t\tlong log_ts_nsec_OFFSET;\n\t\tlong log_len_OFFSET;\n\t\tlong log_text_len_OFFSET;\n\t\tlong log_dict_len_OFFSET;\n\t\tulong phys_base_SYMBOL;\n\t\tulong _stext_SYMBOL;\n\t} vmcoreinfo;\n\tulonglong flags2;\n\tchar *source_tree;\n\tstruct timespec boot_date;\n};\n\n/*\n * Aid for the two versions of the kernel's module list linkage.\n */\n#define NEXT_MODULE(next_module, modbuf) \\\n{ \\\n switch (kt->flags & (KMOD_V1|KMOD_V2)) \\\n { \\\n case KMOD_V1: \\\n next_module = ULONG(modbuf + OFFSET(module_next)); \\\n break; \\\n case KMOD_V2: \\\n next_module = ULONG(modbuf + OFFSET(module_list)); \\\n if (next_module != kt->kernel_module) \\\n next_module -= OFFSET(module_list); \\\n break; \\\n } \\\n}\n\n```\n\n#### region() [lines 6839-6945]\n```c\nint vmware_vmss_init(char *filename, FILE *ofp);\nuint vmware_vmss_page_size(void);\nint read_vmware_vmss(int, void *, int, ulong, physaddr_t);\nint write_vmware_vmss(int, void *, int, ulong, physaddr_t);\nvoid vmware_vmss_display_regs(int, FILE *);\nvoid get_vmware_vmss_regs(struct bt_info *, ulong *, ulong *);\nint vmware_vmss_memory_dump(FILE *);\nvoid dump_registers_for_vmss_dump(void);\nint vmware_vmss_valid_regs(struct bt_info *);\nint vmware_vmss_get_nr_cpus(void);\nint vmware_vmss_get_cr3_cr4_idtr(int, ulong *, ulong *, ulong *);\nint vmware_vmss_phys_base(ulong *phys_base);\nint vmware_vmss_set_phys_base(ulong);\n\n/*\n * vmware_guestdump.c\n */\nint is_vmware_guestdump(char *filename);\nint vmware_guestdump_init(char *filename, FILE *ofp);\nint vmware_guestdump_memory_dump(FILE *);\n\n/*\n * kaslr_helper.c\n */\nint calc_kaslr_offset(ulong *, ulong *);\n\n/*\n * printk.c\n */\nvoid dump_lockless_record_log(int);\n\n\n/* ... truncated ... */\n```\n\n### kernel.c\n\n#### kernel_init() [lines 101-823]\n```c\n * Gather a few kernel basics.\n */\nvoid\nkernel_init()\n{\n\tint i, c;\n\tchar *p1, *p2, buf[BUFSIZE];\n\tstruct syment *sp1, *sp2;\n\tchar *rqstruct;\n\tchar *rq_timestamp_name = NULL;\n\tchar *irq_desc_type_name;\t\n\tulong pv_init_ops;\n\tstruct gnu_request req;\n\n\tif (pc->flags & KERNEL_DEBUG_QUERY)\n\t\treturn;\n\n if (!(kt->cpu_flags = (ulong *)calloc(NR_CPUS, sizeof(ulong))))\n error(FATAL, \"cannot malloc cpu_flags array\");\n\n\tcpu_maps_init();\n\n\tkt->stext = symbol_value(\"_stext\");\n\tkt->etext = symbol_value(\"_etext\");\n\tget_text_init_space(); \n\tif (symbol_exists(\"__init_begin\")) {\n\t\tkt->init_begin = symbol_value(\"__init_begin\");\n\t\tkt->init_end = symbol_value(\"__init_end\");\n\t}\n\tkt->end = highest_bss_symbol();\n\tif ((sp1 = kernel_symbol_search(\"_end\")) && (sp1->value > kt->end)) \n\t\tkt->end = sp1->value;\n\n\tcheck_vmcoreinfo();\n\t\n\t/*\n\t * For the traditional (non-pv_ops) Xen architecture, default to writable \n * page tables unless:\n\t * \n\t * (1) it's an \"xm save\" CANONICAL_PAGE_TABLES dumpfile, or\n/* ... 147 lines omitted ... */\n\t\t\t*p2 = NULLCHAR;\n\t\t\tkt->kernel_version[2] = atoi(p1);\n\t\t} else\n\t\t\tkt->kernel_version[2] = 0;\n\n\t\tif (CRASHDEBUG(1))\n\t\t\tfprintf(fp, \"base kernel version: %d.%d.%d\\n\",\n\t\t\t\tkt->kernel_version[0],\n\t\t\t\tkt->kernel_version[1],\n\t\t\t\tkt->kernel_version[2]);\n\t} else\n\t\terror(INFO, \"cannot determine base kernel version\\n\");\n\n\n\tverify_version();\n\n\tif (symbol_exists(\"__per_cpu_offset\")) {\n\t\tif (LKCD_KERNTYPES())\n\t\t\ti = get_cpus_possible();\n\t\telse\n\t\t\ti = get_array_length(\"__per_cpu_offset\", NULL, 0);\n\t\tget_symbol_data(\"__per_cpu_offset\",\n\t\t\tsizeof(long)*((i && (i <= NR_CPUS)) ? i : NR_CPUS),\n\t\t\t&kt->__per_cpu_offset[0]);\n kt->flags |= PER_CPU_OFF;\n\t}\n/* ... 490 lines omitted ... */\n\tMEMBER_OFFSET_INIT(hrtimer_softexpires, \"hrtimer\", \"_softexpires\");\n\tMEMBER_OFFSET_INIT(hrtimer_function, \"hrtimer\", \"function\");\n\n\tMEMBER_OFFSET_INIT(ktime_t_tv64, \"ktime\", \"tv64\");\n\tif (INVALID_MEMBER(ktime_t_tv64))\n\t\tMEMBER_OFFSET_INIT(ktime_t_tv64, \"ktime_t\", \"tv64\");\n\tMEMBER_OFFSET_INIT(ktime_t_sec, \"ktime\", \"sec\");\n\tif (INVALID_MEMBER(ktime_t_sec))\n\t\tMEMBER_OFFSET_INIT(ktime_t_sec, \"ktime_t\", \"sec\");\n\tMEMBER_OFFSET_INIT(ktime_t_nsec, \"ktime\", \"nsec\");\n\tif (INVALID_MEMBER(ktime_t_nsec))\n\t\tMEMBER_OFFSET_INIT(ktime_t_nsec, \"ktime_t\", \"nsec\");\n\n\tif (kt->source_tree)\n\t\tsource_tree_init();\n\n\tkt->flags &= ~PRE_KERNEL_INIT;\n}\n\n/*\n```\n\n#### get_uptime() [lines 5718-5756]\n```c\n * Calculate and return the uptime.\n */\nchar *\nget_uptime(char *buf, ulonglong *j64p)\n{\n\tulong jiffies, tmp1, tmp2;\n\tulonglong jiffies_64, wrapped;\n\n\tif (symbol_exists(\"jiffies_64\")) {\n\t\tget_symbol_data(\"jiffies_64\", sizeof(ulonglong), &jiffies_64);\n\t\tif (THIS_KERNEL_VERSION >= LINUX(2,6,0)) {\n\t\t\twrapped = (jiffies_64 & 0xffffffff00000000ULL);\n\t\t\tif (wrapped) {\n\t\t\t\twrapped -= 0x100000000ULL;\n\t\t\t\tjiffies_64 &= 0x00000000ffffffffULL;\n\t\t\t\tjiffies_64 |= wrapped;\n \t\tjiffies_64 += (ulonglong)(300*machdep->hz);\n\t\t\t} else {\n\t\t\t\ttmp1 = (ulong)(uint)(-300*machdep->hz);\n\t\t\t\ttmp2 = (ulong)jiffies_64;\n\t\t\t\tjiffies_64 = (ulonglong)(tmp2 - tmp1);\n\t\t\t}\n\t\t}\n\t\tif (buf)\n\t\t\tconvert_time(jiffies_64, buf);\n\t\tif (j64p)\n\t\t\t*j64p = jiffies_64;\n\t} else {\n\t\tget_symbol_data(\"jiffies\", sizeof(long), &jiffies);\n\t\tif (buf)\n\t\t\tconvert_time((ulonglong)jiffies, buf);\n\t\tif (j64p)\n\t\t\t*j64p = (ulonglong)jiffies;\n\t}\n\n\treturn buf;\n}\n\n#define FSHIFT 11 /* nr of bits of precision */\n```\n\n#### region() [lines 6201-6221]\n```c\n\t\t}\n\t\tfprintf(fp, \"%lx \", kt->cpu_flags[i]);\n\t\tfor (j = i, more = FALSE; j < nr_cpus; j++) {\n\t\t\tif (kt->cpu_flags[j])\n\t\t\t\tmore = TRUE;\n\t\t}\n\t\tif (!more) {\n\t\t\tfprintf(fp, \"...\");\n\t\t\tbreak;\n\t\t}\n\t}\n\tfprintf(fp, \"\\n\");\n\tfprintf(fp, \" possible cpus: \");\n\tif (cpu_map_addr(\"possible\")) {\n\t\tfor (i = c = 0; i < nr_cpus; i++) {\n\t\t\tif (kt->cpu_flags[i] & POSSIBLE_MAP) {\n\t\t\t\tfprintf(fp, \"%d \", i);\n\t\t\t\tc++;\n\t\t\t}\n\t\t}\n\t\tfprintf(fp, \"%s\\n\", c ? \"\" : \"(none)\");\n```\n\n### task.c\n\n#### start_time_timespec() [lines 4532-4545]\n```c\n \t\ttsp->tc = tc;\n\n\t\tif (BITS32() && (SIZE(task_struct_start_time) == 8)) {\n\t\t\tif (start_time_timespec())\n\t\t\t\ttsp->start_time = \n\t\t\t\t\tULONG(tt->task_struct +\n\t\t\t\t\tOFFSET(task_struct_start_time));\n\t\t\telse\n\t\t\t\ttsp->start_time = \n\t\t\t\t\tULONGLONG(tt->task_struct +\n\t\t\t\t\tOFFSET(task_struct_start_time));\n\t\t} else {\n\t\t\tstart_time_timespec();\n\t\t\ttsp->start_time = ULONG(tt->task_struct +\n```\n\n#### convert_start_time() [lines 4613-4641]\n```c\n for (i = 0, tsp = task_start_times; i < tasks; i++, tsp++) {\n\t\tprint_task_header(fp, tsp->tc, 0);\n\t\tfprintf(fp, \" RUN TIME: %s\\n\", symbol_exists(\"jiffies_64\") ? \n\t\t\tconvert_time(convert_start_time(tsp->start_time, jiffies_64), buf1) :\n\t\t\tconvert_time(jiffies - tsp->start_time, buf1));\n\t\tfprintf(fp, \" START TIME: %llu\\n\", tsp->start_time); \n\t\tif (VALID_MEMBER(task_struct_times)) {\n\t\t\tfprintf(fp, \" USER TIME: %ld\\n\", tsp->tms_utime);\n\t\t\tfprintf(fp, \" SYSTEM TIME: %ld\\n\\n\", tsp->tms_stime);\n\t\t} else if (VALID_MEMBER(task_struct_utime)) {\n\t\t\tif (use_utime_stime) {\n\t\t\t\tfprintf(fp, \" UTIME: %lld\\n\", \n\t\t\t\t\t(ulonglong)tsp->utime);\n\t\t\t\tfprintf(fp, \" STIME: %lld\\n\\n\", \n\t\t\t\t\t(ulonglong)tsp->stime);\n\t\t\t} else if (use_kernel_timeval) {\n\t\t\t\tfprintf(fp, \" USER TIME: %d\\n\", \n\t\t\t\t\ttsp->kutime.tv_sec);\n\t\t\t\tfprintf(fp, \" SYSTEM TIME: %d\\n\\n\", \n\t\t\t\t\ttsp->kstime.tv_sec);\n\t\t\t} else {\n\t\t\t\tfprintf(fp, \" USER TIME: %ld\\n\", \n\t\t\t\t\ttsp->old_utime.tv_sec);\n\t\t\t\tfprintf(fp, \" SYSTEM TIME: %ld\\n\\n\", \n\t\t\t\t\ttsp->old_stime.tv_sec);\n\t\t\t}\n\t\t}\n\t}\n\tFREEBUF(task_start_times);\n```\n\n\n## Upstream Fix\n```diff\nFrom: Alan Tyson <atyson@hp.com>\nSubject: [PATCH] Fix \"uptime\" and \"ps -t\" for SLES9\nReferences: 352836\n\nThis patch adds a quirk for SLES9 jiffies initialisation and corrects the time\ndata in \"uptime\" and \"ps -t\" command.\n\n\nAcked-by: Bernhard Walle <bwalle@suse.de>\n\n---\n defs.h | 8 ++++++++\n kernel.c | 9 ++++++++-\n task.c | 11 +++++++++++\n 3 files changed, 27 insertions(+), 1 deletion(-)\n\nIndex: b/defs.h\n===================================================================\n--- a/defs.h\n+++ b/defs.h\n@@ -741,6 +741,7 @@ struct kernel_table {\n \t\tulong p2m_missing;\n \t} pvops_xen;\n \tint highest_irq;\n+ int is_suse_kernel;\n #define IKCONFIG_AVAIL\t0x1\t/* kernel contains ikconfig data */\n #define IKCONFIG_LOADED\t0x2\t/* ikconfig data is currently loaded */\n \tint ikconfig_flags;\n@@ -6888,6 +6889,13 @@ extern struct lkcd_environment *lkcd;\n \n #endif /* LKCD_COMMON */\n \n+\n+/*\n+ * SUSE specific\n+ */\n+#define is_SLES9() \\\n+\t((THIS_KERNEL_VERSION == LINUX(2,6,5)) && kt->is_suse_kernel)\n+\n /*\n * gdb_interface.c\n */\nIndex: b/kernel.c\n===================================================================\n--- a/kernel.c\n+++ b/kernel.c\n@@ -297,6 +297,12 @@ kernel_init()\n \n \tverify_version();\n \n+\t/*\n+\t * check if we have a suse kernel (this is the module supported\n+\t * patch of agruen@suse.de\n+\t */\n+\tkt->is_suse_kernel = symbol_exists(\"unsupported\");\n+\n \tif (symbol_exists(\"__per_cpu_offset\")) {\n \t\tif (LKCD_KERNTYPES())\n \t\t\ti = get_cpus_possible();\n@@ -5617,7 +5623,7 @@ get_uptime(char *buf, ulonglong *j64p)\n \n \tif (symbol_exists(\"jiffies_64\")) {\n \t\tget_symbol_data(\"jiffies_64\", sizeof(ulonglong), &jiffies_64);\n-\t\tif (THIS_KERNEL_VERSION >= LINUX(2,6,0)) {\n+\t\tif (THIS_KERNEL_VERSION >= LINUX(2,6,0) && !is_SLES9()) {\n \t\t\twrapped = (jiffies_64 & 0xffffffff00000000ULL);\n \t\t\tif (wrapped) {\n \t\t\t\twrapped -= 0x100000000ULL;\n@@ -6213,6 +6219,7 @@ no_cpu_flags:\n \t\t\tfprintf(fp, \" p2m_mid_missing: %lx\\n\", kt->pvops_xen.p2m_mid_missing);\n \t\tfprintf(fp, \" p2m_missing: %lx\\n\", kt->pvops_xen.p2m_missing);\n \t}\n+\tfprintf(fp, \" is_suse_kernel: %ld\\n\", kt->is_suse_kernel);\n }\n \n /*\nIndex: b/task.c\n===================================================================\n--- a/task.c\n+++ b/task.c\n@@ -4631,6 +4631,12 @@ start_time_timespec(void)\n \tdefault:\n \t\tbreak;\n \t}\n+\t/* SLES9 stores start_time in nanoseconds, so set TIMESPEC in order */\n+\t/* to do the right calculations in convert_start_time */\n+\tif (is_SLES9()) {\n+\t\ttt->flags |= TIMESPEC;\n+\t\treturn TRUE;\n+\t}\n \n \ttt->flags |= NO_TIMESPEC;\n \n@@ -4667,6 +4673,11 @@ convert_start_time(ulonglong start_time,\n \tulong tmp1, tmp2;\n \tulonglong wrapped;\n \n+\t/* SLES9's start_time is neither jiffies nor a timespec. It's ns */\n+\tif (is_SLES9()) {\n+\t\tstart_time = start_time / 1000000000;\n+\t}\n+\n switch(tt->flags & (TIMESPEC | NO_TIMESPEC | START_TIME_NSECS))\n {\n \tcase START_TIME_NSECS:\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "From: Alan Tyson <atyson@hp.com>\nSubject: [PATCH] Fix \"uptime\" and \"ps -t\" for SLES9\nReferences: 352836\n\nThis patch adds a quirk for SLES9 jiffies initialisation and corrects the time\ndata in \"uptime\" and \"ps -t\" command.\n\n\nAcked-by: Bernhard Walle <bwalle@suse.de>\n\n---\n defs.h | 8 ++++++++\n kernel.c | 9 ++++++++-\n task.c | 11 +++++++++++\n 3 files changed, 27 insertions(+), 1 deletion(-)\n\nIndex: b/defs.h\n===================================================================\n--- a/defs.h\n+++ b/defs.h\n@@ -741,6 +741,7 @@ struct kernel_table {\n \t\tulong p2m_missing;\n \t} pvops_xen;\n \tint highest_irq;\n+ int is_suse_kernel;\n #define IKCONFIG_AVAIL\t0x1\t/* kernel contains ikconfig data */\n #define IKCONFIG_LOADED\t0x2\t/* ikconfig data is currently loaded */\n \tint ikconfig_flags;\n@@ -6888,6 +6889,13 @@ extern struct lkcd_environment *lkcd;\n \n #endif /* LKCD_COMMON */\n \n+\n+/*\n+ * SUSE specific\n+ */\n+#define is_SLES9() \\\n+\t((THIS_KERNEL_VERSION == LINUX(2,6,5)) && kt->is_suse_kernel)\n+\n /*\n * gdb_interface.c\n */\nIndex: b/kernel.c\n===================================================================\n--- a/kernel.c\n+++ b/kernel.c\n@@ -297,6 +297,12 @@ kernel_init()\n \n \tverify_version();\n \n+\t/*\n+\t * check if we have a suse kernel (this is the module supported\n+\t * patch of agruen@suse.de\n+\t */\n+\tkt->is_suse_kernel = symbol_exists(\"unsupported\");\n+\n \tif (symbol_exists(\"__per_cpu_offset\")) {\n \t\tif (LKCD_KERNTYPES())\n \t\t\ti = get_cpus_possible();\n@@ -5617,7 +5623,7 @@ get_uptime(char *buf, ulonglong *j64p)\n \n \tif (symbol_exists(\"jiffies_64\")) {\n \t\tget_symbol_data(\"jiffies_64\", sizeof(ulonglong), &jiffies_64);\n-\t\tif (THIS_KERNEL_VERSION >= LINUX(2,6,0)) {\n+\t\tif (THIS_KERNEL_VERSION >= LINUX(2,6,0) && !is_SLES9()) {\n \t\t\twrapped = (jiffies_64 & 0xffffffff00000000ULL);\n \t\t\tif (wrapped) {\n \t\t\t\twrapped -= 0x100000000ULL;\n@@ -6213,6 +6219,7 @@ no_cpu_flags:\n \t\t\tfprintf(fp, \" p2m_mid_missing: %lx\\n\", kt->pvops_xen.p2m_mid_missing);\n \t\tfprintf(fp, \" p2m_missing: %lx\\n\", kt->pvops_xen.p2m_missing);\n \t}\n+\tfprintf(fp, \" is_suse_kernel: %ld\\n\", kt->is_suse_kernel);\n }\n \n /*\nIndex: b/task.c\n===================================================================\n--- a/task.c\n+++ b/task.c\n@@ -4631,6 +4631,12 @@ start_time_timespec(void)\n \tdefault:\n \t\tbreak;\n \t}\n+\t/* SLES9 stores start_time in nanoseconds, so set TIMESPEC in order */\n+\t/* to do the right calculations in convert_start_time */\n+\tif (is_SLES9()) {\n+\t\ttt->flags |= TIMESPEC;\n+\t\treturn TRUE;\n+\t}\n \n \ttt->flags |= NO_TIMESPEC;\n \n@@ -4667,6 +4673,11 @@ convert_start_time(ulonglong start_time,\n \tulong tmp1, tmp2;\n \tulonglong wrapped;\n \n+\t/* SLES9's start_time is neither jiffies nor a timespec. It's ns */\n+\tif (is_SLES9()) {\n+\t\tstart_time = start_time / 1000000000;\n+\t}\n+\n switch(tt->flags & (TIMESPEC | NO_TIMESPEC | START_TIME_NSECS))\n {\n \tcase START_TIME_NSECS:\n"}], "metadata": {"id": "crash-13737-crash-sles9-time.patch", "cve_id": "CVE-2020-14356", "cves": ["CVE-2020-0305", "CVE-2020-10135", "CVE-2020-10781", "CVE-2020-14331", "CVE-2020-14356", "CVE-2020-15780", "CVE-2020-16166"], "package": "crash", "incident_id": 13737, "patch_name": "crash-sles9-time.patch", "tier": "identical", "language": "c", "patch_lines_changed": 28, "patch_files_count": 3, "total_tokens_est": 1603, "has_source_context": true, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2020-14356, CVE-2020-14331, CVE-2020-16166, CVE-2020-10135, CVE-2020-0305, CVE-2020-15780, CVE-2020-10781\n\nAdd quirk for SLES9 LKCD header\n\n## Package\ncrash\n\n## Files to modify\n- lkcd_v8.c\n\n## Target Source Code\n\n### lkcd_v8.c\n\n#### lkcd_dump_init_v8_arch() [lines 90-195]\n```c\n\n#ifndef HAVE_NO_DUMP_HEADER_ASM\nint\nlkcd_dump_init_v8_arch(dump_header_t *dh)\n{\n\toff_t \t\t\tret_of;\n\tssize_t \t\tret_sz;\n\tuint32_t \t\thdr_size, offset, nr_cpus;\n\tdump_header_asm_t \tarch_hdr;\n\tchar \t\t\t*hdr_buf = NULL;\n\n\tret_of = lseek(lkcd->fd, dh->dh_header_size +\n\t\t\toffsetof(dump_header_asm_t, dha_header_size),\n\t\t\tSEEK_SET);\n\tif (ret_of < 0) {\n\t\tperror(\"lseek failed in \" __FILE__ \":\" STR(__LINE__));\n\t\tgoto err;\n\t}\n\n\tret_sz = read(lkcd->fd, (char *)&hdr_size, sizeof(hdr_size));\n\tif (ret_sz != sizeof(hdr_size)) {\n\t\tperror(\"Reading hdr_size failed in \" __FILE__ \":\" STR(__LINE__));\n\t\tgoto err;\n\t}\n\n\tret_of = lseek(lkcd->fd, dh->dh_header_size, SEEK_SET);\n\tif (ret_of < 0) {\n\t\tperror(\"lseek failed in \" __FILE__ \":\" STR(__LINE__));\n\t\tgoto err;\n\t}\n\n\thdr_buf = (char *)malloc(hdr_size);\n\tif (!hdr_buf) {\n\t\tperror(\"Could not allocate memory for dump header\\n\");\n\t\tgoto err;\n\t}\n\n\tret_sz = read(lkcd->fd, (char *)hdr_buf, hdr_size);\n\tif (ret_sz != hdr_size) {\n\t\tperror(\"Could not read header \" __FILE__ \":\" STR(__LINE__));\n\t\tgoto err;\n\t}\n\n\n\t/*\n * Though we have KL_NR_CPUS is 128, the header size is different\n * CONFIG_NR_CPUS might be different in the kernel. Hence, need\n * to find out how many CPUs are configured.\n */\n offset = offsetof(dump_header_asm_t, dha_smp_regs[0]);\n nr_cpus = (hdr_size - offset) / sizeof(dump_CPU_info_t);\n\n\t/* check for CPU overflow */\n\tif (nr_cpus > NR_CPUS) {\n\t\tfprintf(stderr, \"CPU number too high %d (%s:%d)\\n\",\n\t\t\t\tnr_cpus, __FILE__, __LINE__);\n\t\tgoto err;\n\t}\n\n\t/* parts that don't depend on the number of CPUs */\n\tmemcpy(&arch_hdr, (void *)hdr_buf, offset);\n\n\t/* registers */\n\tmemcpy(&arch_hdr.dha_smp_regs, (void *)&hdr_buf[offset],\n\t\t\tnr_cpus * sizeof(struct pt_regs));\n\toffset += nr_cpus * sizeof(struct pt_regs);\n\n\t/* current task */\n\tmemcpy(&arch_hdr.dha_smp_current_task, (void *)&hdr_buf[offset],\n\t\t\tnr_cpus * sizeof(&arch_hdr.dha_smp_current_task[0]));\n\toffset += nr_cpus * sizeof(&arch_hdr.dha_smp_current_task[0]);\n\n\t/* stack */\n\tmemcpy(&arch_hdr.dha_stack, (void *)&hdr_buf[offset],\n\t\t\tnr_cpus * sizeof(&arch_hdr.dha_stack[0]));\n\toffset += nr_cpus * sizeof(&arch_hdr.dha_stack[0]);\n\n\t/* stack_ptr */\n\tmemcpy(&arch_hdr.dha_stack_ptr, (void *)&hdr_buf[offset],\n\t\t\tnr_cpus * sizeof(&arch_hdr.dha_stack_ptr[0]));\n\toffset += nr_cpus * sizeof(&arch_hdr.dha_stack_ptr[0]);\n\n\tif (arch_hdr.dha_magic_number != DUMP_ASM_MAGIC_NUMBER) {\n\t\tfprintf(stderr, \"Invalid magic number for x86_64\\n\");\n\t\tgoto err;\n\t}\n\n\t/*\n\t * read the kernel load address on IA64 -- other architectures have\n\t * no relocatable kernel at the lifetime of LKCD\n\t */\n#ifdef IA64\n\tmemcpy(&arch_hdr.dha_kernel_addr, (void *)&hdr_buf[offset], sizeof(uint64_t));\n#endif\n\n\tmemcpy(&dump_header_asm_v8, &arch_hdr, sizeof(dump_header_asm_t));\n\n\tfree(hdr_buf);\n\treturn 0;\n\nerr:\n\tfree(hdr_buf);\n\treturn -1;\n}\n\n#else /* architecture that has no lkcd_dump_init_v8 */\n```\n\n\n### Type definitions\n\n```c\n/* from lkcd_dump_v8.h */\nstruct pt_regs {\n\tlong ebx;\n\tlong ecx;\n\tlong edx;\n\tlong esi;\n\tlong edi;\n\tlong ebp;\n\tlong eax;\n\tint xds;\n\tint xes;\n\tlong orig_eax;\n\tlong eip;\n\tint xcs;\n\tlong eflags;\n\tlong esp;\n\tint xss;\n};\n```\n\n\n## Upstream Fix\n```diff\nFrom: Bernhard Walle <bwalle@suse.de>\nSubject: [PATCH] Add quirk for SLES9 LKCD header\nPatch-mainline: never\n\nOn SLES9, we have a different header on IA64:\n\n SLES 10:\n\n typedef struct __dump_header_asm {\n uint64_t dha_magic_number;\n uint32_t dha_version;\n uint32_t dha_header_size;\n uint64_t dha_pt_regs;\n struct pt_regs dha_regs;\n uint64_t dha_rnat;\n uint64_t dha_pfs;\n uint64_t dha_bspstore;\n uint32_t\t dha_smp_num_cpus;\n uint32_t\t dha_dumping_cpu;\n struct pt_regs\tdha_smp_regs[NR_CPUS];\n uint64_t\t dha_smp_current_task[NR_CPUS];\n uint64_t\t dha_stack[NR_CPUS];\n uint64_t\t dha_stack_ptr[NR_CPUS];\n uint64_t dha_kernel_addr;\n } __attribute__((packed)) dump_header_asm_t;\n\n SLES 9:\n typedef struct __dump_header_asm {\n uint64_t dha_magic_number;\n uint32_t dha_version;\n uint32_t dha_header_size;\n uint64_t dha_kernel_addr;\n uint64_t dha_pt_regs;\n struct pt_regs dha_regs;\n uint64_t dha_rnat;\n uint64_t dha_pfs;\n uint64_t dha_bspstore;\n uint32_t\t dha_smp_num_cpus;\n uint32_t\t dha_dumping_cpu;\t\n struct pt_regs\tdha_smp_regs[NR_CPUS];\n uint64_t\t dha_smp_current_task[NR_CPUS];\n uint64_t\t dha_stack[NR_CPUS];\n uint64_t\t dha_stack_ptr[NR_CPUS];\n } __attribute__((packed)) dump_header_asm_t;\n\nThat patch tries to guess if it's a SLES 9 or a SLES 10 header\nat runtime.\n\n\nSigned-off-by: Bernhard Walle <bwalle@suse.de>\n\n---\n lkcd_v8.c | 11 +++++++++++\n 1 file changed, 11 insertions(+)\n\n--- a/lkcd_v8.c\n+++ b/lkcd_v8.c\n@@ -130,6 +130,17 @@ lkcd_dump_init_v8_arch(dump_header_t *dh\n \t\tgoto err;\n \t}\n \n+#if IA64\n+\t/* SLES9 on IA64? */\n+\tif ( *((uint64_t *)(hdr_buf + hdr_size - sizeof(uint64_t))) <= NR_CPUS) {\n+\t\tuint64_t kernel_addr;\n+\t\tkernel_addr = ((dump_header_asm_t *)hdr_buf)->dha_pt_regs;\n+\t\tmemmove(hdr_buf + offsetof(dump_header_asm_t, dha_pt_regs),\n+\t\t\t\thdr_buf + offsetof(dump_header_asm_t, dha_regs),\n+\t\t\t\thdr_size - offsetof(dump_header_asm_t, dha_regs));\n+\t\t*((uint64_t *)(hdr_buf + hdr_size - sizeof(uint64_t))) = kernel_addr;\n+\t}\n+#endif\n \n \t/*\n * Though we have KL_NR_CPUS is 128, the header size is different\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "From: Bernhard Walle <bwalle@suse.de>\nSubject: [PATCH] Add quirk for SLES9 LKCD header\nPatch-mainline: never\n\nOn SLES9, we have a different header on IA64:\n\n SLES 10:\n\n typedef struct __dump_header_asm {\n uint64_t dha_magic_number;\n uint32_t dha_version;\n uint32_t dha_header_size;\n uint64_t dha_pt_regs;\n struct pt_regs dha_regs;\n uint64_t dha_rnat;\n uint64_t dha_pfs;\n uint64_t dha_bspstore;\n uint32_t\t dha_smp_num_cpus;\n uint32_t\t dha_dumping_cpu;\n struct pt_regs\tdha_smp_regs[NR_CPUS];\n uint64_t\t dha_smp_current_task[NR_CPUS];\n uint64_t\t dha_stack[NR_CPUS];\n uint64_t\t dha_stack_ptr[NR_CPUS];\n uint64_t dha_kernel_addr;\n } __attribute__((packed)) dump_header_asm_t;\n\n SLES 9:\n typedef struct __dump_header_asm {\n uint64_t dha_magic_number;\n uint32_t dha_version;\n uint32_t dha_header_size;\n uint64_t dha_kernel_addr;\n uint64_t dha_pt_regs;\n struct pt_regs dha_regs;\n uint64_t dha_rnat;\n uint64_t dha_pfs;\n uint64_t dha_bspstore;\n uint32_t\t dha_smp_num_cpus;\n uint32_t\t dha_dumping_cpu;\t\n struct pt_regs\tdha_smp_regs[NR_CPUS];\n uint64_t\t dha_smp_current_task[NR_CPUS];\n uint64_t\t dha_stack[NR_CPUS];\n uint64_t\t dha_stack_ptr[NR_CPUS];\n } __attribute__((packed)) dump_header_asm_t;\n\nThat patch tries to guess if it's a SLES 9 or a SLES 10 header\nat runtime.\n\n\nSigned-off-by: Bernhard Walle <bwalle@suse.de>\n\n---\n lkcd_v8.c | 11 +++++++++++\n 1 file changed, 11 insertions(+)\n\n--- a/lkcd_v8.c\n+++ b/lkcd_v8.c\n@@ -130,6 +130,17 @@ lkcd_dump_init_v8_arch(dump_header_t *dh\n \t\tgoto err;\n \t}\n \n+#if IA64\n+\t/* SLES9 on IA64? */\n+\tif ( *((uint64_t *)(hdr_buf + hdr_size - sizeof(uint64_t))) <= NR_CPUS) {\n+\t\tuint64_t kernel_addr;\n+\t\tkernel_addr = ((dump_header_asm_t *)hdr_buf)->dha_pt_regs;\n+\t\tmemmove(hdr_buf + offsetof(dump_header_asm_t, dha_pt_regs),\n+\t\t\t\thdr_buf + offsetof(dump_header_asm_t, dha_regs),\n+\t\t\t\thdr_size - offsetof(dump_header_asm_t, dha_regs));\n+\t\t*((uint64_t *)(hdr_buf + hdr_size - sizeof(uint64_t))) = kernel_addr;\n+\t}\n+#endif\n \n \t/*\n * Though we have KL_NR_CPUS is 128, the header size is different\n"}], "metadata": {"id": "crash-13737-crash-sles9-quirk.patch", "cve_id": "CVE-2020-14356", "cves": ["CVE-2020-0305", "CVE-2020-10135", "CVE-2020-10781", "CVE-2020-14331", "CVE-2020-14356", "CVE-2020-15780", "CVE-2020-16166"], "package": "crash", "incident_id": 13737, "patch_name": "crash-sles9-quirk.patch", "tier": "identical", "language": "c", "patch_lines_changed": 11, "patch_files_count": 0, "total_tokens_est": 1459, "has_source_context": true, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2020-14356, CVE-2020-14331, CVE-2020-16166, CVE-2020-10135, CVE-2020-0305, CVE-2020-15780, CVE-2020-10781\n\nFrom: Hari Bathini <hbathini@linux.ibm.com>\n\n## Package\ncrash\n\n## Files to modify\n- ppc64.c\n\n## Target Source Code\n\n### ppc64.c\n\n#### ppc64_init() [lines 300-720]\n```c\n * times during initialization.\n */\nvoid\nppc64_init(int when)\n{\n#if defined(__x86_64__)\n if (ACTIVE())\n error(FATAL, \"compiled for the PPC64 architecture\\n\");\n#endif\n\tswitch (when)\n\t{\n\tcase SETUP_ENV:\n\t\tmachdep->process_elf_notes = process_elf64_notes;\n\t\tbreak;\n\n\tcase PRE_SYMTAB:\n\t\tmachdep->machspec = &ppc64_machine_specific;\n\t\tmachdep->verify_symbol = ppc64_verify_symbol;\n\t\tif (pc->flags & KERNEL_DEBUG_QUERY)\n\t\t\treturn;\n\t\tmachdep->stacksize = PPC64_STACK_SIZE;\n\t\tmachdep->last_pgd_read = 0;\n\t\tmachdep->last_pud_read = 0;\n\t\tmachdep->last_pmd_read = 0;\n\t\tmachdep->last_ptbl_read = 0;\n\t\tmachdep->verify_paddr = generic_verify_paddr;\n\t\tmachdep->ptrs_per_pgd = PTRS_PER_PGD;\n\t\tmachdep->flags |= MACHDEP_BT_TEXT;\n if (machdep->cmdline_args[0])\n parse_cmdline_args();\n\t\t machdep->clear_machdep_cache = ppc64_clear_machdep_cache;\n\t\tbreak;\n\n\tcase PRE_GDB:\n\t\t/*\n * Recently there were changes made to kexec tools\n * to support 64K page size. With those changes\n * vmcore file obtained from a kernel which supports\n * 64K page size cannot be analyzed using crash on a\n * machine running with kernel supporting 4K page size\n/* ... 170 lines omitted ... */\n\n\t\t\t\t} else if (!(machdep->flags & BOOK3E) &&\n\t\t\t\t (THIS_KERNEL_VERSION >= LINUX(4,6,0))) {\n\t\t\t\t\tm->l1_index_size = PTE_INDEX_SIZE_L4_64K_3_10;\n\n\t\t\t\t\tif (THIS_KERNEL_VERSION >= LINUX(4,12,0)) {\n\t\t\t\t\t\tm->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_12;\n\t\t\t\t\t\tif (THIS_KERNEL_VERSION >= LINUX(4,17,0))\n\t\t\t\t\t\t\tm->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_17;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tm->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_12;\n\t\t\t\t\t\tm->l4_index_size = PGD_INDEX_SIZE_L4_64K_4_12;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tm->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_6;\n\t\t\t\t\t\tm->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_6;\n\t\t\t\t\t\tm->l4_index_size = PGD_INDEX_SIZE_L4_64K_3_10;\n\t\t\t\t\t}\n\t\t\t\t} else if (THIS_KERNEL_VERSION >= LINUX(3,10,0)) {\n\t\t\t\t\tm->l1_index_size = PTE_INDEX_SIZE_L4_64K_3_10;\n\t\t\t\t\tm->l2_index_size = PMD_INDEX_SIZE_L4_64K_3_10;\n\t\t\t\t\tm->l3_index_size = PUD_INDEX_SIZE_L4_64K;\n\t\t\t\t\tm->l4_index_size = PGD_INDEX_SIZE_L4_64K_3_10;\n\n\t\t\t\t} else {\n\t\t\t\t\tm->l1_index_size = PTE_INDEX_SIZE_L4_64K;\n\t\t\t\t\tm->l2_index_size = PMD_INDEX_SIZE_L4_64K;\n\t\t\t\t\tm->l3_index_size = PUD_INDEX_SIZE_L4_64K;\n\t\t\t\t\tm->l4_index_size = PGD_INDEX_SIZE_L4_64K;\n/* ... 163 lines omitted ... */\n\t\t}\n\t\t/*\n\t\t * IRQ stacks are introduced in 2.6 and also configurable.\n\t\t */\n\t\tif ((THIS_KERNEL_VERSION >= LINUX(2,6,0)) && \n\t\t\tsymbol_exists(\"hardirq_ctx\"))\n\t\t\tASSIGN_SIZE(irq_ctx) = STACKSIZE();\n\n\t\tbreak;\n\n\tcase POST_INIT:\n\t\tbreak;\n\n\tcase LOG_ONLY:\n\t\tmachdep->identity_map_base = kt->vmcoreinfo._stext_SYMBOL;\n\t\tbreak;\n\t}\n}\n\n#ifndef KSYMS_START\n```\n\n\n## Upstream Fix\n```diff\nFrom 28fa7bd09013455b5ddc020dea4706278cda0d65 Mon Sep 17 00:00:00 2001\nFrom: Hari Bathini <hbathini@linux.ibm.com>\nDate: Wed, 20 Jun 2018 01:34:22 +0530\nSubject: book3s/ppc64: Increase the VA range\nUpstream: no, adapts the below upstream commit for SLE15 SP1\nGit-commit: 28fa7bd09013455b5ddc020dea4706278cda0d65\n\nFix for PPC64 kernel virtual address translation in Linux 4.17 and\nlater kernels with commit c2b4d8b7417a59b7f9a52d0d8402f5257cbbd398,\ntitled \"powerpc/mm/hash64: Increase the VA range\", in which the\nmaximum virtual address value has been increased to 4PB. Without\nthe patch, the translation/access of high vmalloc space addresses\nfails; for example, the \"kmem -[sS]\" option fails the translation\nof per-cpu kmem_cache_cpu addresses located in vmalloc space, with\nthe error messages \"kmem: invalid kernel virtual address: <address>\ntype: kmem_cache_cpu.freelist\" and \"kmem: invalid kernel virtual\naddress: <address> type: kmem_cache_cpu.page\", and the \"vtop\"\ncommand shows the addresses as \"(not mapped)\". (hbathini@linux.ibm.com)\n\n[note: apply on 4.12+ for SLE 15 SP1 - incompatible with SLE 15 SP0]\n\n---\n\nIndex: crash-7.2.8/ppc64.c\n===================================================================\n--- crash-7.2.8.orig/ppc64.c\n+++ crash-7.2.8/ppc64.c\n@@ -519,8 +519,9 @@ ppc64_init(int when)\n \n \t\t\t\t\tif (THIS_KERNEL_VERSION >= LINUX(4,12,0)) {\n \t\t\t\t\t\tm->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_12;\n-\t\t\t\t\t\tif (THIS_KERNEL_VERSION >= LINUX(4,17,0))\n-\t\t\t\t\t\t\tm->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_17;\n+\t\t\t\t\t\tif (THIS_KERNEL_VERSION >= LINUX(4,17,0) ||\n+\t\t\t\t\t\t\tis_SLE15SP1())\n+\t\t\t\t\t\t\t\tm->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_17;\n \t\t\t\t\t\telse\n \t\t\t\t\t\t\tm->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_12;\n \t\t\t\t\t\tm->l4_index_size = PGD_INDEX_SIZE_L4_64K_4_12;\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "From 28fa7bd09013455b5ddc020dea4706278cda0d65 Mon Sep 17 00:00:00 2001\nFrom: Hari Bathini <hbathini@linux.ibm.com>\nDate: Wed, 20 Jun 2018 01:34:22 +0530\nSubject: book3s/ppc64: Increase the VA range\nUpstream: no, adapts the below upstream commit for SLE15 SP1\nGit-commit: 28fa7bd09013455b5ddc020dea4706278cda0d65\n\nFix for PPC64 kernel virtual address translation in Linux 4.17 and\nlater kernels with commit c2b4d8b7417a59b7f9a52d0d8402f5257cbbd398,\ntitled \"powerpc/mm/hash64: Increase the VA range\", in which the\nmaximum virtual address value has been increased to 4PB. Without\nthe patch, the translation/access of high vmalloc space addresses\nfails; for example, the \"kmem -[sS]\" option fails the translation\nof per-cpu kmem_cache_cpu addresses located in vmalloc space, with\nthe error messages \"kmem: invalid kernel virtual address: <address>\ntype: kmem_cache_cpu.freelist\" and \"kmem: invalid kernel virtual\naddress: <address> type: kmem_cache_cpu.page\", and the \"vtop\"\ncommand shows the addresses as \"(not mapped)\". (hbathini@linux.ibm.com)\n\n[note: apply on 4.12+ for SLE 15 SP1 - incompatible with SLE 15 SP0]\n\n---\n\nIndex: crash-7.2.8/ppc64.c\n===================================================================\n--- crash-7.2.8.orig/ppc64.c\n+++ crash-7.2.8/ppc64.c\n@@ -519,8 +519,9 @@ ppc64_init(int when)\n \n \t\t\t\t\tif (THIS_KERNEL_VERSION >= LINUX(4,12,0)) {\n \t\t\t\t\t\tm->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_12;\n-\t\t\t\t\t\tif (THIS_KERNEL_VERSION >= LINUX(4,17,0))\n-\t\t\t\t\t\t\tm->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_17;\n+\t\t\t\t\t\tif (THIS_KERNEL_VERSION >= LINUX(4,17,0) ||\n+\t\t\t\t\t\t\tis_SLE15SP1())\n+\t\t\t\t\t\t\t\tm->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_17;\n \t\t\t\t\t\telse\n \t\t\t\t\t\t\tm->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_12;\n \t\t\t\t\t\tm->l4_index_size = PGD_INDEX_SIZE_L4_64K_4_12;\n"}], "metadata": {"id": "crash-13737-crash-SLE15-SP1-Fix-for-PPC64-kernel-virtual-address-translation-in.patch", "cve_id": "CVE-2020-14356", "cves": ["CVE-2020-0305", "CVE-2020-10135", "CVE-2020-10781", "CVE-2020-14331", "CVE-2020-14356", "CVE-2020-15780", "CVE-2020-16166"], "package": "crash", "incident_id": 13737, "patch_name": "crash-SLE15-SP1-Fix-for-PPC64-kernel-virtual-address-translation-in.patch", "tier": "identical", "language": "c", "patch_lines_changed": 5, "patch_files_count": 1, "total_tokens_est": 1031, "has_source_context": true, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2020-14356, CVE-2020-14331, CVE-2020-16166, CVE-2020-10135, CVE-2020-0305, CVE-2020-15780, CVE-2020-10781\n\nfix \"kmem -[sS]\" for caches created during SLUB bootstrap\n\n## Package\ncrash\n\n## Files to modify\n- memory.c\n\n## Upstream Fix\n```diff\nFrom 50f39247d80519c71d1f03984bc34aa476a9c2bd Mon Sep 17 00:00:00 2001\nFrom: Hari Bathini <hbathini@in.ibm.com>\nDate: Wed, 8 Apr 2020 11:38:23 +0200\nSubject: [PATCH] fix \"kmem -[sS]\" for caches created during SLUB bootstrap\n\nReferences: bsc#1164815 ltc#182973 https://www.redhat.com/archives/crash-utility/2020-April/msg00029.html\nUpstream: submitted\n\nFix for \"kmem -[sS]\" options on Linux 4.14 and later kernels built\nwith CONFIG_SLAB_FREELIST_HARDENED enabled. Without the patch, there\nwill error messages of the type \"kmem: <cache name> slab: <address>\ninvalid freepointer: <obfuscated address>\" for caches created during\nSLUB bootstrap, as they are likely to have s->random == 0.\n\nSigned-off-by: Hari Bathini <hbathini linux ibm com>\n---\n memory.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/memory.c b/memory.c\nindex ccc29442c3f6..c2433ebe5e75 100644\n--- a/memory.c\n+++ b/memory.c\n@@ -19244,7 +19244,7 @@ count_free_objects(struct meminfo *si, ulong freelist)\n static ulong\n freelist_ptr(struct meminfo *si, ulong ptr, ulong ptr_addr)\n {\n-\tif (si->random)\n+\tif (VALID_MEMBER(kmem_cache_random))\n \t\t/* CONFIG_SLAB_FREELIST_HARDENED */\n \t\treturn (ptr ^ si->random ^ ptr_addr);\n \telse\n-- \n2.23.0\n\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "From 50f39247d80519c71d1f03984bc34aa476a9c2bd Mon Sep 17 00:00:00 2001\nFrom: Hari Bathini <hbathini@in.ibm.com>\nDate: Wed, 8 Apr 2020 11:38:23 +0200\nSubject: [PATCH] fix \"kmem -[sS]\" for caches created during SLUB bootstrap\n\nReferences: bsc#1164815 ltc#182973 https://www.redhat.com/archives/crash-utility/2020-April/msg00029.html\nUpstream: submitted\n\nFix for \"kmem -[sS]\" options on Linux 4.14 and later kernels built\nwith CONFIG_SLAB_FREELIST_HARDENED enabled. Without the patch, there\nwill error messages of the type \"kmem: <cache name> slab: <address>\ninvalid freepointer: <obfuscated address>\" for caches created during\nSLUB bootstrap, as they are likely to have s->random == 0.\n\nSigned-off-by: Hari Bathini <hbathini linux ibm com>\n---\n memory.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/memory.c b/memory.c\nindex ccc29442c3f6..c2433ebe5e75 100644\n--- a/memory.c\n+++ b/memory.c\n@@ -19244,7 +19244,7 @@ count_free_objects(struct meminfo *si, ulong freelist)\n static ulong\n freelist_ptr(struct meminfo *si, ulong ptr, ulong ptr_addr)\n {\n-\tif (si->random)\n+\tif (VALID_MEMBER(kmem_cache_random))\n \t\t/* CONFIG_SLAB_FREELIST_HARDENED */\n \t\treturn (ptr ^ si->random ^ ptr_addr);\n \telse\n-- \n2.23.0\n\n"}], "metadata": {"id": "crash-13737-crash-fix-kmem-sS-for-caches-created-during-SLUB-bootstrap.patch", "cve_id": "CVE-2020-14356", "cves": ["CVE-2020-0305", "CVE-2020-10135", "CVE-2020-10781", "CVE-2020-14331", "CVE-2020-14356", "CVE-2020-15780", "CVE-2020-16166"], "package": "crash", "incident_id": 13737, "patch_name": "crash-fix-kmem-sS-for-caches-created-during-SLUB-bootstrap.patch", "tier": "identical", "language": "c", "patch_lines_changed": 3, "patch_files_count": 1, "total_tokens_est": 760, "has_source_context": false, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2020-14356, CVE-2020-14331, CVE-2020-16166, CVE-2020-10135, CVE-2020-0305, CVE-2020-15780, CVE-2020-10781\n\nprintf(\"%p %7d %7d %7d 0x%02x 0x%08x %5d:%-5d %s\\n\"\n\n## Package\ncrash\n\n## Upstream Fix\n```diff\ndiff -Nurp sial-scripts-2008-02-08.orig//ps.c sial-scripts-2008-02-08/ps.c\n--- sial-scripts-2008-02-08.orig//ps.c\t2010-03-12 19:59:03.227788951 +0100\n+++ sial-scripts-2008-02-08/ps.c\t2010-03-12 19:59:16.690665574 +0100\n@@ -192,7 +192,11 @@ string cmd;\n \n \tprintf(\"%p %7d %7d %7d 0x%02x 0x%08x %5d:%-5d %s\\n\"\n \t\t, t\n+#if LINUX_RELEASE > 0x02061d\n+\t\t, t->real_cred->uid\n+#else\n \t\t, t->uid\n+#endif\n \t\t, t->pid\n #if LINUX_2_6_X\n \t\t, t->parent->pid\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "diff -Nurp sial-scripts-2008-02-08.orig//ps.c sial-scripts-2008-02-08/ps.c\n--- sial-scripts-2008-02-08.orig//ps.c\t2010-03-12 19:59:03.227788951 +0100\n+++ sial-scripts-2008-02-08/ps.c\t2010-03-12 19:59:16.690665574 +0100\n@@ -192,7 +192,11 @@ string cmd;\n \n \tprintf(\"%p %7d %7d %7d 0x%02x 0x%08x %5d:%-5d %s\\n\"\n \t\t, t\n+#if LINUX_RELEASE > 0x02061d\n+\t\t, t->real_cred->uid\n+#else\n \t\t, t->uid\n+#endif\n \t\t, t->pid\n #if LINUX_2_6_X\n \t\t, t->parent->pid\n"}], "metadata": {"id": "crash-13737-crash-sial-ps-2.6.29.diff", "cve_id": "CVE-2020-14356", "cves": ["CVE-2020-0305", "CVE-2020-10135", "CVE-2020-10781", "CVE-2020-14331", "CVE-2020-14356", "CVE-2020-15780", "CVE-2020-16166"], "package": "crash", "incident_id": 13737, "patch_name": "crash-sial-ps-2.6.29.diff", "tier": "identical", "language": "c", "patch_lines_changed": 4, "patch_files_count": 0, "total_tokens_est": 362, "has_source_context": false, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2020-14356, CVE-2020-14331, CVE-2020-16166, CVE-2020-10135, CVE-2020-0305, CVE-2020-15780, CVE-2020-10781\n\nmain.c | 8 +-------\n\n## Package\ncrash\n\n## Files to modify\n- main.c\n\n## Target Source Code\n\n### main.c\n\n#### setup_environment() [lines 1080-1245]\n```c\n\n\nstatic void\nsetup_environment(int argc, char **argv)\n{\n\tint i;\n\tchar *p1;\n\tchar buf[BUFSIZE];\n\tchar homerc[BUFSIZE];\n\tchar localrc[BUFSIZE];\n\tFILE *afp;\n\tchar *program;\n\n\tprogram = argv[0];\n\n\t/*\n\t * Program output typically goes via \"fprintf(fp, ...)\", but the \n\t * contents of fp are modified on the fly to handle redirection\n\t * to pipes or output files.\n\t */\n\tfp = stdout;\n\n\tif (!set_error(\"default\")) {\n\t\tfprintf(stderr, \"crash: cannot malloc error() path string\\n\");\n\t\tclean_exit(1);\n\t}\n\n\t/*\n\t * Start populating the program_context structure. It's used so\n\t * frequently that \"pc\" has been declared globally to point to the\n\t * \"program_context\" structure.\n\t */\n pc->program_name = (char *)basename(program);\n\tpc->program_path = program;\n pc->program_version = build_version;\n\tpc->program_pid = (ulong)getpid();\n pc->curcmd = pc->program_name;\n pc->flags = (HASH|SCROLL);\n\tpc->flags |= DATADEBUG; /* default until unnecessary */\n\tpc->flags2 |= REDZONE;\n/* ... 40 lines omitted ... */\n\t\t\tpc->scroll_command = SCROLL_CRASHPAGER;\n\t\t} else if (file_exists(\"/usr/bin/less\", NULL)) {\n\t\t\tpc->flags |= SCROLL;\n\t\t\tpc->scroll_command = SCROLL_LESS;\n\t\t} else if (file_exists(\"/bin/more\", NULL)) {\n\t\t\tpc->flags |= SCROLL;\n\t\t\tpc->scroll_command = SCROLL_MORE;\n\t\t} else {\n \tpc->scroll_command = SCROLL_NONE;\n \tpc->flags &= ~SCROLL;\n \t}\n\t} \n\n\t/*\n\t * Setup the readline command line editing mode based upon the \n\t * following order:\n\t *\n\t * (1) EDITOR environment variable\n * (2) overridden by any .crashrc entry: \"set vi\" or \"set emacs\"\n * (3) RL_VI_MODE if not set anywhere else\n\t */\n\n\tpc->flags |= READLINE;\n\tpc->editing_mode = \"no_mode\";\n\n\tif ((p1 = getenv(\"EDITOR\"))) {\n\t\tif (strstr(p1, \"vi\"))\n\t\t\tpc->editing_mode = \"vi\";\n\t\tif (strstr(p1, \"emacs\"))\n\t\t\tpc->editing_mode = \"emacs\";\n\t}\n\n/* ... 34 lines omitted ... */\n\t !(pc->flags & NOCRASHRC) && file_exists(localrc, NULL)) {\n\t\tif ((afp = fopen(localrc, \"r\")) == NULL)\n error(INFO, \"cannot open %s: %s\\n\",\n\t\t\t\tlocalrc, strerror(errno));\n\t\telse if (untrusted_file(afp, localrc))\n\t\t\tfclose(afp);\n\t\telse {\n\t\t\twhile (fgets(buf, BUFSIZE, afp)) \n\t\t\t\tresolve_rc_cmd(buf, ALIAS_RCLOCAL);\n\t\t\tfclose(afp);\n\t\t}\n\t}\n\n\tif (STREQ(pc->editing_mode, \"no_mode\"))\n\t\tpc->editing_mode = \"vi\";\n\n\tmachdep_init(SETUP_ENV);\n}\n\n\n```\n\n\n## Upstream Fix\n```diff\n---\n main.c | 8 +-------\n 1 file changed, 1 insertion(+), 7 deletions(-)\n\nIndex: crash-7.2.7/main.c\n===================================================================\n--- crash-7.2.7.orig/main.c\n+++ crash-7.2.7/main.c\n@@ -1169,12 +1169,6 @@ setup_environment(int argc, char **argv)\n \tpc->flags |= READLINE;\n \tpc->editing_mode = \"no_mode\";\n \n-\tif ((p1 = getenv(\"EDITOR\"))) {\n-\t\tif (strstr(p1, \"vi\"))\n-\t\t\tpc->editing_mode = \"vi\";\n-\t\tif (strstr(p1, \"emacs\"))\n-\t\t\tpc->editing_mode = \"emacs\";\n-\t}\n \n \t/*\n \t * Resolve $HOME .rc file first, then the one in the local directory.\n@@ -1224,7 +1218,7 @@ setup_environment(int argc, char **argv)\n \t}\n \n \tif (STREQ(pc->editing_mode, \"no_mode\"))\n-\t\tpc->editing_mode = \"vi\";\n+\t\tpc->editing_mode = \"emacs\";\n \n \tmachdep_init(SETUP_ENV);\n }\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "---\n main.c | 8 +-------\n 1 file changed, 1 insertion(+), 7 deletions(-)\n\nIndex: crash-7.2.7/main.c\n===================================================================\n--- crash-7.2.7.orig/main.c\n+++ crash-7.2.7/main.c\n@@ -1169,12 +1169,6 @@ setup_environment(int argc, char **argv)\n \tpc->flags |= READLINE;\n \tpc->editing_mode = \"no_mode\";\n \n-\tif ((p1 = getenv(\"EDITOR\"))) {\n-\t\tif (strstr(p1, \"vi\"))\n-\t\t\tpc->editing_mode = \"vi\";\n-\t\tif (strstr(p1, \"emacs\"))\n-\t\t\tpc->editing_mode = \"emacs\";\n-\t}\n \n \t/*\n \t * Resolve $HOME .rc file first, then the one in the local directory.\n@@ -1224,7 +1218,7 @@ setup_environment(int argc, char **argv)\n \t}\n \n \tif (STREQ(pc->editing_mode, \"no_mode\"))\n-\t\tpc->editing_mode = \"vi\";\n+\t\tpc->editing_mode = \"emacs\";\n \n \tmachdep_init(SETUP_ENV);\n }\n"}], "metadata": {"id": "crash-13737-crash-make-emacs-default.diff", "cve_id": "CVE-2020-14356", "cves": ["CVE-2020-0305", "CVE-2020-10135", "CVE-2020-10781", "CVE-2020-14331", "CVE-2020-14356", "CVE-2020-15780", "CVE-2020-16166"], "package": "crash", "incident_id": 13737, "patch_name": "crash-make-emacs-default.diff", "tier": "identical", "language": "c", "patch_lines_changed": 8, "patch_files_count": 1, "total_tokens_est": 529, "has_source_context": true, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2020-14356, CVE-2020-14331, CVE-2020-16166, CVE-2020-10135, CVE-2020-0305, CVE-2020-15780, CVE-2020-10781\n\nFrom: Hari Bathini <hbathini@linux.ibm.com>\n\n## Package\ncrash\n\n## Files to modify\n- defs.h\n- ppc64.c\n\n## Target Source Code\n\n### defs.h\n\n#### region() [lines 6847-6953]\n```c\nint vmware_vmss_valid_regs(struct bt_info *);\nint vmware_vmss_get_nr_cpus(void);\nint vmware_vmss_get_cr3_cr4_idtr(int, ulong *, ulong *, ulong *);\nint vmware_vmss_phys_base(ulong *phys_base);\nint vmware_vmss_set_phys_base(ulong);\n\n/*\n * vmware_guestdump.c\n */\nint is_vmware_guestdump(char *filename);\nint vmware_guestdump_init(char *filename, FILE *ofp);\nint vmware_guestdump_memory_dump(FILE *);\n\n/*\n * kaslr_helper.c\n */\nint calc_kaslr_offset(ulong *, ulong *);\n\n/*\n * printk.c\n */\nvoid dump_lockless_record_log(int);\n\n/*\n * gnu_binutils.c\n */\n\n/* NO LONGER IN USE */\n\n/*\n * test.c\n */\nvoid cmd_template(void);\nvoid foreach_test(ulong, ulong);\n\n/*\n * va_server.c\n */\nint mclx_page_size(void);\nint vas_memory_used(void);\nint vas_memory_dump(FILE *);\nint vas_free_memory(char *);\nvoid set_vas_debug(ulong);\nsize_t vas_write(void *, size_t);\nint va_server_init(char *, ulong *, ulong *, ulong *);\nsize_t vas_read(void *, size_t);\nint vas_lseek(ulong, int);\n\n/*\n * lkcd_x86_trace.c\n */\nint lkcd_x86_back_trace(struct bt_info *, int, FILE *);\n\n/*\n * lkcd_common.c\n */\nint lkcd_dump_init(FILE *, int, char *);\nulong get_lkcd_panic_task(void);\nvoid get_lkcd_panicmsg(char *);\nint is_lkcd_compressed_dump(char *);\nvoid dump_lkcd_environment(ulong);\nint lkcd_lseek(physaddr_t);\nlong lkcd_read(void *, long);\nvoid set_lkcd_debug(ulong);\nFILE *set_lkcd_fp(FILE *);\nuint lkcd_page_size(void);\nint lkcd_memory_used(void);\nint lkcd_memory_dump(FILE *);\nint lkcd_free_memory(void);\nvoid lkcd_print(char *, ...);\nvoid set_remote_lkcd_panic_data(ulong, char *);\nvoid set_lkcd_nohash(void);\nint lkcd_load_dump_page_header(void *, ulong);\nvoid lkcd_dumpfile_complaint(uint32_t, uint32_t, int);\nint set_mb_benchmark(ulong);\nulonglong fix_lkcd_address(ulonglong);\nint lkcd_get_kernel_start(ulong *addr);\nint get_lkcd_regs_for_cpu(struct bt_info *bt, ulong *eip, ulong *esp);\n\n/*\n * lkcd_v1.c\n */\nint lkcd_dump_init_v1(FILE *, int);\nvoid dump_dump_page_v1(char *, void *);\nvoid dump_lkcd_environment_v1(ulong);\nuint32_t get_dp_size_v1(void);\nuint32_t get_dp_flags_v1(void);\nuint64_t get_dp_address_v1(void);\n\n/*\n * lkcd_v2_v3.c\n */\nint lkcd_dump_init_v2_v3(FILE *, int);\nvoid dump_dump_page_v2_v3(char *, void *);\nvoid dump_lkcd_environment_v2_v3(ulong);\nuint32_t get_dp_size_v2_v3(void);\nuint32_t get_dp_flags_v2_v3(void);\nuint64_t get_dp_address_v2_v3(void);\n\n/*\n * lkcd_v5.c\n */\nint lkcd_dump_init_v5(FILE *, int);\nvoid dump_dump_page_v5(char *, void *);\nvoid dump_lkcd_environment_v5(ulong);\nuint32_t get_dp_size_v5(void); \nuint32_t get_dp_flags_v5(void);\n```\n\n### ppc64.c\n\n#### set_ppc64_max_physmem_bits() [lines 222-258]\n```c\n\n#define is_RHEL8() (strstr(kt->proc_version, \".el8.\"))\n\nstatic int set_ppc64_max_physmem_bits(void)\n{\n\tint dimension;\n\tchar *string;\n\n\tif ((string = pc->read_vmcoreinfo(\"NUMBER(MAX_PHYSMEM_BITS)\"))) {\n\t\tmachdep->max_physmem_bits = atol(string);\n\t\tfree(string);\n\t\treturn 0;\n\t}\n\n\tget_array_length(\"mem_section\", &dimension, 0);\n\n\tif ((machdep->flags & VMEMMAP) &&\n\t (THIS_KERNEL_VERSION >= LINUX(4,20,0)) &&\n\t !dimension && (machdep->pagesize == 65536)) {\n\t\t/*\n\t\t * SPARSEMEM_VMEMMAP & SPARSEMEM_EXTREME configurations with\n\t\t * 64K pagesize and v4.20 kernel or later.\n\t\t */\n\t\tmachdep->max_physmem_bits = _MAX_PHYSMEM_BITS_4_20;\n\t} else if ((machdep->flags & VMEMMAP) &&\n\t ((THIS_KERNEL_VERSION >= LINUX(4,19,0)) || is_RHEL8())) {\n\t\t/* SPARSEMEM_VMEMMAP & v4.19 kernel or later, or RHEL8 */\n\t\tmachdep->max_physmem_bits = _MAX_PHYSMEM_BITS_4_19;\n\t} else if (THIS_KERNEL_VERSION >= LINUX(3,7,0))\n\t\tmachdep->max_physmem_bits = _MAX_PHYSMEM_BITS_3_7;\n\telse\n\t\tmachdep->max_physmem_bits = _MAX_PHYSMEM_BITS;\n\n\treturn 0;\n}\n\nstruct machine_specific ppc64_machine_specific = { \n```\n\n\n## Upstream Fix\n```diff\nFrom 599a6579aa916df7800f8e889d68e4287e4520dd Mon Sep 17 00:00:00 2001\nFrom: Hari Bathini <hbathini@linux.ibm.com>\nDate: Thu, 27 Sep 2018 02:06:49 +0530\nSubject: ppc64: increase MAX_PHYSMEM_BITS to 128TB\nUpstream: no, adapts the below upstream commit for SLE15 SP1\nGit-commit: 599a6579aa916df7800f8e889d68e4287e4520dd\n\nWith Linux 4.19-rc1 commit 7d4340bb92a9df78e6e28152f3dd89d9bd82146b,\ntitled \"powerpc/mm: Increase MAX_PHYSMEM_BITS to 128TB with\nSPARSEMEM_VMEMMAP config\", the PPC64 MAX_PHYSMEM_BITS value has been\nbumped up to 47. The appropriate update has been made in this patch.\n(hbathini@linux.ibm.com)\n\n[note: apply on 4.12+ for SLE 15 SP1 - incompatible with SLE 15 SP0]\n---\n\nIndex: crash-7.2.8/defs.h\n===================================================================\n--- crash-7.2.8.orig/defs.h\n+++ crash-7.2.8/defs.h\n@@ -6896,6 +6896,9 @@ extern struct lkcd_environment *lkcd;\n #define is_SLES9() \\\n \t((THIS_KERNEL_VERSION == LINUX(2,6,5)) && kt->is_suse_kernel)\n \n+#define is_SLE15SP1() \\\n+\t((THIS_KERNEL_VERSION >= LINUX(4,12,0)) && kt->is_suse_kernel)\n+\n /*\n * gdb_interface.c\n */\nIndex: crash-7.2.8/ppc64.c\n===================================================================\n--- crash-7.2.8.orig/ppc64.c\n+++ crash-7.2.8/ppc64.c\n@@ -244,9 +244,14 @@ static int set_ppc64_max_physmem_bits(vo\n \t\t */\n \t\tmachdep->max_physmem_bits = _MAX_PHYSMEM_BITS_4_20;\n \t} else if ((machdep->flags & VMEMMAP) &&\n-\t ((THIS_KERNEL_VERSION >= LINUX(4,19,0)) || is_RHEL8())) {\n-\t\t/* SPARSEMEM_VMEMMAP & v4.19 kernel or later, or RHEL8 */\n-\t\tmachdep->max_physmem_bits = _MAX_PHYSMEM_BITS_4_19;\n+\t ((THIS_KERNEL_VERSION >= LINUX(4,19,0)) ||\n+\t\tis_RHEL8() ||\n+\t\tis_SLE15SP1())) {\n+\t\t\t/*\n+\t\t\t * SPARSEMEM_VMEMMAP & v4.19 kernel or later,\n+\t\t\t * or RHEL8 or SLE-15-SP1\n+\t\t\t */\n+\t\t\tmachdep->max_physmem_bits = _MAX_PHYSMEM_BITS_4_19;\n \t} else if (THIS_KERNEL_VERSION >= LINUX(3,7,0))\n \t\tmachdep->max_physmem_bits = _MAX_PHYSMEM_BITS_3_7;\n \telse\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "From 599a6579aa916df7800f8e889d68e4287e4520dd Mon Sep 17 00:00:00 2001\nFrom: Hari Bathini <hbathini@linux.ibm.com>\nDate: Thu, 27 Sep 2018 02:06:49 +0530\nSubject: ppc64: increase MAX_PHYSMEM_BITS to 128TB\nUpstream: no, adapts the below upstream commit for SLE15 SP1\nGit-commit: 599a6579aa916df7800f8e889d68e4287e4520dd\n\nWith Linux 4.19-rc1 commit 7d4340bb92a9df78e6e28152f3dd89d9bd82146b,\ntitled \"powerpc/mm: Increase MAX_PHYSMEM_BITS to 128TB with\nSPARSEMEM_VMEMMAP config\", the PPC64 MAX_PHYSMEM_BITS value has been\nbumped up to 47. The appropriate update has been made in this patch.\n(hbathini@linux.ibm.com)\n\n[note: apply on 4.12+ for SLE 15 SP1 - incompatible with SLE 15 SP0]\n---\n\nIndex: crash-7.2.8/defs.h\n===================================================================\n--- crash-7.2.8.orig/defs.h\n+++ crash-7.2.8/defs.h\n@@ -6896,6 +6896,9 @@ extern struct lkcd_environment *lkcd;\n #define is_SLES9() \\\n \t((THIS_KERNEL_VERSION == LINUX(2,6,5)) && kt->is_suse_kernel)\n \n+#define is_SLE15SP1() \\\n+\t((THIS_KERNEL_VERSION >= LINUX(4,12,0)) && kt->is_suse_kernel)\n+\n /*\n * gdb_interface.c\n */\nIndex: crash-7.2.8/ppc64.c\n===================================================================\n--- crash-7.2.8.orig/ppc64.c\n+++ crash-7.2.8/ppc64.c\n@@ -244,9 +244,14 @@ static int set_ppc64_max_physmem_bits(vo\n \t\t */\n \t\tmachdep->max_physmem_bits = _MAX_PHYSMEM_BITS_4_20;\n \t} else if ((machdep->flags & VMEMMAP) &&\n-\t ((THIS_KERNEL_VERSION >= LINUX(4,19,0)) || is_RHEL8())) {\n-\t\t/* SPARSEMEM_VMEMMAP & v4.19 kernel or later, or RHEL8 */\n-\t\tmachdep->max_physmem_bits = _MAX_PHYSMEM_BITS_4_19;\n+\t ((THIS_KERNEL_VERSION >= LINUX(4,19,0)) ||\n+\t\tis_RHEL8() ||\n+\t\tis_SLE15SP1())) {\n+\t\t\t/*\n+\t\t\t * SPARSEMEM_VMEMMAP & v4.19 kernel or later,\n+\t\t\t * or RHEL8 or SLE-15-SP1\n+\t\t\t */\n+\t\t\tmachdep->max_physmem_bits = _MAX_PHYSMEM_BITS_4_19;\n \t} else if (THIS_KERNEL_VERSION >= LINUX(3,7,0))\n \t\tmachdep->max_physmem_bits = _MAX_PHYSMEM_BITS_3_7;\n \telse\n"}], "metadata": {"id": "crash-13737-crash-SLE15-SP1-With-Linux-4.19-rc1-up-MAX_PHYSMEM_BITS-to-128TB.patch", "cve_id": "CVE-2020-14356", "cves": ["CVE-2020-0305", "CVE-2020-10135", "CVE-2020-10781", "CVE-2020-14331", "CVE-2020-14356", "CVE-2020-15780", "CVE-2020-16166"], "package": "crash", "incident_id": 13737, "patch_name": "crash-SLE15-SP1-With-Linux-4.19-rc1-up-MAX_PHYSMEM_BITS-to-128TB.patch", "tier": "identical", "language": "c", "patch_lines_changed": 14, "patch_files_count": 2, "total_tokens_est": 1120, "has_source_context": true, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2017-5715\n\nFrom: Petr Tesarik <ptesarik@suse.cz>\n\n## Package\ncrash\n\n## Files to modify\n- Makefile\n\n## Upstream Fix\n```diff\nFrom: Petr Tesarik <ptesarik@suse.cz>\nSubject: Apply custom patches to gdb\nPatch-mainline: never\n\nEnhance the crash specfile to allow applying custom patches.\n\nUpdate jeffm 17 Sep 2014: What used to be in the series file is now in\ngdb-7.6-ppc64le-support.patch. We used to apply it unconditionally so\nwe'll continue to do so.\n\nSigned-off-by: Petr Tesarik <ptesarik@suse.cz>\n\n---\n Makefile | 7 +++++--\n 1 file changed, 5 insertions(+), 2 deletions(-)\n\n--- a/Makefile\n+++ b/Makefile\n@@ -263,8 +263,11 @@ gdb_unzip:\n gdb_patch:\n \tif [ -f ${GDB}.patch ] && [ -s ${GDB}.patch ]; then \\\n \t\tpatch -p0 < ${GDB}.patch; cp ${GDB}.patch ${GDB}; fi\n-\tif [ \"${ARCH}\" = \"ppc64le\" ] && [ -f ${GDB}-ppc64le-support.patch ]; then \\\n-\t\tpatch -d ${GDB} -p1 -F0 < ${GDB}-ppc64le-support.patch ; \\\n+\tpatch -d ${GDB} -p1 -F0 < ${GDB}-ppc64le-support.patch ; \\\n+\tif [ -f ${GDB}.series ]; then \\\n+\t\twhile read p; do \\\n+\t\t\tpatch -d ${GDB} -p1 -F0 < \"$$p\" ; \\\n+\t\tdone < ${GDB}.series ; \\\n \tfi\n \tif [ \"${ARCH}\" = \"x86_64\" ] && [ \"${TARGET}\" = \"PPC64\" ] && [ -f ${GDB}-ppc64le-support.patch ]; then \\\n \t\tpatch -d ${GDB} -p1 -F0 < ${GDB}-ppc64le-support.patch ; \\\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "From: Petr Tesarik <ptesarik@suse.cz>\nSubject: Apply custom patches to gdb\nPatch-mainline: never\n\nEnhance the crash specfile to allow applying custom patches.\n\nUpdate jeffm 17 Sep 2014: What used to be in the series file is now in\ngdb-7.6-ppc64le-support.patch. We used to apply it unconditionally so\nwe'll continue to do so.\n\nSigned-off-by: Petr Tesarik <ptesarik@suse.cz>\n\n---\n Makefile | 7 +++++--\n 1 file changed, 5 insertions(+), 2 deletions(-)\n\n--- a/Makefile\n+++ b/Makefile\n@@ -263,8 +263,11 @@ gdb_unzip:\n gdb_patch:\n \tif [ -f ${GDB}.patch ] && [ -s ${GDB}.patch ]; then \\\n \t\tpatch -p0 < ${GDB}.patch; cp ${GDB}.patch ${GDB}; fi\n-\tif [ \"${ARCH}\" = \"ppc64le\" ] && [ -f ${GDB}-ppc64le-support.patch ]; then \\\n-\t\tpatch -d ${GDB} -p1 -F0 < ${GDB}-ppc64le-support.patch ; \\\n+\tpatch -d ${GDB} -p1 -F0 < ${GDB}-ppc64le-support.patch ; \\\n+\tif [ -f ${GDB}.series ]; then \\\n+\t\twhile read p; do \\\n+\t\t\tpatch -d ${GDB} -p1 -F0 < \"$$p\" ; \\\n+\t\tdone < ${GDB}.series ; \\\n \tfi\n \tif [ \"${ARCH}\" = \"x86_64\" ] && [ \"${TARGET}\" = \"PPC64\" ] && [ -f ${GDB}-ppc64le-support.patch ]; then \\\n \t\tpatch -d ${GDB} -p1 -F0 < ${GDB}-ppc64le-support.patch ; \\\n"}], "metadata": {"id": "crash-8217-crash-patch-gdb.patch", "cve_id": "CVE-2017-5715", "cves": ["CVE-2017-5715"], "package": "crash", "incident_id": 8217, "patch_name": "crash-patch-gdb.patch", "tier": "identical", "language": "unknown", "patch_lines_changed": 7, "patch_files_count": 0, "total_tokens_est": 689, "has_source_context": false, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2015-8956, CVE-2016-5195, CVE-2016-8658, CVE-2016-7117, CVE-2016-0823, CVE-2016-7425, CVE-2016-6327, CVE-2016-6828, CVE-2016-5696, CVE-2016-6480, CVE-2015-7513, CVE-2016-1237\n\nFrom: Petr Tesarik <ptesarik@suse.cz>\n\n## Package\ncrash\n\n## Files to modify\n- Makefile\n\n## Upstream Fix\n```diff\nFrom: Petr Tesarik <ptesarik@suse.cz>\nSubject: Apply custom patches to gdb\nPatch-mainline: never\n\nEnhance the crash specfile to allow applying custom patches.\n\nUpdate jeffm 17 Sep 2014: What used to be in the series file is now in\ngdb-7.6-ppc64le-support.patch. We used to apply it unconditionally so\nwe'll continue to do so.\n\nSigned-off-by: Petr Tesarik <ptesarik@suse.cz>\n\n---\n Makefile | 7 +++++--\n 1 file changed, 5 insertions(+), 2 deletions(-)\n\n--- a/Makefile\t2014-09-17 10:54:23.070488397 -0400\n+++ b/Makefile\t2014-09-17 10:54:59.557726952 -0400\n@@ -260,8 +260,11 @@ gdb_unzip:\n gdb_patch:\n \tif [ -f ${GDB}.patch ] && [ -s ${GDB}.patch ]; then \\\n \t\tpatch -p0 < ${GDB}.patch; cp ${GDB}.patch ${GDB}; fi\n-\tif [ \"${ARCH}\" = \"ppc64le\" ] && [ -f ${GDB}-ppc64le-support.patch ]; then \\\n-\t\tpatch -d ${GDB} -p1 -F0 < ${GDB}-ppc64le-support.patch ; \\\n+\tpatch -d ${GDB} -p1 -F0 < ${GDB}-ppc64le-support.patch ; \\\n+\tif [ -f ${GDB}.series ]; then \\\n+\t\twhile read p; do \\\n+\t\t\tpatch -d ${GDB} -p1 -F0 < \"$$p\" ; \\\n+\t\tdone < ${GDB}.series ; \\\n \tfi\n \n library: make_build_data ${OBJECT_FILES}\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "From: Petr Tesarik <ptesarik@suse.cz>\nSubject: Apply custom patches to gdb\nPatch-mainline: never\n\nEnhance the crash specfile to allow applying custom patches.\n\nUpdate jeffm 17 Sep 2014: What used to be in the series file is now in\ngdb-7.6-ppc64le-support.patch. We used to apply it unconditionally so\nwe'll continue to do so.\n\nSigned-off-by: Petr Tesarik <ptesarik@suse.cz>\n\n---\n Makefile | 7 +++++--\n 1 file changed, 5 insertions(+), 2 deletions(-)\n\n--- a/Makefile\t2014-09-17 10:54:23.070488397 -0400\n+++ b/Makefile\t2014-09-17 10:54:59.557726952 -0400\n@@ -260,8 +260,11 @@ gdb_unzip:\n gdb_patch:\n \tif [ -f ${GDB}.patch ] && [ -s ${GDB}.patch ]; then \\\n \t\tpatch -p0 < ${GDB}.patch; cp ${GDB}.patch ${GDB}; fi\n-\tif [ \"${ARCH}\" = \"ppc64le\" ] && [ -f ${GDB}-ppc64le-support.patch ]; then \\\n-\t\tpatch -d ${GDB} -p1 -F0 < ${GDB}-ppc64le-support.patch ; \\\n+\tpatch -d ${GDB} -p1 -F0 < ${GDB}-ppc64le-support.patch ; \\\n+\tif [ -f ${GDB}.series ]; then \\\n+\t\twhile read p; do \\\n+\t\t\tpatch -d ${GDB} -p1 -F0 < \"$$p\" ; \\\n+\t\tdone < ${GDB}.series ; \\\n \tfi\n \n library: make_build_data ${OBJECT_FILES}\n"}], "metadata": {"id": "crash-5752-crash-patch-gdb.patch", "cve_id": "CVE-2015-8956", "cves": ["CVE-2015-7513", "CVE-2015-8956", "CVE-2016-0823", "CVE-2016-1237", "CVE-2016-5195", "CVE-2016-5696", "CVE-2016-6327", "CVE-2016-6480", "CVE-2016-6828", "CVE-2016-7117", "CVE-2016-7425", "CVE-2016-8658"], "package": "crash", "incident_id": 5752, "patch_name": "crash-patch-gdb.patch", "tier": "identical", "language": "unknown", "patch_lines_changed": 7, "patch_files_count": 0, "total_tokens_est": 704, "has_source_context": false, "upstream_enriched": false, "suse_license": "GFDL-1.2-only AND GPL-3.0-or-later"}}
{"messages": [{"role": "system", "content": "You are a security patch backporting assistant for SUSE/openSUSE.\n\nGiven a CVE description and an upstream fix, adapt the patch to work with\nthe target SUSE package version. Output the backported patch in unified\ndiff format. If the upstream fix applies directly, output it unchanged."}, {"role": "user", "content": "## CVE: CVE-2018-5383\n\nVersion 16.242414.0\n\n## Package\nkernel-firmware\n\n## Upstream Fix\n```diff\n--- kernel-firmware-20170530.old/WHENCE\t2017-05-30 21:23:02.000000000 +0200\n+++ kernel-firmware-20170530/WHENCE\t2017-11-15 14:53:05.255112317 +0100\n@@ -861,7 +861,7 @@\n Version 16.242414.0\n \n File: iwlwifi-7260-17.ucode\n-Version 17.459231.0\n+Version 17.608620.0\n \n File: iwlwifi-3160-7.ucode\n Version: 22.1.7.0\n@@ -885,7 +885,7 @@\n Version 16.242414.0\n \n File: iwlwifi-3160-17.ucode\n-Version 17.459231.0\n+Version 17.608620.0\n \n File: iwlwifi-7265-8.ucode\n Version: 22.24.8.0\n@@ -906,7 +906,7 @@\n Version 16.242414.0\n \n File: iwlwifi-7265-17.ucode\n-Version 17.459231.0\n+Version 17.608620.0\n \n File: iwlwifi-7265D-10.ucode\n Version: 23.15.10.0\n\n```\n\nGenerate a backported patch for the SUSE target version."}, {"role": "assistant", "content": "--- kernel-firmware-20170530.old/WHENCE\t2017-05-30 21:23:02.000000000 +0200\n+++ kernel-firmware-20170530/WHENCE\t2017-11-15 14:53:05.255112317 +0100\n@@ -861,7 +861,7 @@\n Version 16.242414.0\n \n File: iwlwifi-7260-17.ucode\n-Version 17.459231.0\n+Version 17.608620.0\n \n File: iwlwifi-3160-7.ucode\n Version: 22.1.7.0\n@@ -885,7 +885,7 @@\n Version 16.242414.0\n \n File: iwlwifi-3160-17.ucode\n-Version 17.459231.0\n+Version 17.608620.0\n \n File: iwlwifi-7265-8.ucode\n Version: 22.24.8.0\n@@ -906,7 +906,7 @@\n Version 16.242414.0\n \n File: iwlwifi-7265-17.ucode\n-Version 17.459231.0\n+Version 17.608620.0\n \n File: iwlwifi-7265D-10.ucode\n Version: 23.15.10.0\n"}], "metadata": {"id": "kernel-firmware-9719-WHNCE-iwlwifi-update.patch", "cve_id": "CVE-2018-5383", "cves": ["CVE-2018-5383"], "package": "kernel-firmware", "incident_id": 9719, "patch_name": "WHNCE-iwlwifi-update.patch", "tier": "identical", "language": "unknown", "patch_lines_changed": 6, "patch_files_count": 0, "total_tokens_est": 431, "has_source_context": false, "upstream_enriched": false, "suse_license": "SUSE-Proprietary-or-OSS"}}