Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 1282 lines 26 kB view raw
1// SPDX-License-Identifier: GPL-2.0 2 3#include <linux/bpf.h> 4#include <limits.h> 5#include <bpf/bpf_helpers.h> 6#include "bpf_misc.h" 7 8#if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ 9 (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ 10 defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ 11 defined(__TARGET_ARCH_loongarch)) && \ 12 __clang_major__ >= 18 13 14SEC("socket") 15__description("SDIV32, non-zero imm divisor, check 1") 16__success __success_unpriv __retval(-20) 17__naked void sdiv32_non_zero_imm_1(void) 18{ 19 asm volatile (" \ 20 w0 = -41; \ 21 w0 s/= 2; \ 22 exit; \ 23" ::: __clobber_all); 24} 25 26SEC("socket") 27__description("SDIV32, non-zero imm divisor, check 2") 28__success __success_unpriv __retval(-20) 29__naked void sdiv32_non_zero_imm_2(void) 30{ 31 asm volatile (" \ 32 w0 = 41; \ 33 w0 s/= -2; \ 34 exit; \ 35" ::: __clobber_all); 36} 37 38SEC("socket") 39__description("SDIV32, non-zero imm divisor, check 3") 40__success __success_unpriv __retval(20) 41__naked void sdiv32_non_zero_imm_3(void) 42{ 43 asm volatile (" \ 44 w0 = -41; \ 45 w0 s/= -2; \ 46 exit; \ 47" ::: __clobber_all); 48} 49 50SEC("socket") 51__description("SDIV32, non-zero imm divisor, check 4") 52__success __success_unpriv __retval(-21) 53__naked void sdiv32_non_zero_imm_4(void) 54{ 55 asm volatile (" \ 56 w0 = -42; \ 57 w0 s/= 2; \ 58 exit; \ 59" ::: __clobber_all); 60} 61 62SEC("socket") 63__description("SDIV32, non-zero imm divisor, check 5") 64__success __success_unpriv __retval(-21) 65__naked void sdiv32_non_zero_imm_5(void) 66{ 67 asm volatile (" \ 68 w0 = 42; \ 69 w0 s/= -2; \ 70 exit; \ 71" ::: __clobber_all); 72} 73 74SEC("socket") 75__description("SDIV32, non-zero imm divisor, check 6") 76__success __success_unpriv __retval(21) 77__naked void sdiv32_non_zero_imm_6(void) 78{ 79 asm volatile (" \ 80 w0 = -42; \ 81 w0 s/= -2; \ 82 exit; \ 83" ::: __clobber_all); 84} 85 86SEC("socket") 87__description("SDIV32, non-zero imm divisor, check 7") 88__success __success_unpriv __retval(21) 89__naked void sdiv32_non_zero_imm_7(void) 90{ 91 asm volatile (" \ 92 w0 = 42; \ 93 w0 s/= 2; \ 94 exit; \ 95" ::: __clobber_all); 96} 97 98SEC("socket") 99__description("SDIV32, non-zero imm divisor, check 8") 100__success __success_unpriv __retval(20) 101__naked void sdiv32_non_zero_imm_8(void) 102{ 103 asm volatile (" \ 104 w0 = 41; \ 105 w0 s/= 2; \ 106 exit; \ 107" ::: __clobber_all); 108} 109 110SEC("socket") 111__description("SDIV32, non-zero reg divisor, check 1") 112__success __success_unpriv __retval(-20) 113__naked void sdiv32_non_zero_reg_1(void) 114{ 115 asm volatile (" \ 116 w0 = -41; \ 117 w1 = 2; \ 118 w0 s/= w1; \ 119 exit; \ 120" ::: __clobber_all); 121} 122 123SEC("socket") 124__description("SDIV32, non-zero reg divisor, check 2") 125__success __success_unpriv __retval(-20) 126__naked void sdiv32_non_zero_reg_2(void) 127{ 128 asm volatile (" \ 129 w0 = 41; \ 130 w1 = -2; \ 131 w0 s/= w1; \ 132 exit; \ 133" ::: __clobber_all); 134} 135 136SEC("socket") 137__description("SDIV32, non-zero reg divisor, check 3") 138__success __success_unpriv __retval(20) 139__naked void sdiv32_non_zero_reg_3(void) 140{ 141 asm volatile (" \ 142 w0 = -41; \ 143 w1 = -2; \ 144 w0 s/= w1; \ 145 exit; \ 146" ::: __clobber_all); 147} 148 149SEC("socket") 150__description("SDIV32, non-zero reg divisor, check 4") 151__success __success_unpriv __retval(-21) 152__naked void sdiv32_non_zero_reg_4(void) 153{ 154 asm volatile (" \ 155 w0 = -42; \ 156 w1 = 2; \ 157 w0 s/= w1; \ 158 exit; \ 159" ::: __clobber_all); 160} 161 162SEC("socket") 163__description("SDIV32, non-zero reg divisor, check 5") 164__success __success_unpriv __retval(-21) 165__naked void sdiv32_non_zero_reg_5(void) 166{ 167 asm volatile (" \ 168 w0 = 42; \ 169 w1 = -2; \ 170 w0 s/= w1; \ 171 exit; \ 172" ::: __clobber_all); 173} 174 175SEC("socket") 176__description("SDIV32, non-zero reg divisor, check 6") 177__success __success_unpriv __retval(21) 178__naked void sdiv32_non_zero_reg_6(void) 179{ 180 asm volatile (" \ 181 w0 = -42; \ 182 w1 = -2; \ 183 w0 s/= w1; \ 184 exit; \ 185" ::: __clobber_all); 186} 187 188SEC("socket") 189__description("SDIV32, non-zero reg divisor, check 7") 190__success __success_unpriv __retval(21) 191__naked void sdiv32_non_zero_reg_7(void) 192{ 193 asm volatile (" \ 194 w0 = 42; \ 195 w1 = 2; \ 196 w0 s/= w1; \ 197 exit; \ 198" ::: __clobber_all); 199} 200 201SEC("socket") 202__description("SDIV32, non-zero reg divisor, check 8") 203__success __success_unpriv __retval(20) 204__naked void sdiv32_non_zero_reg_8(void) 205{ 206 asm volatile (" \ 207 w0 = 41; \ 208 w1 = 2; \ 209 w0 s/= w1; \ 210 exit; \ 211" ::: __clobber_all); 212} 213 214SEC("socket") 215__description("SDIV64, non-zero imm divisor, check 1") 216__success __success_unpriv __retval(-20) 217__naked void sdiv64_non_zero_imm_1(void) 218{ 219 asm volatile (" \ 220 r0 = -41; \ 221 r0 s/= 2; \ 222 exit; \ 223" ::: __clobber_all); 224} 225 226SEC("socket") 227__description("SDIV64, non-zero imm divisor, check 2") 228__success __success_unpriv __retval(-20) 229__naked void sdiv64_non_zero_imm_2(void) 230{ 231 asm volatile (" \ 232 r0 = 41; \ 233 r0 s/= -2; \ 234 exit; \ 235" ::: __clobber_all); 236} 237 238SEC("socket") 239__description("SDIV64, non-zero imm divisor, check 3") 240__success __success_unpriv __retval(20) 241__naked void sdiv64_non_zero_imm_3(void) 242{ 243 asm volatile (" \ 244 r0 = -41; \ 245 r0 s/= -2; \ 246 exit; \ 247" ::: __clobber_all); 248} 249 250SEC("socket") 251__description("SDIV64, non-zero imm divisor, check 4") 252__success __success_unpriv __retval(-21) 253__naked void sdiv64_non_zero_imm_4(void) 254{ 255 asm volatile (" \ 256 r0 = -42; \ 257 r0 s/= 2; \ 258 exit; \ 259" ::: __clobber_all); 260} 261 262SEC("socket") 263__description("SDIV64, non-zero imm divisor, check 5") 264__success __success_unpriv __retval(-21) 265__naked void sdiv64_non_zero_imm_5(void) 266{ 267 asm volatile (" \ 268 r0 = 42; \ 269 r0 s/= -2; \ 270 exit; \ 271" ::: __clobber_all); 272} 273 274SEC("socket") 275__description("SDIV64, non-zero imm divisor, check 6") 276__success __success_unpriv __retval(21) 277__naked void sdiv64_non_zero_imm_6(void) 278{ 279 asm volatile (" \ 280 r0 = -42; \ 281 r0 s/= -2; \ 282 exit; \ 283" ::: __clobber_all); 284} 285 286SEC("socket") 287__description("SDIV64, non-zero reg divisor, check 1") 288__success __success_unpriv __retval(-20) 289__naked void sdiv64_non_zero_reg_1(void) 290{ 291 asm volatile (" \ 292 r0 = -41; \ 293 r1 = 2; \ 294 r0 s/= r1; \ 295 exit; \ 296" ::: __clobber_all); 297} 298 299SEC("socket") 300__description("SDIV64, non-zero reg divisor, check 2") 301__success __success_unpriv __retval(-20) 302__naked void sdiv64_non_zero_reg_2(void) 303{ 304 asm volatile (" \ 305 r0 = 41; \ 306 r1 = -2; \ 307 r0 s/= r1; \ 308 exit; \ 309" ::: __clobber_all); 310} 311 312SEC("socket") 313__description("SDIV64, non-zero reg divisor, check 3") 314__success __success_unpriv __retval(20) 315__naked void sdiv64_non_zero_reg_3(void) 316{ 317 asm volatile (" \ 318 r0 = -41; \ 319 r1 = -2; \ 320 r0 s/= r1; \ 321 exit; \ 322" ::: __clobber_all); 323} 324 325SEC("socket") 326__description("SDIV64, non-zero reg divisor, check 4") 327__success __success_unpriv __retval(-21) 328__naked void sdiv64_non_zero_reg_4(void) 329{ 330 asm volatile (" \ 331 r0 = -42; \ 332 r1 = 2; \ 333 r0 s/= r1; \ 334 exit; \ 335" ::: __clobber_all); 336} 337 338SEC("socket") 339__description("SDIV64, non-zero reg divisor, check 5") 340__success __success_unpriv __retval(-21) 341__naked void sdiv64_non_zero_reg_5(void) 342{ 343 asm volatile (" \ 344 r0 = 42; \ 345 r1 = -2; \ 346 r0 s/= r1; \ 347 exit; \ 348" ::: __clobber_all); 349} 350 351SEC("socket") 352__description("SDIV64, non-zero reg divisor, check 6") 353__success __success_unpriv __retval(21) 354__naked void sdiv64_non_zero_reg_6(void) 355{ 356 asm volatile (" \ 357 r0 = -42; \ 358 r1 = -2; \ 359 r0 s/= r1; \ 360 exit; \ 361" ::: __clobber_all); 362} 363 364SEC("socket") 365__description("SMOD32, non-zero imm divisor, check 1") 366__success __success_unpriv __retval(-1) 367__naked void smod32_non_zero_imm_1(void) 368{ 369 asm volatile (" \ 370 w0 = -41; \ 371 w0 s%%= 2; \ 372 exit; \ 373" ::: __clobber_all); 374} 375 376SEC("socket") 377__description("SMOD32, non-zero imm divisor, check 2") 378__success __success_unpriv __retval(1) 379__naked void smod32_non_zero_imm_2(void) 380{ 381 asm volatile (" \ 382 w0 = 41; \ 383 w0 s%%= -2; \ 384 exit; \ 385" ::: __clobber_all); 386} 387 388SEC("socket") 389__description("SMOD32, non-zero imm divisor, check 3") 390__success __success_unpriv __retval(-1) 391__naked void smod32_non_zero_imm_3(void) 392{ 393 asm volatile (" \ 394 w0 = -41; \ 395 w0 s%%= -2; \ 396 exit; \ 397" ::: __clobber_all); 398} 399 400SEC("socket") 401__description("SMOD32, non-zero imm divisor, check 4") 402__success __success_unpriv __retval(0) 403__naked void smod32_non_zero_imm_4(void) 404{ 405 asm volatile (" \ 406 w0 = -42; \ 407 w0 s%%= 2; \ 408 exit; \ 409" ::: __clobber_all); 410} 411 412SEC("socket") 413__description("SMOD32, non-zero imm divisor, check 5") 414__success __success_unpriv __retval(0) 415__naked void smod32_non_zero_imm_5(void) 416{ 417 asm volatile (" \ 418 w0 = 42; \ 419 w0 s%%= -2; \ 420 exit; \ 421" ::: __clobber_all); 422} 423 424SEC("socket") 425__description("SMOD32, non-zero imm divisor, check 6") 426__success __success_unpriv __retval(0) 427__naked void smod32_non_zero_imm_6(void) 428{ 429 asm volatile (" \ 430 w0 = -42; \ 431 w0 s%%= -2; \ 432 exit; \ 433" ::: __clobber_all); 434} 435 436SEC("socket") 437__description("SMOD32, non-zero reg divisor, check 1") 438__success __success_unpriv __retval(-1) 439__naked void smod32_non_zero_reg_1(void) 440{ 441 asm volatile (" \ 442 w0 = -41; \ 443 w1 = 2; \ 444 w0 s%%= w1; \ 445 exit; \ 446" ::: __clobber_all); 447} 448 449SEC("socket") 450__description("SMOD32, non-zero reg divisor, check 2") 451__success __success_unpriv __retval(1) 452__naked void smod32_non_zero_reg_2(void) 453{ 454 asm volatile (" \ 455 w0 = 41; \ 456 w1 = -2; \ 457 w0 s%%= w1; \ 458 exit; \ 459" ::: __clobber_all); 460} 461 462SEC("socket") 463__description("SMOD32, non-zero reg divisor, check 3") 464__success __success_unpriv __retval(-1) 465__naked void smod32_non_zero_reg_3(void) 466{ 467 asm volatile (" \ 468 w0 = -41; \ 469 w1 = -2; \ 470 w0 s%%= w1; \ 471 exit; \ 472" ::: __clobber_all); 473} 474 475SEC("socket") 476__description("SMOD32, non-zero reg divisor, check 4") 477__success __success_unpriv __retval(0) 478__naked void smod32_non_zero_reg_4(void) 479{ 480 asm volatile (" \ 481 w0 = -42; \ 482 w1 = 2; \ 483 w0 s%%= w1; \ 484 exit; \ 485" ::: __clobber_all); 486} 487 488SEC("socket") 489__description("SMOD32, non-zero reg divisor, check 5") 490__success __success_unpriv __retval(0) 491__naked void smod32_non_zero_reg_5(void) 492{ 493 asm volatile (" \ 494 w0 = 42; \ 495 w1 = -2; \ 496 w0 s%%= w1; \ 497 exit; \ 498" ::: __clobber_all); 499} 500 501SEC("socket") 502__description("SMOD32, non-zero reg divisor, check 6") 503__success __success_unpriv __retval(0) 504__naked void smod32_non_zero_reg_6(void) 505{ 506 asm volatile (" \ 507 w0 = -42; \ 508 w1 = -2; \ 509 w0 s%%= w1; \ 510 exit; \ 511" ::: __clobber_all); 512} 513 514SEC("socket") 515__description("SMOD64, non-zero imm divisor, check 1") 516__success __success_unpriv __retval(-1) 517__naked void smod64_non_zero_imm_1(void) 518{ 519 asm volatile (" \ 520 r0 = -41; \ 521 r0 s%%= 2; \ 522 exit; \ 523" ::: __clobber_all); 524} 525 526SEC("socket") 527__description("SMOD64, non-zero imm divisor, check 2") 528__success __success_unpriv __retval(1) 529__naked void smod64_non_zero_imm_2(void) 530{ 531 asm volatile (" \ 532 r0 = 41; \ 533 r0 s%%= -2; \ 534 exit; \ 535" ::: __clobber_all); 536} 537 538SEC("socket") 539__description("SMOD64, non-zero imm divisor, check 3") 540__success __success_unpriv __retval(-1) 541__naked void smod64_non_zero_imm_3(void) 542{ 543 asm volatile (" \ 544 r0 = -41; \ 545 r0 s%%= -2; \ 546 exit; \ 547" ::: __clobber_all); 548} 549 550SEC("socket") 551__description("SMOD64, non-zero imm divisor, check 4") 552__success __success_unpriv __retval(0) 553__naked void smod64_non_zero_imm_4(void) 554{ 555 asm volatile (" \ 556 r0 = -42; \ 557 r0 s%%= 2; \ 558 exit; \ 559" ::: __clobber_all); 560} 561 562SEC("socket") 563__description("SMOD64, non-zero imm divisor, check 5") 564__success __success_unpriv __retval(-0) 565__naked void smod64_non_zero_imm_5(void) 566{ 567 asm volatile (" \ 568 r0 = 42; \ 569 r0 s%%= -2; \ 570 exit; \ 571" ::: __clobber_all); 572} 573 574SEC("socket") 575__description("SMOD64, non-zero imm divisor, check 6") 576__success __success_unpriv __retval(0) 577__naked void smod64_non_zero_imm_6(void) 578{ 579 asm volatile (" \ 580 r0 = -42; \ 581 r0 s%%= -2; \ 582 exit; \ 583" ::: __clobber_all); 584} 585 586SEC("socket") 587__description("SMOD64, non-zero imm divisor, check 7") 588__success __success_unpriv __retval(0) 589__naked void smod64_non_zero_imm_7(void) 590{ 591 asm volatile (" \ 592 r0 = 42; \ 593 r0 s%%= 2; \ 594 exit; \ 595" ::: __clobber_all); 596} 597 598SEC("socket") 599__description("SMOD64, non-zero imm divisor, check 8") 600__success __success_unpriv __retval(1) 601__naked void smod64_non_zero_imm_8(void) 602{ 603 asm volatile (" \ 604 r0 = 41; \ 605 r0 s%%= 2; \ 606 exit; \ 607" ::: __clobber_all); 608} 609 610SEC("socket") 611__description("SMOD64, non-zero reg divisor, check 1") 612__success __success_unpriv __retval(-1) 613__naked void smod64_non_zero_reg_1(void) 614{ 615 asm volatile (" \ 616 r0 = -41; \ 617 r1 = 2; \ 618 r0 s%%= r1; \ 619 exit; \ 620" ::: __clobber_all); 621} 622 623SEC("socket") 624__description("SMOD64, non-zero reg divisor, check 2") 625__success __success_unpriv __retval(1) 626__naked void smod64_non_zero_reg_2(void) 627{ 628 asm volatile (" \ 629 r0 = 41; \ 630 r1 = -2; \ 631 r0 s%%= r1; \ 632 exit; \ 633" ::: __clobber_all); 634} 635 636SEC("socket") 637__description("SMOD64, non-zero reg divisor, check 3") 638__success __success_unpriv __retval(-1) 639__naked void smod64_non_zero_reg_3(void) 640{ 641 asm volatile (" \ 642 r0 = -41; \ 643 r1 = -2; \ 644 r0 s%%= r1; \ 645 exit; \ 646" ::: __clobber_all); 647} 648 649SEC("socket") 650__description("SMOD64, non-zero reg divisor, check 4") 651__success __success_unpriv __retval(0) 652__naked void smod64_non_zero_reg_4(void) 653{ 654 asm volatile (" \ 655 r0 = -42; \ 656 r1 = 2; \ 657 r0 s%%= r1; \ 658 exit; \ 659" ::: __clobber_all); 660} 661 662SEC("socket") 663__description("SMOD64, non-zero reg divisor, check 5") 664__success __success_unpriv __retval(0) 665__naked void smod64_non_zero_reg_5(void) 666{ 667 asm volatile (" \ 668 r0 = 42; \ 669 r1 = -2; \ 670 r0 s%%= r1; \ 671 exit; \ 672" ::: __clobber_all); 673} 674 675SEC("socket") 676__description("SMOD64, non-zero reg divisor, check 6") 677__success __success_unpriv __retval(0) 678__naked void smod64_non_zero_reg_6(void) 679{ 680 asm volatile (" \ 681 r0 = -42; \ 682 r1 = -2; \ 683 r0 s%%= r1; \ 684 exit; \ 685" ::: __clobber_all); 686} 687 688SEC("socket") 689__description("SMOD64, non-zero reg divisor, check 7") 690__success __success_unpriv __retval(0) 691__naked void smod64_non_zero_reg_7(void) 692{ 693 asm volatile (" \ 694 r0 = 42; \ 695 r1 = 2; \ 696 r0 s%%= r1; \ 697 exit; \ 698" ::: __clobber_all); 699} 700 701SEC("socket") 702__description("SMOD64, non-zero reg divisor, check 8") 703__success __success_unpriv __retval(1) 704__naked void smod64_non_zero_reg_8(void) 705{ 706 asm volatile (" \ 707 r0 = 41; \ 708 r1 = 2; \ 709 r0 s%%= r1; \ 710 exit; \ 711" ::: __clobber_all); 712} 713 714SEC("socket") 715__description("SDIV32, zero divisor") 716__success __success_unpriv __retval(0) 717__naked void sdiv32_zero_divisor(void) 718{ 719 asm volatile (" \ 720 w0 = 42; \ 721 w1 = 0; \ 722 w2 = -1; \ 723 w2 s/= w1; \ 724 w0 = w2; \ 725 exit; \ 726" ::: __clobber_all); 727} 728 729SEC("socket") 730__description("SDIV64, zero divisor") 731__success __success_unpriv __retval(0) 732__naked void sdiv64_zero_divisor(void) 733{ 734 asm volatile (" \ 735 r0 = 42; \ 736 r1 = 0; \ 737 r2 = -1; \ 738 r2 s/= r1; \ 739 r0 = r2; \ 740 exit; \ 741" ::: __clobber_all); 742} 743 744SEC("socket") 745__description("SMOD32, zero divisor") 746__success __success_unpriv __retval(-1) 747__naked void smod32_zero_divisor(void) 748{ 749 asm volatile (" \ 750 w0 = 42; \ 751 w1 = 0; \ 752 w2 = -1; \ 753 w2 s%%= w1; \ 754 w0 = w2; \ 755 exit; \ 756" ::: __clobber_all); 757} 758 759SEC("socket") 760__description("SMOD64, zero divisor") 761__success __success_unpriv __retval(-1) 762__naked void smod64_zero_divisor(void) 763{ 764 asm volatile (" \ 765 r0 = 42; \ 766 r1 = 0; \ 767 r2 = -1; \ 768 r2 s%%= r1; \ 769 r0 = r2; \ 770 exit; \ 771" ::: __clobber_all); 772} 773 774SEC("socket") 775__description("SDIV64, overflow r/r, LLONG_MIN/-1") 776__success __retval(1) 777__arch_x86_64 778__xlated("0: r2 = 0x8000000000000000") 779__xlated("2: r3 = -1") 780__xlated("3: r4 = r2") 781__xlated("4: r11 = r3") 782__xlated("5: r11 += 1") 783__xlated("6: if r11 > 0x1 goto pc+4") 784__xlated("7: if r11 == 0x0 goto pc+1") 785__xlated("8: r2 = 0") 786__xlated("9: r2 = -r2") 787__xlated("10: goto pc+1") 788__xlated("11: r2 s/= r3") 789__xlated("12: r0 = 0") 790__xlated("13: if r2 != r4 goto pc+1") 791__xlated("14: r0 = 1") 792__xlated("15: exit") 793__naked void sdiv64_overflow_rr(void) 794{ 795 asm volatile (" \ 796 r2 = %[llong_min] ll; \ 797 r3 = -1; \ 798 r4 = r2; \ 799 r2 s/= r3; \ 800 r0 = 0; \ 801 if r2 != r4 goto +1; \ 802 r0 = 1; \ 803 exit; \ 804" : 805 : __imm_const(llong_min, LLONG_MIN) 806 : __clobber_all); 807} 808 809SEC("socket") 810__description("SDIV64, r/r, small_val/-1") 811__success __retval(-5) 812__arch_x86_64 813__xlated("0: r2 = 5") 814__xlated("1: r3 = -1") 815__xlated("2: r11 = r3") 816__xlated("3: r11 += 1") 817__xlated("4: if r11 > 0x1 goto pc+4") 818__xlated("5: if r11 == 0x0 goto pc+1") 819__xlated("6: r2 = 0") 820__xlated("7: r2 = -r2") 821__xlated("8: goto pc+1") 822__xlated("9: r2 s/= r3") 823__xlated("10: r0 = r2") 824__xlated("11: exit") 825__naked void sdiv64_rr_divisor_neg_1(void) 826{ 827 asm volatile (" \ 828 r2 = 5; \ 829 r3 = -1; \ 830 r2 s/= r3; \ 831 r0 = r2; \ 832 exit; \ 833" : 834 : 835 : __clobber_all); 836} 837 838SEC("socket") 839__description("SDIV64, overflow r/i, LLONG_MIN/-1") 840__success __retval(1) 841__arch_x86_64 842__xlated("0: r2 = 0x8000000000000000") 843__xlated("2: r4 = r2") 844__xlated("3: r2 = -r2") 845__xlated("4: r0 = 0") 846__xlated("5: if r2 != r4 goto pc+1") 847__xlated("6: r0 = 1") 848__xlated("7: exit") 849__naked void sdiv64_overflow_ri(void) 850{ 851 asm volatile (" \ 852 r2 = %[llong_min] ll; \ 853 r4 = r2; \ 854 r2 s/= -1; \ 855 r0 = 0; \ 856 if r2 != r4 goto +1; \ 857 r0 = 1; \ 858 exit; \ 859" : 860 : __imm_const(llong_min, LLONG_MIN) 861 : __clobber_all); 862} 863 864SEC("socket") 865__description("SDIV64, r/i, small_val/-1") 866__success __retval(-5) 867__arch_x86_64 868__xlated("0: r2 = 5") 869__xlated("1: r4 = r2") 870__xlated("2: r2 = -r2") 871__xlated("3: r0 = r2") 872__xlated("4: exit") 873__naked void sdiv64_ri_divisor_neg_1(void) 874{ 875 asm volatile (" \ 876 r2 = 5; \ 877 r4 = r2; \ 878 r2 s/= -1; \ 879 r0 = r2; \ 880 exit; \ 881" : 882 : 883 : __clobber_all); 884} 885 886SEC("socket") 887__description("SDIV32, overflow r/r, INT_MIN/-1") 888__success __retval(1) 889__arch_x86_64 890__xlated("0: w2 = -2147483648") 891__xlated("1: w3 = -1") 892__xlated("2: w4 = w2") 893__xlated("3: r11 = r3") 894__xlated("4: w11 += 1") 895__xlated("5: if w11 > 0x1 goto pc+4") 896__xlated("6: if w11 == 0x0 goto pc+1") 897__xlated("7: w2 = 0") 898__xlated("8: w2 = -w2") 899__xlated("9: goto pc+1") 900__xlated("10: w2 s/= w3") 901__xlated("11: r0 = 0") 902__xlated("12: if w2 != w4 goto pc+1") 903__xlated("13: r0 = 1") 904__xlated("14: exit") 905__naked void sdiv32_overflow_rr(void) 906{ 907 asm volatile (" \ 908 w2 = %[int_min]; \ 909 w3 = -1; \ 910 w4 = w2; \ 911 w2 s/= w3; \ 912 r0 = 0; \ 913 if w2 != w4 goto +1; \ 914 r0 = 1; \ 915 exit; \ 916" : 917 : __imm_const(int_min, INT_MIN) 918 : __clobber_all); 919} 920 921SEC("socket") 922__description("SDIV32, r/r, small_val/-1") 923__success __retval(5) 924__arch_x86_64 925__xlated("0: w2 = -5") 926__xlated("1: w3 = -1") 927__xlated("2: w4 = w2") 928__xlated("3: r11 = r3") 929__xlated("4: w11 += 1") 930__xlated("5: if w11 > 0x1 goto pc+4") 931__xlated("6: if w11 == 0x0 goto pc+1") 932__xlated("7: w2 = 0") 933__xlated("8: w2 = -w2") 934__xlated("9: goto pc+1") 935__xlated("10: w2 s/= w3") 936__xlated("11: w0 = w2") 937__xlated("12: exit") 938__naked void sdiv32_rr_divisor_neg_1(void) 939{ 940 asm volatile (" \ 941 w2 = -5; \ 942 w3 = -1; \ 943 w4 = w2; \ 944 w2 s/= w3; \ 945 w0 = w2; \ 946 exit; \ 947" : 948 : 949 : __clobber_all); 950} 951 952SEC("socket") 953__description("SDIV32, overflow r/i, INT_MIN/-1") 954__success __retval(1) 955__arch_x86_64 956__xlated("0: w2 = -2147483648") 957__xlated("1: w4 = w2") 958__xlated("2: w2 = -w2") 959__xlated("3: r0 = 0") 960__xlated("4: if w2 != w4 goto pc+1") 961__xlated("5: r0 = 1") 962__xlated("6: exit") 963__naked void sdiv32_overflow_ri(void) 964{ 965 asm volatile (" \ 966 w2 = %[int_min]; \ 967 w4 = w2; \ 968 w2 s/= -1; \ 969 r0 = 0; \ 970 if w2 != w4 goto +1; \ 971 r0 = 1; \ 972 exit; \ 973" : 974 : __imm_const(int_min, INT_MIN) 975 : __clobber_all); 976} 977 978SEC("socket") 979__description("SDIV32, r/i, small_val/-1") 980__success __retval(-5) 981__arch_x86_64 982__xlated("0: w2 = 5") 983__xlated("1: w4 = w2") 984__xlated("2: w2 = -w2") 985__xlated("3: w0 = w2") 986__xlated("4: exit") 987__naked void sdiv32_ri_divisor_neg_1(void) 988{ 989 asm volatile (" \ 990 w2 = 5; \ 991 w4 = w2; \ 992 w2 s/= -1; \ 993 w0 = w2; \ 994 exit; \ 995" : 996 : 997 : __clobber_all); 998} 999 1000SEC("socket") 1001__description("SMOD64, overflow r/r, LLONG_MIN/-1") 1002__success __retval(0) 1003__arch_x86_64 1004__xlated("0: r2 = 0x8000000000000000") 1005__xlated("2: r3 = -1") 1006__xlated("3: r4 = r2") 1007__xlated("4: r11 = r3") 1008__xlated("5: r11 += 1") 1009__xlated("6: if r11 > 0x1 goto pc+3") 1010__xlated("7: if r11 == 0x1 goto pc+3") 1011__xlated("8: w2 = 0") 1012__xlated("9: goto pc+1") 1013__xlated("10: r2 s%= r3") 1014__xlated("11: r0 = r2") 1015__xlated("12: exit") 1016__naked void smod64_overflow_rr(void) 1017{ 1018 asm volatile (" \ 1019 r2 = %[llong_min] ll; \ 1020 r3 = -1; \ 1021 r4 = r2; \ 1022 r2 s%%= r3; \ 1023 r0 = r2; \ 1024 exit; \ 1025" : 1026 : __imm_const(llong_min, LLONG_MIN) 1027 : __clobber_all); 1028} 1029 1030SEC("socket") 1031__description("SMOD64, r/r, small_val/-1") 1032__success __retval(0) 1033__arch_x86_64 1034__xlated("0: r2 = 5") 1035__xlated("1: r3 = -1") 1036__xlated("2: r4 = r2") 1037__xlated("3: r11 = r3") 1038__xlated("4: r11 += 1") 1039__xlated("5: if r11 > 0x1 goto pc+3") 1040__xlated("6: if r11 == 0x1 goto pc+3") 1041__xlated("7: w2 = 0") 1042__xlated("8: goto pc+1") 1043__xlated("9: r2 s%= r3") 1044__xlated("10: r0 = r2") 1045__xlated("11: exit") 1046__naked void smod64_rr_divisor_neg_1(void) 1047{ 1048 asm volatile (" \ 1049 r2 = 5; \ 1050 r3 = -1; \ 1051 r4 = r2; \ 1052 r2 s%%= r3; \ 1053 r0 = r2; \ 1054 exit; \ 1055" : 1056 : 1057 : __clobber_all); 1058} 1059 1060SEC("socket") 1061__description("SMOD64, overflow r/i, LLONG_MIN/-1") 1062__success __retval(0) 1063__arch_x86_64 1064__xlated("0: r2 = 0x8000000000000000") 1065__xlated("2: r4 = r2") 1066__xlated("3: w2 = 0") 1067__xlated("4: r0 = r2") 1068__xlated("5: exit") 1069__naked void smod64_overflow_ri(void) 1070{ 1071 asm volatile (" \ 1072 r2 = %[llong_min] ll; \ 1073 r4 = r2; \ 1074 r2 s%%= -1; \ 1075 r0 = r2; \ 1076 exit; \ 1077" : 1078 : __imm_const(llong_min, LLONG_MIN) 1079 : __clobber_all); 1080} 1081 1082SEC("socket") 1083__description("SMOD64, r/i, small_val/-1") 1084__success __retval(0) 1085__arch_x86_64 1086__xlated("0: r2 = 5") 1087__xlated("1: r4 = r2") 1088__xlated("2: w2 = 0") 1089__xlated("3: r0 = r2") 1090__xlated("4: exit") 1091__naked void smod64_ri_divisor_neg_1(void) 1092{ 1093 asm volatile (" \ 1094 r2 = 5; \ 1095 r4 = r2; \ 1096 r2 s%%= -1; \ 1097 r0 = r2; \ 1098 exit; \ 1099" : 1100 : 1101 : __clobber_all); 1102} 1103 1104SEC("socket") 1105__description("SMOD32, overflow r/r, INT_MIN/-1") 1106__success __retval(0) 1107__arch_x86_64 1108__xlated("0: w2 = -2147483648") 1109__xlated("1: w3 = -1") 1110__xlated("2: w4 = w2") 1111__xlated("3: r11 = r3") 1112__xlated("4: w11 += 1") 1113__xlated("5: if w11 > 0x1 goto pc+3") 1114__xlated("6: if w11 == 0x1 goto pc+4") 1115__xlated("7: w2 = 0") 1116__xlated("8: goto pc+1") 1117__xlated("9: w2 s%= w3") 1118__xlated("10: goto pc+1") 1119__xlated("11: w2 = w2") 1120__xlated("12: r0 = r2") 1121__xlated("13: exit") 1122__naked void smod32_overflow_rr(void) 1123{ 1124 asm volatile (" \ 1125 w2 = %[int_min]; \ 1126 w3 = -1; \ 1127 w4 = w2; \ 1128 w2 s%%= w3; \ 1129 r0 = r2; \ 1130 exit; \ 1131" : 1132 : __imm_const(int_min, INT_MIN) 1133 : __clobber_all); 1134} 1135 1136SEC("socket") 1137__description("SMOD32, r/r, small_val/-1") 1138__success __retval(0) 1139__arch_x86_64 1140__xlated("0: w2 = -5") 1141__xlated("1: w3 = -1") 1142__xlated("2: w4 = w2") 1143__xlated("3: r11 = r3") 1144__xlated("4: w11 += 1") 1145__xlated("5: if w11 > 0x1 goto pc+3") 1146__xlated("6: if w11 == 0x1 goto pc+4") 1147__xlated("7: w2 = 0") 1148__xlated("8: goto pc+1") 1149__xlated("9: w2 s%= w3") 1150__xlated("10: goto pc+1") 1151__xlated("11: w2 = w2") 1152__xlated("12: r0 = r2") 1153__xlated("13: exit") 1154__naked void smod32_rr_divisor_neg_1(void) 1155{ 1156 asm volatile (" \ 1157 w2 = -5; \ 1158 w3 = -1; \ 1159 w4 = w2; \ 1160 w2 s%%= w3; \ 1161 r0 = r2; \ 1162 exit; \ 1163" : 1164 : 1165 : __clobber_all); 1166} 1167 1168SEC("socket") 1169__description("SMOD32, overflow r/i, INT_MIN/-1") 1170__success __retval(0) 1171__arch_x86_64 1172__xlated("0: w2 = -2147483648") 1173__xlated("1: w4 = w2") 1174__xlated("2: w2 = 0") 1175__xlated("3: r0 = r2") 1176__xlated("4: exit") 1177__naked void smod32_overflow_ri(void) 1178{ 1179 asm volatile (" \ 1180 w2 = %[int_min]; \ 1181 w4 = w2; \ 1182 w2 s%%= -1; \ 1183 r0 = r2; \ 1184 exit; \ 1185" : 1186 : __imm_const(int_min, INT_MIN) 1187 : __clobber_all); 1188} 1189 1190SEC("socket") 1191__description("SMOD32, r/i, small_val/-1") 1192__success __retval(0) 1193__arch_x86_64 1194__xlated("0: w2 = 5") 1195__xlated("1: w4 = w2") 1196__xlated("2: w2 = 0") 1197__xlated("3: w0 = w2") 1198__xlated("4: exit") 1199__naked void smod32_ri_divisor_neg_1(void) 1200{ 1201 asm volatile (" \ 1202 w2 = 5; \ 1203 w4 = w2; \ 1204 w2 s%%= -1; \ 1205 w0 = w2; \ 1206 exit; \ 1207" : 1208 : 1209 : __clobber_all); 1210} 1211 1212SEC("socket") 1213__description("SDIV32, INT_MIN divided by 2, imm") 1214__success __success_unpriv __retval(-1073741824) 1215__naked void sdiv32_int_min_div_2_imm(void) 1216{ 1217 asm volatile (" \ 1218 w0 = %[int_min]; \ 1219 w0 s/= 2; \ 1220 exit; \ 1221" : 1222 : __imm_const(int_min, INT_MIN) 1223 : __clobber_all); 1224} 1225 1226SEC("socket") 1227__description("SDIV32, INT_MIN divided by 2, reg") 1228__success __success_unpriv __retval(-1073741824) 1229__naked void sdiv32_int_min_div_2_reg(void) 1230{ 1231 asm volatile (" \ 1232 w0 = %[int_min]; \ 1233 w1 = 2; \ 1234 w0 s/= w1; \ 1235 exit; \ 1236" : 1237 : __imm_const(int_min, INT_MIN) 1238 : __clobber_all); 1239} 1240 1241SEC("socket") 1242__description("SMOD32, INT_MIN modulo 2, imm") 1243__success __success_unpriv __retval(0) 1244__naked void smod32_int_min_mod_2_imm(void) 1245{ 1246 asm volatile (" \ 1247 w0 = %[int_min]; \ 1248 w0 s%%= 2; \ 1249 exit; \ 1250" : 1251 : __imm_const(int_min, INT_MIN) 1252 : __clobber_all); 1253} 1254 1255SEC("socket") 1256__description("SMOD32, INT_MIN modulo -2, imm") 1257__success __success_unpriv __retval(0) 1258__naked void smod32_int_min_mod_neg2_imm(void) 1259{ 1260 asm volatile (" \ 1261 w0 = %[int_min]; \ 1262 w0 s%%= -2; \ 1263 exit; \ 1264" : 1265 : __imm_const(int_min, INT_MIN) 1266 : __clobber_all); 1267} 1268 1269 1270#else 1271 1272SEC("socket") 1273__description("cpuv4 is not supported by compiler or jit, use a dummy test") 1274__success 1275int dummy_test(void) 1276{ 1277 return 0; 1278} 1279 1280#endif 1281 1282char _license[] SEC("license") = "GPL";