github.com/google/syzkaller@v0.0.0-20251211124644-a066d2bc4b02/pkg/email/parser_test.go (about) 1 // Copyright 2017 syzkaller project authors. All rights reserved. 2 // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 package email 5 6 import ( 7 "fmt" 8 "strings" 9 "testing" 10 "time" 11 12 "github.com/google/go-cmp/cmp" 13 ) 14 15 func TestExtractCommand(t *testing.T) { 16 for i, test := range extractCommandTests { 17 t.Run(fmt.Sprint(i), func(t *testing.T) { 18 cmd, _ := extractCommand(test.body) 19 if diff := cmp.Diff(test.cmd, cmd); diff != "" { 20 t.Fatal(diff) 21 } 22 cmd, _ = extractCommand(strings.ReplaceAll(test.body, "\n", "\r\n")) 23 if diff := cmp.Diff(test.cmd, cmd); diff != "" { 24 t.Fatal(diff) 25 } 26 }) 27 } 28 } 29 30 func TestAddRemoveAddrContext(t *testing.T) { 31 email := `"Foo Bar" <foo@bar.com>` 32 email00, context00, err := RemoveAddrContext(email) 33 if err != nil { 34 t.Fatal(err) 35 } 36 if email != email00 { 37 t.Fatalf("want: %q, got %q", email, email00) 38 } 39 if context00 != "" { 40 t.Fatalf("want context: %q, got %q", "", context00) 41 } 42 context1 := "context1" 43 email1, err := AddAddrContext(email, context1) 44 if err != nil { 45 t.Fatal(err) 46 } 47 want1 := `"Foo Bar" <foo+context1@bar.com>` 48 if want1 != email1 { 49 t.Fatalf("want: %q, got %q", want1, email1) 50 } 51 context2 := "context2" 52 email2, err := AddAddrContext(email1, context2) 53 if err != nil { 54 t.Fatal(err) 55 } 56 want2 := `"Foo Bar" <foo+context1+context2@bar.com>` 57 if want2 != email2 { 58 t.Fatalf("want: %q, got %q", want2, email2) 59 } 60 email1, context20, err := RemoveAddrContext(email2) 61 if err != nil { 62 t.Fatal(err) 63 } 64 if want1 != email1 { 65 t.Fatalf("want: %q, got %q", want1, email1) 66 } 67 if context2 != context20 { 68 t.Fatalf("want context: %q, got %q", context2, context20) 69 } 70 email0, context10, err := RemoveAddrContext(email1) 71 if err != nil { 72 t.Fatal(err) 73 } 74 if email != email0 { 75 t.Fatalf("want: %q, got %q", email, email0) 76 } 77 if context1 != context10 { 78 t.Fatalf("want context: %q, got %q", context1, context10) 79 } 80 } 81 82 func TestAddAddrContextEmptyName(t *testing.T) { 83 email := "<foo@bar.com>" 84 email1, err := AddAddrContext(email, "context") 85 if err != nil { 86 t.Fatal(err) 87 } 88 if want := "foo+context@bar.com"; want != email1 { 89 t.Fatalf("want: %q, got %q", want, email1) 90 } 91 email2, context1, err := RemoveAddrContext(email1) 92 if err != nil { 93 t.Fatal(err) 94 } 95 if email != email2 { 96 t.Fatalf("want: %q, got %q", email, email2) 97 } 98 if context1 != "context" { 99 t.Fatalf("got context %q", context1) 100 } 101 } 102 103 func TestCanonicalEmail(t *testing.T) { 104 canonical := "foo@bar.com" 105 emails := []string{ 106 "\"Foo Bar\" <foo+123+456@Bar.com>", 107 "<Foo@bar.com>", 108 } 109 for _, email := range emails { 110 if got := CanonicalEmail(email); got != canonical { 111 t.Errorf("got %q, want %q", got, canonical) 112 } 113 } 114 } 115 116 func TestParse(t *testing.T) { 117 for i, test := range parseTests { 118 body := func(t *testing.T, test ParseTest) { 119 email, err := Parse(strings.NewReader(test.email), 120 []string{"bot <foo@bar.com>"}, 121 []string{"list@googlegroups.com"}, 122 []string{"bar.com"}, 123 ) 124 if err != nil { 125 t.Fatal(err) 126 } 127 if diff := cmp.Diff(&test.res, email); diff != "" { 128 t.Error(diff) 129 } 130 } 131 t.Run(fmt.Sprint(i), func(t *testing.T) { body(t, test) }) 132 133 test.email = strings.ReplaceAll(test.email, "\n", "\r\n") 134 test.res.Body = strings.ReplaceAll(test.res.Body, "\n", "\r\n") 135 t.Run(fmt.Sprint(i)+"rn", func(t *testing.T) { body(t, test) }) 136 } 137 } 138 139 var extractCommandTests = []struct { 140 body string 141 cmd *SingleCommand 142 }{ 143 { 144 body: `Hello, 145 146 line1 147 #syz fix: bar baz `, 148 cmd: &SingleCommand{ 149 Command: CmdFix, 150 Str: "fix:", 151 Args: "bar baz", 152 }, 153 }, 154 { 155 body: `Hello, 156 157 line1 158 #syz fix bar baz 159 line 2 160 `, 161 cmd: &SingleCommand{ 162 Command: CmdFix, 163 Str: "fix", 164 Args: "bar baz", 165 }, 166 }, 167 { 168 body: ` 169 line1 170 > #syz fix: bar baz 171 line 2 172 `, 173 cmd: nil, 174 }, 175 { 176 body: `#syz-fix: bar baz`, 177 cmd: &SingleCommand{ 178 Command: CmdFix, 179 Str: "fix:", 180 Args: "bar baz", 181 }, 182 }, 183 { 184 body: `#syz-fix bar baz`, 185 cmd: &SingleCommand{ 186 Command: CmdFix, 187 Str: "fix", 188 Args: "bar baz", 189 }, 190 }, 191 { 192 body: `#syz: fix: bar baz`, 193 cmd: &SingleCommand{ 194 Command: CmdFix, 195 Str: "fix:", 196 Args: "bar baz", 197 }, 198 }, 199 // This is unfortunate case when a command is split by email client 200 // due to 80-column limitation. 201 { 202 body: ` 203 #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 204 locking/core 205 `, 206 cmd: &SingleCommand{ 207 Command: CmdTest, 208 Str: "test:", 209 Args: "git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core", 210 }, 211 }, 212 { 213 body: ` 214 #syz test 215 git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core 216 `, 217 cmd: &SingleCommand{ 218 Command: CmdTest, 219 Str: "test", 220 // We only look for arguments if there's ":" after "#syz test". 221 Args: "", 222 }, 223 }, 224 { 225 body: ` 226 #syz test: 227 git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 228 locking/core 229 locking/core 230 `, 231 cmd: &SingleCommand{ 232 Command: CmdTest, 233 Str: "test:", 234 Args: "git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core", 235 }, 236 }, 237 { 238 body: `#syz test: repo commit`, 239 cmd: &SingleCommand{ 240 Command: CmdTest, 241 Str: "test:", 242 Args: "repo commit", 243 }, 244 }, 245 { 246 body: `#syz test: repo commit`, 247 cmd: &SingleCommand{ 248 Command: CmdTest, 249 Str: "test:", 250 Args: "repo commit", 251 }, 252 }, 253 { 254 body: `#syz test 255 patch-begins 256 `, 257 cmd: &SingleCommand{ 258 Command: CmdTest, 259 Str: "test", 260 Args: "", 261 }, 262 }, 263 { 264 body: ` 265 #syz test_5_arg_cmd arg1 266 267 arg2 arg3 268 269 arg4 270 arg5 271 `, 272 cmd: &SingleCommand{ 273 Command: cmdTest5, 274 Str: "test_5_arg_cmd", 275 Args: "arg1 arg2 arg3 arg4 arg5", 276 }, 277 }, 278 { 279 body: `#syz test_5_arg_cmd arg1 arg2 arg3 arg4 arg5`, 280 cmd: &SingleCommand{ 281 Command: cmdTest5, 282 Str: "test_5_arg_cmd", 283 Args: "arg1 arg2 arg3 arg4 arg5", 284 }, 285 }, 286 { 287 body: ` 288 #syz test_5_arg_cmd arg1 289 arg2`, 290 cmd: &SingleCommand{ 291 Command: cmdTest5, 292 Str: "test_5_arg_cmd", 293 Args: "arg1 arg2", 294 }, 295 }, 296 { 297 body: ` 298 #syz test_5_arg_cmd arg1 299 arg2 300 `, 301 cmd: &SingleCommand{ 302 Command: cmdTest5, 303 Str: "test_5_arg_cmd", 304 Args: "arg1 arg2", 305 }, 306 }, 307 { 308 body: ` 309 #syz test_5_arg_cmd arg1 310 arg2 311 312 313 `, 314 cmd: &SingleCommand{ 315 Command: cmdTest5, 316 Str: "test_5_arg_cmd", 317 Args: "arg1 arg2", 318 }, 319 }, 320 { 321 body: ` 322 #syz fix: 323 arg1 arg2 arg3 324 arg4 arg5 325 326 `, 327 cmd: &SingleCommand{ 328 Command: CmdFix, 329 Str: "fix:", 330 Args: "arg1 arg2 arg3", 331 }, 332 }, 333 { 334 body: ` 335 #syz fix: arg1 arg2 arg3 336 arg4 arg5 337 `, 338 cmd: &SingleCommand{ 339 Command: CmdFix, 340 Str: "fix:", 341 Args: "arg1 arg2 arg3", 342 }, 343 }, 344 { 345 body: ` 346 #syz dup: title goes here 347 baz 348 `, 349 cmd: &SingleCommand{ 350 Command: CmdDup, 351 Str: "dup:", 352 Args: "title goes here", 353 }, 354 }, 355 { 356 body: ` 357 #syz dup 358 title on the next line goes here 359 but not this one 360 `, 361 cmd: &SingleCommand{ 362 Command: CmdDup, 363 Str: "dup", 364 Args: "title on the next line goes here", 365 }, 366 }, 367 { 368 body: ` 369 #syz foo bar 370 baz 371 `, 372 cmd: &SingleCommand{ 373 Command: CmdUnknown, 374 Str: "foo", 375 }, 376 }, 377 { 378 body: ` 379 #syz set subsystems: net, fs 380 `, 381 cmd: &SingleCommand{ 382 Command: CmdSet, 383 Str: "set", 384 Args: "subsystems: net, fs", 385 }, 386 }, 387 { 388 body: ` 389 #syz unset some tag 390 `, 391 cmd: &SingleCommand{ 392 Command: CmdUnset, 393 Str: "unset", 394 Args: "some tag", 395 }, 396 }, 397 { 398 body: ` 399 #syz fix: abcd 400 #syz fix: xyz 401 `, 402 // Should only extract the first one. 403 cmd: &SingleCommand{ 404 Command: CmdFix, 405 Str: "fix:", 406 Args: "abcd", 407 }, 408 }, 409 } 410 411 type ParseTest struct { 412 email string 413 res Email 414 } 415 416 var parseTestZone = time.FixedZone("", -7*60*60) 417 418 // nolint: lll 419 var parseTests = []ParseTest{ 420 {`Date: Sun, 7 May 2017 19:54:00 -0700 421 Message-ID: <123> 422 Subject: test subject 423 From: Bob <bob@example.com> 424 To: syzbot <foo+4564456@bar.com> 425 Content-Type: text/plain; charset="UTF-8" 426 427 text body 428 second line 429 #syz fix: arg1 arg2 arg3 430 last line 431 -- 432 You received this message because you are subscribed to the Google Groups "syzkaller" group. 433 To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller+unsubscribe@googlegroups.com. 434 To post to this group, send email to syzkaller@googlegroups.com. 435 To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller/abcdef@google.com. 436 For more options, visit https://groups.google.com/d/optout.`, 437 Email{ 438 BugIDs: []string{"4564456"}, 439 MessageID: "<123>", 440 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 441 Link: "https://groups.google.com/d/msgid/syzkaller/abcdef@google.com", 442 Subject: "test subject", 443 Author: "bob@example.com", 444 Cc: []string{"bob@example.com"}, 445 RawCc: []string{"bob@example.com", "foo+4564456@bar.com"}, 446 Body: `text body 447 second line 448 #syz fix: arg1 arg2 arg3 449 last line 450 -- 451 You received this message because you are subscribed to the Google Groups "syzkaller" group. 452 To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller+unsubscribe@googlegroups.com. 453 To post to this group, send email to syzkaller@googlegroups.com. 454 To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller/abcdef@google.com. 455 For more options, visit https://groups.google.com/d/optout.`, 456 Patch: "", 457 Commands: []*SingleCommand{ 458 { 459 Command: CmdFix, 460 Str: "fix:", 461 Args: "arg1 arg2 arg3", 462 }, 463 }, 464 }}, 465 {`Date: Sun, 7 May 2017 19:54:00 -0700 466 Message-ID: <123> 467 Subject: new footer 468 From: Bob <bob@example.com> 469 To: syzbot <foo+4564456@bar.com> 470 Content-Type: text/plain; charset="UTF-8" 471 472 some title 473 474 -- 475 You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group. 476 To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@googlegroups.com. 477 To view this discussion visit https://groups.google.com/d/msgid/syzkaller-bugs/671b7fb2.050a0220.2e773.0000.GAE%40google.com.`, 478 Email{ 479 BugIDs: []string{"4564456"}, 480 MessageID: "<123>", 481 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 482 Link: "https://groups.google.com/d/msgid/syzkaller-bugs/671b7fb2.050a0220.2e773.0000.GAE@google.com", 483 Subject: "new footer", 484 Author: "bob@example.com", 485 Cc: []string{"bob@example.com"}, 486 RawCc: []string{"bob@example.com", "foo+4564456@bar.com"}, 487 Body: `some title 488 489 -- 490 You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group. 491 To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@googlegroups.com. 492 To view this discussion visit https://groups.google.com/d/msgid/syzkaller-bugs/671b7fb2.050a0220.2e773.0000.GAE%40google.com.`, 493 Patch: "", 494 }}, 495 496 {`Date: Sun, 7 May 2017 19:54:00 -0700 497 Message-ID: <123> 498 Subject: test subject 499 From: syzbot <foo+4564456@bar.com> 500 To: Bob <bob@example.com> 501 Content-Type: text/plain; charset="UTF-8" 502 503 text body 504 last line`, 505 Email{ 506 BugIDs: []string{"4564456"}, 507 MessageID: "<123>", 508 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 509 Subject: "test subject", 510 Author: "foo@bar.com", 511 OwnEmail: true, 512 Cc: []string{"bob@example.com"}, 513 RawCc: []string{"bob@example.com", "foo+4564456@bar.com"}, 514 Body: `text body 515 last line`, 516 Patch: "", 517 }}, 518 519 {`Date: Sun, 7 May 2017 19:54:00 -0700 520 Message-ID: <123> 521 Subject: test subject 522 From: Bob <bob@example.com> 523 To: syzbot <bot@example.com>, Alice <alice@example.com> 524 525 #syz invalid 526 text body 527 second line 528 last line`, 529 Email{ 530 MessageID: "<123>", 531 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 532 Subject: "test subject", 533 Author: "bob@example.com", 534 Cc: []string{"alice@example.com", "bob@example.com", "bot@example.com"}, 535 RawCc: []string{"alice@example.com", "bob@example.com", "bot@example.com"}, 536 Body: `#syz invalid 537 text body 538 second line 539 last line`, 540 Patch: "", 541 Commands: []*SingleCommand{ 542 { 543 Command: CmdInvalid, 544 Str: "invalid", 545 Args: "", 546 }, 547 }, 548 }}, 549 550 {`Date: Sun, 7 May 2017 19:54:00 -0700 551 Message-ID: <123> 552 Subject: test subject 553 From: Bob <bob@example.com> 554 To: syzbot <bot@example.com>, Alice <alice@example.com> 555 Content-Type: text/plain 556 557 text body 558 second line 559 last line 560 #syz command`, 561 Email{ 562 MessageID: "<123>", 563 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 564 Subject: "test subject", 565 Author: "bob@example.com", 566 Cc: []string{"alice@example.com", "bob@example.com", "bot@example.com"}, 567 RawCc: []string{"alice@example.com", "bob@example.com", "bot@example.com"}, 568 Body: `text body 569 second line 570 last line 571 #syz command`, 572 Patch: "", 573 Commands: []*SingleCommand{ 574 { 575 Command: CmdUnknown, 576 Str: "command", 577 }, 578 }, 579 }}, 580 581 {`Date: Sun, 7 May 2017 19:54:00 -0700 582 Message-ID: <123> 583 Subject: test subject 584 From: Bob <bob@example.com> 585 To: syzbot <bot@example.com> 586 Content-Type: multipart/mixed; boundary="001a114ce0b01684a6054f0d8b81" 587 588 --001a114ce0b01684a6054f0d8b81 589 Content-Type: text/plain; charset="UTF-8" 590 591 body text 592 >#syz test 593 594 --001a114ce0b01684a6054f0d8b81 595 Content-Type: text/x-patch; charset="US-ASCII"; name="patch.patch" 596 Content-Disposition: attachment; filename="patch.patch" 597 Content-Transfer-Encoding: base64 598 X-Attachment-Id: f_j2gwcdoa1 599 600 ZGlmZiAtLWdpdCBhL2tlcm5lbC9rY292LmMgYi9rZXJuZWwva2Nvdi5jCmluZGV4IDg1ZTU1NDZj 601 ZDc5MS4uOTQ5ZWE0NTc0NDEyIDEwMDY0NAotLS0gYS9rZXJuZWwva2Nvdi5jCisrKyBiL2tlcm5l 602 bC9rY292LmMKQEAgLTEyNyw3ICsxMjcsNiBAQCB2b2lkIGtjb3ZfdGFza19leGl0KHN0cnVjdCB0 603 YXNrX3N0cnVjdCAqdCkKIAlrY292ID0gdC0+a2NvdjsKIAlpZiAoa2NvdiA9PSBOVUxMKQogCQly 604 ZXR1cm47Ci0Jc3Bpbl9sb2NrKCZrY292LT5sb2NrKTsKIAlpZiAoV0FSTl9PTihrY292LT50ICE9 605 IHQpKSB7CiAJCXNwaW5fdW5sb2NrKCZrY292LT5sb2NrKTsKIAkJcmV0dXJuOwo= 606 --001a114ce0b01684a6054f0d8b81--`, 607 Email{ 608 MessageID: "<123>", 609 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 610 Subject: "test subject", 611 Author: "bob@example.com", 612 Cc: []string{"bob@example.com", "bot@example.com"}, 613 RawCc: []string{"bob@example.com", "bot@example.com"}, 614 Body: `body text 615 >#syz test 616 `, 617 Patch: `diff --git a/kernel/kcov.c b/kernel/kcov.c 618 index 85e5546cd791..949ea4574412 100644 619 --- a/kernel/kcov.c 620 +++ b/kernel/kcov.c 621 @@ -127,7 +127,6 @@ void kcov_task_exit(struct task_struct *t) 622 kcov = t->kcov; 623 if (kcov == NULL) 624 return; 625 - spin_lock(&kcov->lock); 626 if (WARN_ON(kcov->t != t)) { 627 spin_unlock(&kcov->lock); 628 return; 629 `, 630 }}, 631 632 {`Date: Sun, 7 May 2017 19:54:00 -0700 633 Message-ID: <123> 634 Subject: test subject 635 From: Bob <bob@example.com> 636 To: syzbot <bot@example.com> 637 Content-Type: multipart/alternative; boundary="f403043eee70018593054f0d9f1f" 638 639 --f403043eee70018593054f0d9f1f 640 Content-Type: text/plain; charset="UTF-8" 641 642 On Mon, May 8, 2017 at 6:47 PM, Bob wrote: 643 > body text 644 645 #syz test 646 647 commit 59372bbf3abd5b24a7f6f676a3968685c280f955 648 Date: Thu Apr 27 13:54:11 2017 +0200 649 650 statx: correct error handling of NULL pathname 651 652 test patch. 653 654 diff --git a/fs/stat.c b/fs/stat.c 655 index 3d85747bd86e..a257b872a53d 100644 656 --- a/fs/stat.c 657 +++ b/fs/stat.c 658 @@ -567,8 +567,6 @@ SYSCALL_DEFINE5(statx, 659 return -EINVAL; 660 if ((flags & AT_STATX_SYNC_TYPE) == AT_STATX_SYNC_TYPE) 661 return -EINVAL; 662 - if (!filename) 663 - return -EINVAL; 664 665 error = vfs_statx(dfd, filename, flags, &stat, mask); 666 if (error) 667 668 --f403043eee70018593054f0d9f1f 669 Content-Type: text/html; charset="UTF-8" 670 Content-Transfer-Encoding: quoted-printable 671 672 <div dir=3D"ltr">On Mon, May 8, 2017 at 6:47 PM, Dmitry Vyukov <<a href= 673 =3D"mailto:bob@example.com">bob@example.com</a>> wrote:<br>> bo= 674 dy text<br><br>#syz test<br><br><div><div>commit 59372bbf3abd5b24a7f6f67= 675 6a3968685c280f955</div><div>Date: =C2=A0 Thu Apr 27 13:54:11 2017 +0200</di= 676 v><div><br></div><div>=C2=A0 =C2=A0 statx: correct error handling of NULL p= 677 athname</div><div>=C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0 test patch.</= 678 div><div><br></div><div>diff --git a/fs/stat.c b/fs/stat.c</div><div>index = 679 3d85747bd86e..a257b872a53d 100644</div><div>--- a/fs/stat.c</div><div>+++ b= 680 /fs/stat.c</div><div>@@ -567,8 +567,6 @@ SYSCALL_DEFINE5(statx,</div><div>= 681 =C2=A0<span class=3D"gmail-Apple-tab-span" style=3D"white-space:pre">=09=09= 682 </span>return -EINVAL;</div><div>=C2=A0<span class=3D"gmail-Apple-tab-span"= 683 style=3D"white-space:pre">=09</span>if ((flags & AT_STATX_SYNC_TYPE) = 684 =3D=3D AT_STATX_SYNC_TYPE)</div><div>=C2=A0<span class=3D"gmail-Apple-tab-s= 685 pan" style=3D"white-space:pre">=09=09</span>return -EINVAL;</div><div>-<spa= 686 n class=3D"gmail-Apple-tab-span" style=3D"white-space:pre">=09</span>if (!f= 687 ilename)</div><div>-<span class=3D"gmail-Apple-tab-span" style=3D"white-spa= 688 ce:pre">=09=09</span>return -EINVAL;</div><div>=C2=A0</div><div>=C2=A0<span= 689 class=3D"gmail-Apple-tab-span" style=3D"white-space:pre">=09</span>error = 690 =3D vfs_statx(dfd, filename, flags, &stat, mask);</div><div>=C2=A0<span= 691 class=3D"gmail-Apple-tab-span" style=3D"white-space:pre">=09</span>if (err= 692 or)</div></div></div> 693 694 --f403043eee70018593054f0d9f1f--`, 695 Email{ 696 MessageID: "<123>", 697 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 698 Subject: "test subject", 699 Author: "bob@example.com", 700 Cc: []string{"bob@example.com", "bot@example.com"}, 701 RawCc: []string{"bob@example.com", "bot@example.com"}, 702 Body: `On Mon, May 8, 2017 at 6:47 PM, Bob wrote: 703 > body text 704 705 #syz test 706 707 commit 59372bbf3abd5b24a7f6f676a3968685c280f955 708 Date: Thu Apr 27 13:54:11 2017 +0200 709 710 statx: correct error handling of NULL pathname 711 712 test patch. 713 714 diff --git a/fs/stat.c b/fs/stat.c 715 index 3d85747bd86e..a257b872a53d 100644 716 --- a/fs/stat.c 717 +++ b/fs/stat.c 718 @@ -567,8 +567,6 @@ SYSCALL_DEFINE5(statx, 719 return -EINVAL; 720 if ((flags & AT_STATX_SYNC_TYPE) == AT_STATX_SYNC_TYPE) 721 return -EINVAL; 722 - if (!filename) 723 - return -EINVAL; 724 725 error = vfs_statx(dfd, filename, flags, &stat, mask); 726 if (error) 727 `, 728 Patch: `diff --git a/fs/stat.c b/fs/stat.c 729 index 3d85747bd86e..a257b872a53d 100644 730 --- a/fs/stat.c 731 +++ b/fs/stat.c 732 @@ -567,8 +567,6 @@ SYSCALL_DEFINE5(statx, 733 return -EINVAL; 734 if ((flags & AT_STATX_SYNC_TYPE) == AT_STATX_SYNC_TYPE) 735 return -EINVAL; 736 - if (!filename) 737 - return -EINVAL; 738 739 error = vfs_statx(dfd, filename, flags, &stat, mask); 740 if (error) 741 `, 742 Commands: []*SingleCommand{ 743 { 744 Command: CmdTest, 745 Str: "test", 746 Args: "", 747 }, 748 }, 749 }}, 750 751 {`Sender: syzkaller-bugs@googlegroups.com 752 Subject: Re: BUG: unable to handle kernel NULL pointer dereference in 753 sock_poll 754 To: syzbot <syzbot+344bb0f46d7719cd9483@syzkaller.appspotmail.com> 755 From: bar <bar@foo.com> 756 Message-ID: <1250334f-7220-2bff-5d87-b87573758d81@bar.com> 757 Date: Sun, 10 Jun 2018 10:38:20 +0900 758 MIME-Version: 1.0 759 Content-Type: text/plain; charset="UTF-8" 760 Content-Language: en-US 761 Content-Transfer-Encoding: quoted-printable 762 763 On 2018/06/10 4:57, syzbot wrote: 764 > Hello, 765 >=20 766 > syzbot found the following crash on: 767 >=20 768 > HEAD commit: 7d3bf613e99a Merge tag 'libnvdimm-for-4.18= 769 ' of git://git.k.. 770 > git tree: upstream 771 > console output: https://syzkaller.appspot.com/x/log.txt?x=3D1188a05f80000= 772 0 773 > kernel config: https://syzkaller.appspot.com/x/.config?x=3Df04d8d0a= 774 2afb789a 775 776 #syz dup: BUG: unable to handle kernel NULL pointer dereference in corrupte= 777 d 778 `, Email{ 779 MessageID: "<1250334f-7220-2bff-5d87-b87573758d81@bar.com>", 780 Date: time.Date(2018, time.June, 10, 10, 38, 20, 0, time.FixedZone("", 9*60*60)), 781 Subject: "Re: BUG: unable to handle kernel NULL pointer dereference in sock_poll", 782 Author: "bar@foo.com", 783 Cc: []string{"bar@foo.com", "syzbot@syzkaller.appspotmail.com"}, 784 RawCc: []string{"bar@foo.com", "syzbot+344bb0f46d7719cd9483@syzkaller.appspotmail.com"}, 785 Body: `On 2018/06/10 4:57, syzbot wrote: 786 > Hello, 787 > 788 > syzbot found the following crash on: 789 > 790 > HEAD commit: 7d3bf613e99a Merge tag 'libnvdimm-for-4.18' of git://git.k.. 791 > git tree: upstream 792 > console output: https://syzkaller.appspot.com/x/log.txt?x=1188a05f800000 793 > kernel config: https://syzkaller.appspot.com/x/.config?x=f04d8d0a2afb789a 794 795 #syz dup: BUG: unable to handle kernel NULL pointer dereference in corrupted 796 `, 797 Commands: []*SingleCommand{ 798 { 799 Command: CmdDup, 800 Str: "dup:", 801 Args: "BUG: unable to handle kernel NULL pointer dereference in corrupted", 802 }, 803 }, 804 }}, 805 806 {`Sender: syzkaller-bugs@googlegroups.com 807 To: syzbot <syzbot+6dd701dc797b23b8c761@syzkaller.appspotmail.com> 808 From: bar@foo.com 809 810 #syz dup: 811 BUG: unable to handle kernel NULL pointer dereference in corrupted 812 `, Email{ 813 Author: "bar@foo.com", 814 Cc: []string{"bar@foo.com", "syzbot@syzkaller.appspotmail.com"}, 815 RawCc: []string{"bar@foo.com", "syzbot+6dd701dc797b23b8c761@syzkaller.appspotmail.com"}, 816 Body: `#syz dup: 817 BUG: unable to handle kernel NULL pointer dereference in corrupted 818 `, 819 Commands: []*SingleCommand{ 820 { 821 Command: CmdDup, 822 Str: "dup:", 823 Args: "BUG: unable to handle kernel NULL pointer dereference in corrupted", 824 }, 825 }, 826 }}, 827 828 {`Sender: syzkaller-bugs@googlegroups.com 829 To: syzbot <syzbot+6dd701dc797b23b8c761@syzkaller.appspotmail.com> 830 From: bar@foo.com 831 832 #syz fix: 833 When freeing a lockf struct that already is part of a linked list, make sure to 834 `, Email{ 835 Author: "bar@foo.com", 836 Cc: []string{"bar@foo.com", "syzbot@syzkaller.appspotmail.com"}, 837 RawCc: []string{"bar@foo.com", "syzbot+6dd701dc797b23b8c761@syzkaller.appspotmail.com"}, 838 Body: `#syz fix: 839 When freeing a lockf struct that already is part of a linked list, make sure to 840 `, 841 Commands: []*SingleCommand{ 842 { 843 Command: CmdFix, 844 Str: "fix:", 845 Args: "When freeing a lockf struct that already is part of a linked list, make sure to", 846 }, 847 }, 848 }}, 849 {`Date: Sun, 7 May 2017 19:54:00 -0700 850 Message-ID: <123> 851 Subject: #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master 852 From: bob@example.com 853 To: syzbot <foo+4564456@bar.com> 854 855 nothing to see here`, 856 Email{ 857 BugIDs: []string{"4564456"}, 858 MessageID: "<123>", 859 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 860 Subject: "#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master", 861 Author: "bob@example.com", 862 Cc: []string{"bob@example.com"}, 863 RawCc: []string{"bob@example.com", "foo+4564456@bar.com"}, 864 Body: `nothing to see here`, 865 Commands: []*SingleCommand{ 866 { 867 Command: CmdTest, 868 Str: "test:", 869 Args: "git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master", 870 }, 871 }, 872 }}, 873 {`Date: Sun, 7 May 2017 19:54:00 -0700 874 Message-ID: <123> 875 Sender: list@googlegroups.com 876 Subject: Subject 877 From: user@mail.com 878 To: syzbot <list@googlegroups.com> 879 880 nothing to see here`, 881 Email{ 882 MessageID: "<123>", 883 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 884 Subject: "Subject", 885 Author: "user@mail.com", 886 MailingList: "list@googlegroups.com", 887 Cc: []string{"list@googlegroups.com", "user@mail.com"}, 888 RawCc: []string{"list@googlegroups.com", "user@mail.com"}, 889 Body: `nothing to see here`, 890 }}, 891 {`Date: Sun, 7 May 2017 19:54:00 -0700 892 Message-ID: <123> 893 From: list@googlegroups.com 894 X-Original-From: user@mail.com 895 Subject: Subject 896 To: <user2@mail.com> 897 898 nothing to see here`, 899 Email{ 900 MessageID: "<123>", 901 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 902 Subject: "Subject", 903 Author: "user@mail.com", 904 MailingList: "list@googlegroups.com", 905 Cc: []string{"list@googlegroups.com", "user2@mail.com", "user@mail.com"}, 906 RawCc: []string{"list@googlegroups.com", "user2@mail.com", "user@mail.com"}, 907 Body: `nothing to see here`, 908 }}, 909 // A faulty case, just check we handle it normally. 910 {`Date: Sun, 7 May 2017 19:54:00 -0700 911 Message-ID: <123> 912 From: list@googlegroups.com 913 Subject: Subject 914 To: <user2@mail.com> 915 916 nothing to see here`, 917 Email{ 918 MessageID: "<123>", 919 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 920 Subject: "Subject", 921 Author: "list@googlegroups.com", 922 MailingList: "list@googlegroups.com", 923 Cc: []string{"list@googlegroups.com", "user2@mail.com"}, 924 RawCc: []string{"list@googlegroups.com", "user2@mail.com"}, 925 Body: `nothing to see here`, 926 }}, 927 {`Sender: syzkaller-bugs@googlegroups.com 928 Subject: Re: BUG: unable to handle kernel NULL pointer dereference in 929 sock_poll 930 To: syzbot <syzbot+344bb0f46d7719cd9483@syzkaller.appspotmail.com> 931 From: bar <bar@foo.com> 932 Message-ID: <1250334f-7220-2bff-5d87-b87573758d81@bar.com> 933 Date: Sun, 7 May 2017 19:54:00 -0700 934 MIME-Version: 1.0 935 Content-Type: text/plain; charset="UTF-8" 936 Content-Language: en-US 937 Content-Transfer-Encoding: quoted-printable 938 939 #syz=20 940 test: https://github.com/torvalds/linux.git 7b5bb460defa107dd2e82= 941 f950fddb9ea6bdb5e39 942 `, Email{ 943 MessageID: "<1250334f-7220-2bff-5d87-b87573758d81@bar.com>", 944 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 945 Subject: "Re: BUG: unable to handle kernel NULL pointer dereference in sock_poll", 946 Author: "bar@foo.com", 947 Cc: []string{"bar@foo.com", "syzbot@syzkaller.appspotmail.com"}, 948 RawCc: []string{"bar@foo.com", "syzbot+344bb0f46d7719cd9483@syzkaller.appspotmail.com"}, 949 Body: `#syz 950 test: https://github.com/torvalds/linux.git 7b5bb460defa107dd2e82f950fddb9ea6bdb5e39 951 `, 952 Commands: []*SingleCommand{ 953 { 954 Command: CmdTest, 955 Str: "test:", 956 Args: "https://github.com/torvalds/linux.git 7b5bb460defa107dd2e82f950fddb9ea6bdb5e39", 957 }, 958 }, 959 }}, 960 {`Sender: syzkaller-bugs@googlegroups.com 961 Subject: [PATCH] Some patch 962 To: <someone@foo.com> 963 From: bar <bar@foo.com> 964 Message-ID: <1250334f-7220-2bff-5d87-b87573758d81@bar.com> 965 Date: Sun, 7 May 2017 19:54:00 -0700 966 MIME-Version: 1.0 967 Content-Type: text/plain; charset="UTF-8" 968 Content-Language: en-US 969 Content-Transfer-Encoding: quoted-printable 970 971 Reported-by: syzbot <foo+223c7461c58c58a4cb10@bar.com> 972 `, Email{ 973 BugIDs: []string{"223c7461c58c58a4cb10"}, 974 MessageID: "<1250334f-7220-2bff-5d87-b87573758d81@bar.com>", 975 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 976 Subject: "[PATCH] Some patch", 977 Author: "bar@foo.com", 978 Cc: []string{"bar@foo.com", "someone@foo.com"}, 979 RawCc: []string{"bar@foo.com", "someone@foo.com"}, 980 Body: `Reported-by: syzbot <foo+223c7461c58c58a4cb10@bar.com> 981 `, 982 }}, 983 {`Sender: syzkaller-bugs@googlegroups.com 984 Subject: [PATCH] Some patch 985 To: <someone@foo.com> 986 From: bar <bar@foo.com> 987 Message-ID: <1250334f-7220-2bff-5d87-b87573758d81@bar.com> 988 Date: Sun, 7 May 2017 19:54:00 -0700 989 MIME-Version: 1.0 990 Content-Type: text/plain; charset="UTF-8" 991 Content-Language: en-US 992 993 Link: https://bar.com/bug?extid=223c7461c58c58a4cb10@bar.com 994 `, Email{ 995 BugIDs: []string{"223c7461c58c58a4cb10"}, 996 MessageID: "<1250334f-7220-2bff-5d87-b87573758d81@bar.com>", 997 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 998 Subject: "[PATCH] Some patch", 999 Author: "bar@foo.com", 1000 Cc: []string{"bar@foo.com", "someone@foo.com"}, 1001 RawCc: []string{"bar@foo.com", "someone@foo.com"}, 1002 Body: `Link: https://bar.com/bug?extid=223c7461c58c58a4cb10@bar.com 1003 `, 1004 }}, 1005 1006 {`Sender: syzkaller-bugs@googlegroups.com 1007 Subject: [PATCH] Some patch 1008 To: <someone@foo.com> 1009 From: bar <bar@foo.com> 1010 Message-ID: <1250334f-7220-2bff-5d87-b87573758d81@bar.com> 1011 Date: Sun, 7 May 2017 19:54:00 -0700 1012 MIME-Version: 1.0 1013 Content-Type: text/plain; charset="UTF-8" 1014 Content-Language: en-US 1015 Content-Transfer-Encoding: quoted-printable 1016 1017 Reported-by: syzbot <foo+223c7461c58c58a4cb10@bar.com> 1018 Reported-by: syzbot <foo+9909090909090909@bar.com> 1019 `, Email{ 1020 BugIDs: []string{"223c7461c58c58a4cb10", "9909090909090909"}, 1021 MessageID: "<1250334f-7220-2bff-5d87-b87573758d81@bar.com>", 1022 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 1023 Subject: "[PATCH] Some patch", 1024 Author: "bar@foo.com", 1025 Cc: []string{"bar@foo.com", "someone@foo.com"}, 1026 RawCc: []string{"bar@foo.com", "someone@foo.com"}, 1027 Body: `Reported-by: syzbot <foo+223c7461c58c58a4cb10@bar.com> 1028 Reported-by: syzbot <foo+9909090909090909@bar.com> 1029 `, 1030 }}, 1031 {`Sender: syzkaller-bugs@googlegroups.com 1032 Subject: [PATCH] Some patch 1033 To: <someone@foo.com>, <foo+9909090909090909@bar.com> 1034 From: bar <bar@foo.com> 1035 Message-ID: <1250334f-7220-2bff-5d87-b87573758d81@bar.com> 1036 Date: Sun, 7 May 2017 19:54:00 -0700 1037 MIME-Version: 1.0 1038 Content-Type: text/plain; charset="UTF-8" 1039 Content-Language: en-US 1040 Content-Transfer-Encoding: quoted-printable 1041 1042 Reported-by: syzbot <foo+223c7461c58c58a4cb10@bar.com> 1043 `, Email{ 1044 // First come BugIDs from header, then from the body. 1045 BugIDs: []string{"9909090909090909", "223c7461c58c58a4cb10"}, 1046 MessageID: "<1250334f-7220-2bff-5d87-b87573758d81@bar.com>", 1047 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 1048 Subject: "[PATCH] Some patch", 1049 Author: "bar@foo.com", 1050 Cc: []string{"bar@foo.com", "someone@foo.com"}, 1051 RawCc: []string{"bar@foo.com", "foo+9909090909090909@bar.com", "someone@foo.com"}, 1052 Body: `Reported-by: syzbot <foo+223c7461c58c58a4cb10@bar.com> 1053 `, 1054 }}, 1055 {`Sender: syzkaller-bugs@googlegroups.com 1056 Subject: Some discussion 1057 To: <someone@foo.com> 1058 From: bar <bar@foo.com> 1059 Message-ID: <1250334f-7220-2bff-5d87-b87573758d81@bar.com> 1060 Date: Sun, 7 May 2017 19:54:00 -0700 1061 MIME-Version: 1.0 1062 Content-Type: text/plain; charset="UTF-8" 1063 Content-Language: en-US 1064 Content-Transfer-Encoding: quoted-printable 1065 In-Reply-To: <000000000000f1a9d205f909f327@google.com> 1066 <000000000000ee3a3005f909f30a@google.com> 1067 Precedence: bulk 1068 List-ID: <linux-kernel.vger.kernel.org> 1069 X-Mailing-List: linux-kernel@vger.kernel.org 1070 1071 Some text 1072 `, Email{ 1073 MessageID: "<1250334f-7220-2bff-5d87-b87573758d81@bar.com>", 1074 // The first one should be picked up. 1075 InReplyTo: "<000000000000f1a9d205f909f327@google.com>", 1076 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 1077 Subject: "Some discussion", 1078 Author: "bar@foo.com", 1079 Cc: []string{"bar@foo.com", "someone@foo.com"}, 1080 RawCc: []string{"bar@foo.com", "someone@foo.com"}, 1081 Body: "Some text\n", 1082 }}, 1083 {`Sender: syzkaller-bugs@googlegroups.com 1084 Subject: Re: BUG: unable to handle kernel NULL pointer dereference in 1085 sock_poll 1086 To: syzbot <syzbot+344bb0f46d7719cd9483@syzkaller.appspotmail.com> 1087 From: bar <bar@foo.com> 1088 Message-ID: <1250334f-7220-2bff-5d87-b87573758d81@bar.com> 1089 Date: Sun, 7 May 2017 19:54:00 -0700 1090 MIME-Version: 1.0 1091 Content-Type: text/plain; charset="UTF-8" 1092 Content-Language: en-US 1093 Content-Transfer-Encoding: quoted-printable 1094 1095 #syz test: aaa bbb 1096 #syz test: ccc ddd 1097 `, Email{ 1098 MessageID: "<1250334f-7220-2bff-5d87-b87573758d81@bar.com>", 1099 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 1100 Subject: "Re: BUG: unable to handle kernel NULL pointer dereference in sock_poll", 1101 Author: "bar@foo.com", 1102 Cc: []string{"bar@foo.com", "syzbot@syzkaller.appspotmail.com"}, 1103 RawCc: []string{"bar@foo.com", "syzbot+344bb0f46d7719cd9483@syzkaller.appspotmail.com"}, 1104 Body: `#syz test: aaa bbb 1105 #syz test: ccc ddd 1106 `, 1107 Commands: []*SingleCommand{ 1108 { 1109 Command: CmdTest, 1110 Str: "test:", 1111 Args: "aaa bbb", 1112 }, 1113 { 1114 Command: CmdTest, 1115 Str: "test:", 1116 Args: "ccc ddd", 1117 }, 1118 }, 1119 }}, 1120 {`Sender: foo@foobar.com 1121 Subject: [PATCH] =?UTF-8?q?Add=20a=20new=20test=20'migrate.cow=5Fafter=5Ff?= =?UTF-8?q?ork'=20that=20verifies=20correct=20RMAP=20handling=20of=20Copy-?= =?UTF-8?q?On-Write=20pages=20after=20fork().=20Before=20a=20write,=20pare?= =?UTF-8?q?nt=20and=20child=20share=20the=20same=20PFN;?= 1122 To: <bar@foo.com> 1123 From: <foo@foobar.com> 1124 Message-ID: <1250334f-7220-2bff-5d87-b87573758d81@bar.com> 1125 Date: Sun, 7 May 2017 19:54:00 -0700 1126 MIME-Version: 1.0 1127 Content-Type: text/plain; charset=UTF-8 1128 Content-Transfer-Encoding: 8bit 1129 1130 Body 1131 `, Email{ 1132 MessageID: "<1250334f-7220-2bff-5d87-b87573758d81@bar.com>", 1133 Date: time.Date(2017, time.May, 7, 19, 54, 0, 0, parseTestZone), 1134 Subject: "[PATCH] Add a new test 'migrate.cow_after_fork' that verifies correct RMAP handling of Copy-On-Write pages after fork(). Before a write, parent and child share the same PFN;", 1135 Author: "foo@foobar.com", 1136 Cc: []string{"bar@foo.com", "foo@foobar.com"}, 1137 RawCc: []string{"bar@foo.com", "foo@foobar.com"}, 1138 Body: `Body 1139 `, 1140 }}, 1141 }