1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287
|
// session functions
// Copyright (C) 2010-2019 Red Hat Inc.
//
// This file is part of systemtap, and is free software. You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.
#include "config.h"
#include "session.h"
#include "cache.h"
#include "stapregex.h"
#include "elaborate.h"
#include "translate.h"
#include "buildrun.h"
#include "coveragedb.h"
#include "hash.h"
#include "setupdwfl.h"
#include "task_finder.h"
#include "csclient.h"
#include "rpm_finder.h"
#include "util.h"
#include "cmdline.h"
#include "git_version.h"
#include "version.h"
#include "stringtable.h"
#include "tapsets.h"
#include <cerrno>
#include <cstdlib>
#include <thread>
extern "C" {
#include <getopt.h>
#include <limits.h>
#include <grp.h>
#include <sys/stat.h>
#include <sys/utsname.h>
#include <sys/resource.h>
#include <elfutils/libdwfl.h>
#include <elfutils/version.h>
#include <unistd.h>
#include <sys/wait.h>
#include <wordexp.h>
#include <pwd.h>
}
#if HAVE_NSS
extern "C" {
#include <nspr.h>
}
#endif
#include <string>
using namespace std;
/* getopt variables */
extern int optind;
#define PATH_TBD string("__TBD__")
#if HAVE_NSS
bool systemtap_session::NSPR_Initialized = false;
#endif
systemtap_session::systemtap_session ():
// NB: pointer members must be manually initialized!
// NB: don't forget the copy constructor too!
runtime_mode(kernel_runtime),
base_hash(0),
pattern_root(new match_node),
dfa_counter (0),
dfa_maxmap (0),
dfa_maxtag (0),
need_tagged_dfa (false),
be_derived_probes(0),
generic_kprobe_derived_probes(0),
hwbkpt_derived_probes(0),
perf_derived_probes(0),
uprobe_derived_probes(0),
utrace_derived_probes(0),
itrace_derived_probes(0),
task_finder_derived_probes(0),
vma_tracker_derived_probes(0),
timer_derived_probes(0),
netfilter_derived_probes(0),
profile_derived_probes(0),
mark_derived_probes(0),
tracepoint_derived_probes(0),
hrtimer_derived_probes(0),
procfs_derived_probes(0),
dynprobe_derived_probes(0),
python_derived_probes(0),
op (0), up (0),
sym_kprobes_text_start (0),
sym_kprobes_text_end (0),
sym_stext (0),
module_cache (0),
benchmark_sdt_loops(0),
benchmark_sdt_threads(0),
suppressed_warnings(0),
suppressed_errors(0),
warningerr_count(0),
target_namespaces_pid(0),
suppress_costly_diagnostics(0),
last_token (0),
type_res_info (0)
{
struct utsname buf;
(void) uname (& buf);
kernel_release = string (buf.release);
release = kernel_release;
kernel_build_tree = "/lib/modules/" + kernel_release + "/build";
architecture = machine = normalize_machine(buf.machine);
for (unsigned i=0; i<5; i++) perpass_verbose[i]=0;
verbose = 0;
have_script = false;
runtime_specified = false;
include_arg_start = -1;
timing = false;
guru_mode = false;
bulk_mode = false;
unoptimized = false;
suppress_warnings = false;
panic_warnings = false;
dump_mode = systemtap_session::dump_none;
dump_matched_pattern = "";
#ifdef ENABLE_PROLOGUES
prologue_searching_mode = prologue_searching_always;
#else
prologue_searching_mode = prologue_searching_auto;
#endif
buffer_size = 0;
last_pass = 5;
module_name = "stap_" + lex_cast(getpid());
stapconf_name = "stapconf_" + lex_cast(getpid()) + ".h";
output_file = ""; // -o FILE
tmpdir_opt_set = false;
monitor = false;
monitor_interval = 1;
read_stdin = false;
save_module = false;
save_uprobes = false;
modname_given = false;
keep_tmpdir = false;
cmd = "";
target_pid = 0;
use_cache = true;
use_script_cache = true;
poison_cache = false;
tapset_compile_coverage = false;
need_uprobes = false;
need_unwind = false;
need_symbols = false;
need_lines = false;
uprobes_path = "";
load_only = false;
skip_badvars = false;
privilege = pr_stapdev;
privilege_set = false;
compatible = VERSION; // XXX: perhaps also process GIT_SHAID if available?
unwindsym_ldd = false;
client_options = false;
server_cache = NULL;
auto_privilege_level_msg = "";
auto_server_msgs.clear ();
module_sign_given = false;
module_sign_mok_path = "";
use_server_on_error = false;
try_server_status = try_server_unset;
use_remote_prefix = false;
systemtap_v_check = false;
download_dbinfo = 0;
suppress_handler_errors = false;
native_build = true; // presumed
sysroot = "";
update_release_sysroot = false;
suppress_time_limits = false;
target_namespaces_pid = 0;
suppress_costly_diagnostics = 0;
color_mode = color_auto;
color_errors = isatty(STDERR_FILENO) // conditions for coloring when
&& strcmp(getenv("TERM") ?: "notdumb", "dumb"); // on auto
interactive_mode = false;
run_example = false;
no_global_var_display = false;
pass_1a_complete = false;
timeout = 0;
use_bpf_raw_tracepoint = false;
symbol_resolver = 0;
lang_server = 0;
language_server_mode = false;
build_as = "";
build_as_uid = 0;
build_as_gid = 0;
// PR12443: put compiled-in / -I paths in front, to be preferred during
// tapset duplicate-file elimination
const char* s_p = getenv ("SYSTEMTAP_TAPSET");
if (s_p != NULL)
{
include_path.push_back (s_p);
}
else
{
include_path.push_back (string(PKGDATADIR) + "/tapset");
}
/* adding in the XDG_DATA_DIRS variable path,
* this searches in conjunction with SYSTEMTAP_TAPSET
* to locate stap scripts, either can be disabled if
* needed using env $PATH=/dev/null where $PATH is the
* path you want disabled
*/
const char* s_p1 = getenv ("XDG_DATA_DIRS");
if ( s_p1 != NULL )
{
vector<string> dirs;
tokenize(s_p1, dirs, ":");
for(vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i)
{
include_path.push_back(*i + "/systemtap/tapset");
}
}
const char* s_r = getenv ("SYSTEMTAP_RUNTIME");
if (s_r != NULL)
runtime_path = s_r;
else
runtime_path = string(PKGDATADIR) + "/runtime";
const char* s_d = getenv ("SYSTEMTAP_DIR");
if (s_d != NULL)
data_path = s_d;
else
data_path = get_home_directory() + string("/.systemtap");
if (create_dir(data_path.c_str()) == 1)
{
const char* e = strerror (errno);
print_warning("failed to create systemtap data directory \"" + data_path + "\" " + e + ", disabling cache support.");
use_cache = use_script_cache = false;
}
if (use_cache)
{
cache_path = data_path + "/cache";
if (create_dir(cache_path.c_str()) == 1)
{
const char* e = strerror (errno);
print_warning("failed to create cache directory (\" " + cache_path + " \") " + e + ", disabling cache support.");
use_cache = use_script_cache = false;
}
}
const char* s_tc = getenv ("SYSTEMTAP_COVERAGE");
if (s_tc != NULL)
tapset_compile_coverage = true;
const char* s_kr = getenv ("SYSTEMTAP_RELEASE");
if (s_kr != NULL) {
setup_kernel_release(s_kr);
}
}
systemtap_session::systemtap_session (const systemtap_session& other,
const string& arch,
const string& kern):
// NB: pointer members must be manually initialized!
// NB: this needs to consider everything that the base ctor does,
// plus copying any wanted implicit fields (strings, vectors, etc.)
runtime_mode(other.runtime_mode),
base_hash(0),
pattern_root(new match_node),
user_files (other.user_files),
dfa_counter(0),
dfa_maxmap(0),
dfa_maxtag (0),
need_tagged_dfa(other.need_tagged_dfa),
be_derived_probes(0),
generic_kprobe_derived_probes(0),
hwbkpt_derived_probes(0),
perf_derived_probes(0),
uprobe_derived_probes(0),
utrace_derived_probes(0),
itrace_derived_probes(0),
task_finder_derived_probes(0),
vma_tracker_derived_probes(0),
timer_derived_probes(0),
netfilter_derived_probes(0),
profile_derived_probes(0),
mark_derived_probes(0),
tracepoint_derived_probes(0),
hrtimer_derived_probes(0),
procfs_derived_probes(0),
dynprobe_derived_probes(0),
python_derived_probes(0),
op (0), up (0),
sym_kprobes_text_start (0),
sym_kprobes_text_end (0),
sym_stext (0),
module_cache (0),
benchmark_sdt_loops(other.benchmark_sdt_loops),
benchmark_sdt_threads(other.benchmark_sdt_threads),
suppressed_warnings(0),
suppressed_errors(0),
warningerr_count(0),
target_namespaces_pid(0),
suppress_costly_diagnostics(0),
last_token (0),
type_res_info (0),
symbol_resolver (0)
{
release = kernel_release = kern;
kernel_build_tree = "/lib/modules/" + kernel_release + "/build";
kernel_extra_cflags = other.kernel_extra_cflags;
architecture = machine = normalize_machine(arch);
setup_kernel_release(kern.c_str());
native_build = false; // assumed; XXX: could be computed as in check_options()
// These are all copied in the same order as the default ctor did above.
copy(other.perpass_verbose, other.perpass_verbose + 5, perpass_verbose);
verbose = other.verbose;
have_script = other.have_script;
runtime_specified = other.runtime_specified;
include_arg_start = other.include_arg_start;
timing = other.timing;
guru_mode = other.guru_mode;
bulk_mode = other.bulk_mode;
unoptimized = other.unoptimized;
suppress_warnings = other.suppress_warnings;
panic_warnings = other.panic_warnings;
dump_mode = other.dump_mode;
dump_matched_pattern = other.dump_matched_pattern;
prologue_searching_mode = other.prologue_searching_mode;
buffer_size = other.buffer_size;
last_pass = other.last_pass;
module_name = other.module_name;
stapconf_name = other.stapconf_name;
output_file = other.output_file; // XXX how should multiple remotes work?
tmpdir_opt_set = false;
monitor = other.monitor;
monitor_interval = other.monitor_interval;
save_module = other.save_module;
save_uprobes = other.save_uprobes;
modname_given = other.modname_given;
keep_tmpdir = other.keep_tmpdir;
cmd = other.cmd;
target_pid = other.target_pid; // XXX almost surely nonsense for multiremote
use_cache = other.use_cache;
use_script_cache = other.use_script_cache;
poison_cache = other.poison_cache;
tapset_compile_coverage = other.tapset_compile_coverage;
need_uprobes = false;
need_unwind = false;
need_symbols = false;
need_lines = false;
uprobes_path = "";
load_only = other.load_only;
skip_badvars = other.skip_badvars;
privilege = other.privilege;
privilege_set = other.privilege_set;
compatible = other.compatible;
unwindsym_ldd = other.unwindsym_ldd;
client_options = other.client_options;
server_cache = NULL;
use_server_on_error = other.use_server_on_error;
try_server_status = other.try_server_status;
use_remote_prefix = other.use_remote_prefix;
systemtap_v_check = other.systemtap_v_check;
download_dbinfo = other.download_dbinfo;
suppress_handler_errors = other.suppress_handler_errors;
sysroot = other.sysroot;
update_release_sysroot = other.update_release_sysroot;
sysenv = other.sysenv;
suppress_time_limits = other.suppress_time_limits;
color_errors = other.color_errors;
color_mode = other.color_mode;
interactive_mode = other.interactive_mode;
run_example = other.run_example;
no_global_var_display = other.no_global_var_display;
pass_1a_complete = other.pass_1a_complete;
timeout = other.timeout;
language_server_mode = other.language_server_mode;
lang_server = other.lang_server;
build_as = other.build_as;
// don't bother copy typequery_memo
include_path = other.include_path;
runtime_path = other.runtime_path;
// NB: assuming that "other" created these already
data_path = other.data_path;
cache_path = other.cache_path;
tapset_compile_coverage = other.tapset_compile_coverage;
// These are fields that were left to their default ctor, but now we want to
// copy them from "other". In the same order as declared...
script_file = other.script_file;
cmdline_script = other.cmdline_script;
additional_scripts = other.additional_scripts;
stdin_script.str() = other.stdin_script.str();
c_macros = other.c_macros;
args = other.args;
kbuildflags = other.kbuildflags;
globalopts = other.globalopts;
modinfos = other.modinfos;
client_options_disallowed_for_unprivileged = other.client_options_disallowed_for_unprivileged;
server_status_strings = other.server_status_strings;
specified_servers = other.specified_servers;
server_trust_spec = other.server_trust_spec;
server_args = other.server_args;
mok_fingerprints = other.mok_fingerprints;
// HTTP client/server
http_servers = other.http_servers;
unwindsym_modules = other.unwindsym_modules;
auto_privilege_level_msg = other.auto_privilege_level_msg;
auto_server_msgs = other.auto_server_msgs;
create_tmp_dir();
}
systemtap_session::~systemtap_session ()
{
remove_tmp_dir();
delete_map(subsessions);
delete pattern_root;
}
const string
systemtap_session::module_filename() const
{
const char *suffix;
switch (runtime_mode)
{
case kernel_runtime:
suffix = ".ko";
break;
case dyninst_runtime:
suffix = ".so";
break;
case bpf_runtime:
suffix = ".bo";
break;
default:
abort();
}
return module_name + suffix;
}
#if HAVE_NSS
void
systemtap_session::NSPR_init ()
{
if (! NSPR_Initialized)
{
PR_Init (PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
NSPR_Initialized = true;
}
}
#endif // HAVE_NSS
systemtap_session*
systemtap_session::clone(const string& arch, const string& release)
{
const string norm_arch = normalize_machine(arch);
if (this->architecture == norm_arch && this->kernel_release == release)
return this;
systemtap_session*& s = subsessions[make_pair(norm_arch, release)];
if (!s)
s = new systemtap_session(*this, norm_arch, release);
return s;
}
string
systemtap_session::version_string ()
{
string elfutils_version1;
#ifdef _ELFUTILS_VERSION
elfutils_version1 = "0." + lex_cast(_ELFUTILS_VERSION); /* BUILD */
#endif
string elfutils_version2 = dwfl_version(NULL); /* RUN */
if (elfutils_version1 != elfutils_version2)
elfutils_version2 += string("/") + elfutils_version1; /* RUN/BUILD */
return string (VERSION) + "/" + elfutils_version2 + ", " + STAP_EXTENDED_VERSION;
}
pair <string,string>
systemtap_session::kernel_version_range()
{
return make_pair<string,string>("2.6.32", "6.9-rc0"); // PRERELEASE
}
void
systemtap_session::version ()
{
cout << _F("Systemtap translator/driver (version %s)\n"
"Copyright (C) 2005-2024 Red Hat, Inc. and others\n" // PRERELEASE
"This is free software; see the source for copying conditions.\n",
version_string().c_str());
auto vr = kernel_version_range();
cout << _F("tested kernel versions: %s ... %s\n", vr.first.c_str(), vr.second.c_str());
cout << _("enabled features:")
#ifdef HAVE_AVAHI
<< " AVAHI"
#endif
#ifdef HAVE_BOOST_UTILITY_STRING_REF_HPP
<< " BOOST_STRING_REF"
#endif
#ifdef HAVE_DYNINST
<< " DYNINST"
#endif
#ifdef HAVE_BPF_DECLS
<< " BPF"
#endif
#ifdef HAVE_JAVA
<< " JAVA"
#endif
#ifdef HAVE_PYTHON2_PROBES
<< " PYTHON2"
#endif
#ifdef HAVE_PYTHON3_PROBES
<< " PYTHON3"
#endif
#ifdef HAVE_LIBRPM
<< " LIBRPM"
#endif
#ifdef HAVE_LIBSQLITE3
<< " LIBSQLITE3"
#endif
#ifdef HAVE_LIBVIRT
<< " LIBVIRT"
#endif
#ifdef HAVE_LIBXML2
<< " LIBXML2"
#endif
#ifdef ENABLE_NLS
<< " NLS"
#endif
#ifdef HAVE_NSS
<< " NSS"
#endif
#ifdef ENABLE_PROLOGUES
<< " PROLOGUES"
#endif
#ifdef HAVE_LIBREADLINE
<< " READLINE"
#endif
#ifdef HAVE_MONITOR_LIBS
<< " MONITOR_LIBS"
#endif
#ifdef HAVE_JSON_C
<< " JSON_C"
#endif
#ifdef HAVE_LIBDEBUGINFOD
<< " LIBDEBUGINFOD"
#endif
#ifdef METADATA_QUERY_ENABLED
<< " METADATA"
#endif
<< endl;
}
void
systemtap_session::usage (int exitcode)
{
// For error cases, just suggest --help, so we don't obscure
// the actual error message with all the help text.
if (exitcode != EXIT_SUCCESS)
{
clog << _("Try '--help' for more information. [man stap]") << endl;
clog << _("A message like [man foo] means for more info, run % man foo") << endl;
throw exit_exception(exitcode);
}
version ();
cout
<< endl
<< _F(
"Usage: stap [options] FILE Run script in file.\n"
" or: stap [options] - Run script on stdin.\n"
" or: stap [options] -e SCRIPT Run given script.\n"
" or: stap [options] -l PROBE List matching probes.\n"
" or: stap [options] -L PROBE List matching probes and local variables.\n"
" or: stap [options] --dump-probe-types List available probe types.\n"
" or: stap [options] --dump-probe-aliases List available probe aliases.\n"
" or: stap [options] --dump-functions List available functions.\n\n"
"Options (in %s/rc and on command line):\n"
" -- end of translator options, script options follow\n"
" -h --help show help\n"
" -V --version\n"
" show version\n"
" -p NUM stop after pass NUM 1-5, instead of %d\n"
" (parse, elaborate, translate, compile, run)\n"
" -v add verbosity to all passes\n"
" --vp {N}+ add per-pass verbosity [", data_path.c_str(), last_pass);
for (unsigned i=0; i<5; i++)
cout << (perpass_verbose[i] <= 9 ? perpass_verbose[i] : 9);
cout
<< "]" << endl;
cout << _F(" -k keep temporary directory\n"
" -u unoptimized translation %s\n"
" -w suppress warnings %s\n"
" -W turn warnings into errors %s\n"
" -g guru mode %s\n"
" -P prologue-searching for function probes %s\n"
" -b bulk (percpu file) mode %s\n"
#ifdef HAVE_LIBREADLINE
" -i --interactive\n"
" interactive mode %s\n"
#endif
" -s NUM buffer size in megabytes, instead of %d\n"
" -I DIR look in DIR for additional .stp script files", (unoptimized ? _(" [set]") : ""),
(suppress_warnings ? _(" [set]") : ""), (panic_warnings ? _(" [set]") : ""),
(guru_mode ? _(" [set]") : ""), (prologue_searching_mode == prologue_searching_always ? _(" [set]") : ""),
(bulk_mode ? _(" [set]") : ""),
#ifdef HAVE_LIBREADLINE
(interactive_mode ? _(" [set]") : ""),
#endif
buffer_size);
if (include_path.size() == 0)
cout << endl;
else
cout << _(", in addition to") << endl;
for (unsigned i=0; i<include_path.size(); i++)
cout << " " << include_path[i].c_str() << endl;
cout
<< _F(" -D NM=VAL emit macro definition into generated C code\n"
" -B NM=VAL pass option to kbuild make\n"
" --modinfo NM=VAL\n"
" include a MODULE_INFO(NM,VAL) in the generated C code\n"
" -G VAR=VAL set global variable to value\n"
//TRANSLATORS: translating 'runtime' is not advised
" -R DIR look in DIR for runtime, instead of\n"
" %s\n"
" -r DIR cross-compile to kernel with given build tree; or else\n"
" -r RELEASE cross-compile to kernel /lib/modules/RELEASE/build, instead of\n"
" %s\n"
" -a ARCH cross-compile to given architecture, instead of %s\n"
" -m MODULE set probe module name, instead of \n"
" %s\n"
" -o FILE send script output to file, instead of stdout. This supports\n"
" strftime(3) formats for FILE\n"
" -E SCRIPT run the SCRIPT in addition to the main script specified\n"
" through -e or a script file\n"
" -c CMD start the probes, run CMD, and exit when it finishes\n"
" -x PID sets target() to PID\n"
" -F run as on-file flight recorder with -o.\n"
" run as on-memory flight recorder without -o.\n"
" -S size[,n] set maximum of the size and the number of files.\n"
" -d OBJECT add unwind/symbol data for OBJECT file", runtime_path.c_str(), kernel_build_tree.c_str(), architecture.c_str(), module_name.c_str());
if (unwindsym_modules.size() == 0)
cout << endl;
else
cout << _(", in addition to") << endl;
{
vector<string> syms (unwindsym_modules.begin(), unwindsym_modules.end());
for (unsigned i=0; i<syms.size(); i++)
cout << " " << syms[i].c_str() << endl;
}
cout
<< _F(" --ldd add unwind/symbol data for referenced user-space objects.\n"
" --all-modules\n"
" add unwind/symbol data for all loaded kernel objects.\n"
" -t collect probe timing information\n"
" -T TIME terminate the script after TIME seconds\n"
#ifdef HAVE_LIBSQLITE3
" -q generate information on tapset coverage\n"
#endif /* HAVE_LIBSQLITE3 */
" --runtime=MODE\n"
" set the pass-5 runtime mode, instead of kernel\n"
#ifdef HAVE_DYNINST
" --dyninst\n"
" shorthand for --runtime=dyninst\n"
#endif /* HAVE_DYNINST */
#ifdef HAVE_BPF_DECLS
" --bpf\n"
" shorthand for --runtime=bpf\n"
#endif /* HAVE_BPF_DECLS */
" --prologue-searching[=WHEN]\n"
" prologue-searching for function probes\n"
" --privilege=PRIVILEGE_LEVEL\n"
" check the script for constructs not allowed at the given privilege level\n"
" --unprivileged\n"
" equivalent to --privilege=stapusr\n"
" --compatible=VERSION\n"
" suppress incompatible language/tapset changes beyond VERSION,\n"
" instead of %s\n"
" --check-version\n"
" displays warnings where a syntax element may be \n"
" version dependent\n"
" --skip-badvars\n"
" substitute zero for bad context $variables\n"
" --suppress-handler-errors\n"
" catch all runtime errors, quietly skip probe handlers\n"
" --use-server[=SERVER-SPEC]\n"
" specify systemtap compile-servers\n"
" --list-servers[=PROPERTIES]\n"
" report on the status of the specified compile-servers:\n"
" all,specified,online,trusted,signer,compatible\n"
#if HAVE_NSS
" --trust-servers[=TRUST-SPEC]\n"
" add/revoke trust of specified compile-servers:\n"
" ssl,signer,all-users,revoke,no-prompt\n"
" --use-server-on-error[=yes/no]\n"
" retry compilation using a compile server upon compilation error\n"
#endif
#ifdef HAVE_HTTP_SUPPORT
" --use-http-server=SERVER-SPEC\n"
" specify systemtap http compile server\n"
#endif
" --remote=HOSTNAME\n"
" run pass 5 on the specified ssh host.\n"
" may be repeated for targeting multiple hosts.\n"
" --remote-prefix\n"
" prefix each line of remote output with a host index.\n"
" --tmpdir=NAME\n"
" specify name of temporary directory to be used.\n"
" --download-debuginfo[=OPTION]\n"
" automatically download debuginfo using ABRT.\n"
" yes,no,ask,<timeout value>\n"
" --dump-probe-types\n"
" show a list of available probe types.\n"
" --sysroot=DIR\n"
" specify sysroot directory where target files (executables,\n" " libraries, etc.) are located.\n"
" --sysenv=VAR=VALUE\n"
" provide an alternate value for an environment variable\n"
" where the value on a remote system differs. Path\n"
" variables (e.g. PATH, LD_LIBRARY_PATH) are assumed to be\n"
" relative to the sysroot.\n"
" --suppress-time-limits\n"
" disable -DSTP_OVERLOAD, -DMAXACTION, and -DMAXTRYACTION limits\n"
" --save-uprobes\n"
" save uprobes.ko to current directory if it is built from source\n"
" --target-namespace=PID\n"
" sets the target namespaces pid to PID\n"
#if HAVE_MONITOR_LIBS
" --monitor=INTERVAL\n"
" enables runtime interactive monitoring\n"
#endif
#if HAVE_JSON_C && HAVE_LANGUAGE_SERVER_SUPPORT
" --language-server\n"
" starts a systemtap language server\n"
#endif
" --build-as=VALUE\n"
" Set user running passes 1-4\n"
, compatible.c_str()) << endl
;
time_t now;
time (& now);
struct tm* t = localtime (& now);
if (t && t->tm_mon*3 + t->tm_mday*173 == 0xb6)
cout << morehelp << endl;
throw exit_exception (exitcode);
}
int
systemtap_session::parse_cmdline (int argc, char * const argv [])
{
client_options_disallowed_for_unprivileged = "";
std::set<std::string> additional_unwindsym_modules;
struct rlimit our_rlimit;
bool sysroot_option_seen = false;
string kernel_release_value;
while (true)
{
char * num_endptr;
int grc = getopt_long (argc, argv, STAP_SHORT_OPTIONS, stap_long_options, NULL);
// NB: when adding new options, consider very carefully whether they
// should be restricted from stap clients (after --client-options)!
if (grc < 0)
break;
switch (grc)
{
case 'V':
version ();
throw exit_exception (EXIT_SUCCESS);
case 'v':
server_args.push_back (string ("-") + (char)grc);
for (unsigned i=0; i<5; i++)
perpass_verbose[i] ++;
verbose ++;
break;
case 'G':
// Make sure the global option is only composed of the
// following chars: [_=a-zA-Z0-9.-]
assert(optarg);
assert_regexp_match("-G parameter", optarg, "^[a-z_][a-z0-9_]*=[a-z0-9_.-]+$");
globalopts.push_back (string(optarg));
break;
case 't':
server_args.push_back (string ("-") + (char)grc);
timing = true;
break;
case 'w':
server_args.push_back (string ("-") + (char)grc);
suppress_warnings = true;
break;
case 'W':
server_args.push_back (string ("-") + (char)grc);
panic_warnings = true;
break;
case 'p':
assert(optarg);
last_pass = (int)strtoul(optarg, &num_endptr, 10);
if (*num_endptr != '\0' || last_pass < 1 || last_pass > 5)
{
cerr << _("Invalid pass number (should be 1-5).") << endl;
return 1;
}
server_args.push_back (string ("-") + (char)grc + optarg);
break;
case 'I':
assert(optarg);
if (client_options)
client_options_disallowed_for_unprivileged += client_options_disallowed_for_unprivileged.empty () ? "-I" : ", -I";
if (include_arg_start == -1)
include_arg_start = include_path.size ();
include_path.push_back (string (optarg));
break;
case 'd':
assert(optarg);
server_args.push_back (string ("-") + (char)grc + optarg);
{
// Make sure an empty data object wasn't specified (-d "")
if (strlen (optarg) == 0)
{
cerr << _("Data object (-d) cannot be empty.") << endl;
return 1;
}
// At runtime user module names are resolved through their
// canonical (absolute) path, or else it's a kernel module name.
// The sysroot option might change the path to a user module.
additional_unwindsym_modules.insert (resolve_path (optarg));
// NB: we used to enable_vma_tracker() here for PR10228, but now
// we'll leave that to pragma:vma functions which actually use it.
break;
}
case 'e':
assert(optarg);
if (have_script)
{
cerr << _("Only one script can be given on the command line.")
<< endl;
return 1;
}
server_args.push_back (string ("-") + (char)grc + optarg);
cmdline_script = string (optarg);
have_script = true;
break;
case 'E':
assert(optarg);
server_args.push_back (string("-") + (char)grc + optarg);
additional_scripts.push_back(string (optarg));
// don't set have_script to true, since this script is meant to be
// given in addition to a script/script_file.
break;
case 'o':
assert(optarg);
// NB: client_options not a problem, since pass 1-4 does not use output_file.
server_args.push_back (string ("-") + (char)grc + optarg);
output_file = string (optarg);
break;
case 'R':
assert(optarg);
if (client_options) { cerr << _F("ERROR: %s invalid with %s", "-R", "--client-options") << endl; return 1; }
runtime_specified = true;
runtime_path = string (optarg);
break;
case 'm':
assert(optarg);
if (client_options)
client_options_disallowed_for_unprivileged += client_options_disallowed_for_unprivileged.empty () ? "-m" : ", -m";
module_name = string (optarg);
save_module = true;
modname_given = true;
{
// If the module name ends with '.ko', chop it off since
// modutils doesn't like modules named 'foo.ko.ko'.
if (endswith(module_name, ".ko") || endswith(module_name, ".so"))
{
module_name.erase(module_name.size() - 3);
cerr << _F("Truncating module name to '%s'", module_name.c_str()) << endl;
}
// Make sure an empty module name wasn't specified (-m "")
if (module_name.empty())
{
cerr << _("Module name cannot be empty.") << endl;
return 1;
}
// Make sure the module name is only composed of the
// following chars: [a-z0-9_]
assert_regexp_match("-m parameter", module_name, "^[a-z0-9_]+$");
// Make sure module name isn't too long.
if (module_name.size() >= (MODULE_NAME_LEN - 1))
{
module_name.resize(MODULE_NAME_LEN - 1);
cerr << _F("Truncating module name to '%s'", module_name.c_str()) << endl;
}
}
server_args.push_back (string ("-") + (char)grc + optarg);
use_script_cache = false;
break;
case 'r':
assert(optarg);
if (client_options) // NB: no paths!
// Note that '-' must come last in a regex bracket expression.
assert_regexp_match("-r parameter from client", optarg, "^[a-z0-9_.+-]+$");
server_args.push_back (string ("-") + (char)grc + optarg);
kernel_release_value = optarg;
break;
case 'a':
assert(optarg);
assert_regexp_match("-a parameter", optarg, "^[a-z0-9_-]+$");
server_args.push_back (string ("-") + (char)grc + optarg);
architecture = string(optarg);
break;
case 'k':
if (client_options) { cerr << _F("ERROR: %s invalid with %s", "-k", "--client-options") << endl; return 1; }
keep_tmpdir = true;
use_script_cache = false; /* User wants to keep a usable build tree. */
break;
case 'g':
server_args.push_back (string ("-") + (char)grc);
guru_mode = true;
break;
case 'i':
case LONG_OPT_INTERACTIVE:
#ifdef HAVE_LIBREADLINE
if (client_options) { cerr << _F("ERROR: %s invalid with %s", "-i", "--client-options") << endl; return 1; }
interactive_mode = true;
#endif
break;
case 'P':
server_args.push_back (string ("-") + (char)grc);
prologue_searching_mode = prologue_searching_always;
break;
case 'b':
server_args.push_back (string ("-") + (char)grc);
bulk_mode = true;
break;
case 'u':
server_args.push_back (string ("-") + (char)grc);
unoptimized = true;
break;
case 's':
assert(optarg);
buffer_size = (int) strtoul (optarg, &num_endptr, 10);
if (*num_endptr != '\0' || buffer_size < 1 || buffer_size > 4095)
{
cerr << _("Invalid buffer size (should be 1-4095).") << endl;
return 1;
}
server_args.push_back (string ("-") + (char)grc + optarg);
break;
case 'c':
assert(optarg);
cmd = string (optarg);
if (cmd == "")
{
// This would mess with later code deciding to pass -c
// through to staprun
cerr << _("Empty CMD string invalid.") << endl;
return 1;
}
server_args.push_back (string ("-") + (char)grc + optarg);
break;
case 'x':
assert(optarg);
target_pid = (int) strtoul(optarg, &num_endptr, 10);
if (*num_endptr != '\0')
{
cerr << _("Invalid target process ID number.") << endl;
return 1;
}
server_args.push_back (string ("-") + (char)grc + optarg);
break;
case 'D':
assert(optarg);
assert_regexp_match ("-D parameter", optarg, "^[a-z_][a-z_0-9]*(=-?[a-z_0-9]+)?$");
if (client_options)
client_options_disallowed_for_unprivileged += client_options_disallowed_for_unprivileged.empty () ? "-D" : ", -D";
server_args.push_back (string ("-") + (char)grc + optarg);
c_macros.push_back (string (optarg));
break;
case 'S':
assert(optarg);
assert_regexp_match ("-S parameter", optarg, "^[0-9]+(,[0-9]+)?$");
server_args.push_back (string ("-") + (char)grc + optarg);
size_option = string (optarg);
break;
case 'T':
assert(optarg);
timeout = (int) 1000*strtod(optarg, &num_endptr); // convert to ms
if (*num_endptr != '\0' || timeout < 1)
{
cerr << _("Invalid timeout interval.") << endl;
return 1;
}
break;
case 'q':
if (client_options) { cerr << _F("ERROR: %s invalid with %s", "-q", "--client-options") << endl; return 1; }
server_args.push_back (string ("-") + (char)grc);
tapset_compile_coverage = true;
break;
case 'h':
usage (0);
break;
case 'L':
if (dump_mode)
{
cerr << _("ERROR: only one of the -l/-L/--dump-* "
"switches may be specified") << endl;
return 1;
}
assert(optarg);
server_args.push_back (string ("-") + (char)grc + optarg);
dump_mode = systemtap_session::dump_matched_probes_vars;
dump_matched_pattern = optarg;
unoptimized = true; // This causes retention of vars for listing
suppress_warnings = true;
break;
case 'l':
if (dump_mode)
{
cerr << _("ERROR: only one of the -l/-L/--dump-* "
"switches may be specified") << endl;
return 1;
}
assert(optarg);
server_args.push_back (string ("-") + (char)grc + optarg);
dump_mode = systemtap_session::dump_matched_probes;
dump_matched_pattern = optarg;
suppress_warnings = true;
break;
case 'F':
server_args.push_back (string ("-") + (char)grc);
load_only = true;
break;
case 'B':
if (client_options) { cerr << _F("ERROR: %s invalid with %s", "-B", "--client-options") << endl; return 1; }
assert(optarg);
server_args.push_back (string ("-") + (char)grc + optarg);
kbuildflags.push_back (string (optarg));
break;
case LONG_OPT_VERSION:
version ();
throw exit_exception (EXIT_SUCCESS);
case LONG_OPT_VERBOSE_PASS:
{
assert(optarg);
bool ok = true;
if (strlen(optarg) < 1 || strlen(optarg) > 5)
ok = false;
if (ok)
{
for (unsigned i=0; i<strlen(optarg); i++)
if (isdigit (optarg[i]))
perpass_verbose[i] += optarg[i]-'0';
else
ok = false;
}
if (! ok)
{
cerr << _("Invalid --vp argument: it takes 1 to 5 digits.") << endl;
return 1;
}
// NB: we don't do this: last_pass = strlen(optarg);
server_args.push_back ("--vp=" + string(optarg));
break;
}
case LONG_OPT_SKIP_BADVARS:
server_args.push_back ("--skip-badvars");
skip_badvars = true;
break;
case LONG_OPT_PRIVILEGE:
{
// We allow only multiple privilege-setting options if they all specify the same
// privilege level. The server also expects and depends on this behaviour when
// examining the client-side options passed to it.
privilege_t newPrivilege;
assert(optarg);
if (strcmp (optarg, "stapdev") == 0)
newPrivilege = pr_stapdev;
else if (strcmp (optarg, "stapsys") == 0)
newPrivilege = pr_stapsys;
else if (strcmp (optarg, "stapusr") == 0)
newPrivilege = pr_stapusr;
else
{
cerr << _F("Invalid argument '%s' for --privilege.", optarg) << endl;
return 1;
}
if (privilege_set && newPrivilege != privilege)
{
cerr << _("Privilege level may be set only once.") << endl;
return 1;
}
privilege = newPrivilege;
privilege_set = true;
server_args.push_back ("--privilege=" + string(optarg));
}
/* NB: for server security, it is essential that once this flag is
set, no future flag be able to unset it. */
break;
case LONG_OPT_UNPRIVILEGED:
// We allow only multiple privilege-setting options if they all specify the same
// privilege level. The server also expects and depends on this behaviour when
// examining the client-side options passed to it.
if (privilege_set && pr_unprivileged != privilege)
{
cerr << _("Privilege level may be set only once.") << endl;
return 1;
}
privilege = pr_unprivileged;
privilege_set = true;
server_args.push_back ("--unprivileged");
/* NB: for server security, it is essential that once this flag is
set, no future flag be able to unset it. */
break;
case LONG_OPT_CLIENT_OPTIONS:
client_options = true;
break;
case LONG_OPT_TMPDIR:
if (client_options) {
cerr << _F("ERROR: %s is invalid with %s", "--tmpdir", "--client-options") << endl;
return 1;
}
tmpdir_opt_set = true;
tmpdir = optarg;
break;
case LONG_OPT_DOWNLOAD_DEBUGINFO:
if(optarg)
{
if(strcmp(optarg, "no") == 0)
download_dbinfo = 0; //Disable feature
else if (strcmp(optarg, "yes") == 0)
download_dbinfo = INT_MAX; //Enable, No Timeout
/* NOTE: Timeout and Asking for Confirmation features below are not supported yet by abrt
* in version abrt-2.0.3-1.fc15.x86_64, Bugzilla: BZ730107 (timeout), BZ726192 ('-y') */
else if(atoi(optarg) > 0)
download_dbinfo = atoi(optarg); //Enable, Set timeout to optarg
else if (strcmp(optarg, "ask") == 0)
download_dbinfo = -1; //Enable, Ask for confirmation
else
{
cerr << _F("ERROR: %s is not a valid value. Use 'yes', 'no', 'ask' or a timeout value.", optarg) << endl;
return 1;
}
}
else
download_dbinfo = INT_MAX; //Enable, No Timeout
break;
case LONG_OPT_USE_SERVER:
if (client_options) {
cerr << _F("ERROR: %s is invalid with %s", "--use-server", "--client-options") << endl;
return 1;
}
if (optarg)
specified_servers.push_back (optarg);
else
specified_servers.push_back ("");
break;
case LONG_OPT_USE_SERVER_ON_ERROR:
if (client_options) {
cerr << _F("ERROR: %s is invalid with %s", "--use-server-on-error", "--client-options") << endl;
return 1;
}
if (optarg)
{
string arg = optarg;
for (unsigned i = 0; i < arg.size (); ++i)
arg[i] = tolower (arg[i]);
if (arg == "yes" || arg == "ye" || arg == "y")
use_server_on_error = true;
else if (arg == "no" || arg == "n")
use_server_on_error = false;
else
cerr << _F("Invalid argument '%s' for --use-server-on-error.", optarg) << endl;
}
else
use_server_on_error = true;
break;
case LONG_OPT_LIST_SERVERS:
if (client_options) {
cerr << _F("ERROR: %s is invalid with %s", "--list-servers", "--client-options") << endl;
return 1;
}
if (optarg)
server_status_strings.push_back (optarg);
else
server_status_strings.push_back ("");
break;
case LONG_OPT_TRUST_SERVERS:
if (client_options) {
cerr << _F("ERROR: %s is invalid with %s", "--trust-servers", "--client-options") << endl;
return 1;
}
if (optarg)
server_trust_spec = optarg;
else
server_trust_spec = "ssl";
break;
#ifdef HAVE_HTTP_SUPPORT
case LONG_OPT_USE_HTTP_SERVER:
if (client_options) {
cerr << _F("ERROR: %s is invalid with %s", "--use-http-server", "--client-options") << endl;
return 1;
}
http_servers.push_back (optarg);
break;
#endif
case LONG_OPT_HELP:
usage (0);
break;
case LONG_OPT_RUN_EXAMPLE:
run_example = true;
break;
// The caching options should not be available to server clients
case LONG_OPT_DISABLE_CACHE:
if (client_options) {
cerr << _F("ERROR: %s is invalid with %s", "--disable-cache", "--client-options") << endl;
return 1;
}
use_cache = use_script_cache = false;
break;
case LONG_OPT_POISON_CACHE:
if (client_options) {
cerr << _F("ERROR: %s is invalid with %s", "--poison-cache", "--client-options") << endl;
return 1;
}
poison_cache = true;
break;
case LONG_OPT_CLEAN_CACHE:
if (client_options) {
cerr << _F("ERROR: %s is invalid with %s", "--clean-cache", "--client-options") << endl;
return 1;
}
clean_cache(*this);
throw exit_exception(EXIT_SUCCESS);
case LONG_OPT_COMPATIBLE:
assert(optarg);
server_args.push_back ("--compatible=" + string(optarg));
if (strverscmp(optarg, VERSION) > 0) {
cerr << _F("ERROR: systemtap version %s cannot be compatible with future version %s", VERSION, optarg)
<< endl;
return 1;
}
compatible = optarg;
break;
case LONG_OPT_LDD:
if (client_options) {
cerr << _F("ERROR: %s is invalid with %s", "--ldd", "--client-options") << endl;
return 1;
}
unwindsym_ldd = true;
break;
case LONG_OPT_ALL_MODULES:
if (client_options) {
cerr << _F("ERROR: %s is invalid with %s", "--all-modules", "--client-options") << endl;
return 1;
}
insert_loaded_modules();
break;
#if HAVE_NSS
case LONG_OPT_SIGN_MODULE:
module_sign_given = true;
if (optarg)
{
module_sign_mok_path = optarg;
if (!client_options) {
cerr << _F("ERROR: %s is only valid with %s", "--sign-module=PATH", "--client-options") << endl;
return 1;
}
}
break;
#endif
case LONG_OPT_REMOTE:
if (client_options) {
cerr << _F("ERROR: %s is invalid with %s", "--remote", "--client-options") << endl;
return 1;
}
remote_uris.push_back(optarg);
break;
case LONG_OPT_REMOTE_PREFIX:
if (client_options) {
cerr << _F("ERROR: %s is invalid with %s", "--remote-prefix", "--client-options") << endl;
return 1;
}
use_remote_prefix = true;
break;
case LONG_OPT_CHECK_VERSION:
server_args.push_back ("--check-version");
systemtap_v_check = true;
break;
case LONG_OPT_DUMP_PROBE_TYPES:
if (dump_mode)
{
cerr << _("ERROR: only one of the -l/-L/--dump-* "
"switches may be specified") << endl;
return 1;
}
server_args.push_back ("--dump-probe-types");
dump_mode = systemtap_session::dump_probe_types;
break;
case LONG_OPT_DUMP_PROBE_ALIASES:
if (dump_mode)
{
cerr << _("ERROR: only one of the -l/-L/--dump-* "
"switches may be specified") << endl;
return 1;
}
server_args.push_back ("--dump-probe-aliases");
suppress_warnings = true;
dump_mode = systemtap_session::dump_probe_aliases;
break;
case LONG_OPT_DUMP_FUNCTIONS:
if (dump_mode)
{
cerr << _("ERROR: only one of the -l/-L/--dump-* "
"switches may be specified") << endl;
return 1;
}
server_args.push_back ("--dump-functions");
suppress_warnings = true;
dump_mode = systemtap_session::dump_functions;
unoptimized = true; // Keep unused functions (which is all of them)
break;
case LONG_OPT_SUPPRESS_HANDLER_ERRORS:
suppress_handler_errors = true;
c_macros.push_back (string ("STAP_SUPPRESS_HANDLER_ERRORS"));
break;
case LONG_OPT_MODINFO:
// Make sure the global option is only composed of the
// following chars: [_=a-zA-Z0-9]
if (client_options) {
cerr << _F("ERROR: %s is invalid with %s", "--modinfo", "--client-options") << endl;
return 1;
}
assert(optarg);
assert_regexp_match("--modinfo parameter", optarg, "^[a-z_][a-z0-9_]*=.+$");
modinfos.push_back (string(optarg));
break;
case LONG_OPT_RLIMIT_AS:
assert(optarg);
if(getrlimit(RLIMIT_AS, & our_rlimit))
cerr << _F("Unable to obtain resource limits for rlimit-as : %s", strerror (errno)) << endl;
if (strlen(optarg) == 0) {
cerr << _("An --rlimit-as option value must be specified.") << endl;
return 1;
}
our_rlimit.rlim_max = our_rlimit.rlim_cur = strtoul (optarg, &num_endptr, 0);
if(*num_endptr) {
cerr << _F("Unable to convert rlimit-as resource limit '%s'.", optarg) << endl;
return 1;
}
if(setrlimit (RLIMIT_AS, & our_rlimit)) {
int saved_errno = errno;
cerr << _F("Unable to set resource limits for rlimit-as : %s", strerror (errno)) << endl;
if (saved_errno != EPERM)
return 1;
}
/* Disable core dumps, since exhaustion results in uncaught bad_alloc etc. exceptions */
our_rlimit.rlim_max = our_rlimit.rlim_cur = 0;
(void) setrlimit (RLIMIT_CORE, & our_rlimit);
break;
case LONG_OPT_RLIMIT_CPU:
assert(optarg);
if(getrlimit(RLIMIT_CPU, & our_rlimit))
cerr << _F("Unable to obtain resource limits for rlimit-cpu : %s", strerror (errno)) << endl;
if (strlen(optarg) == 0) {
cerr << _("An --rlimit-cpu option value must be specified.") << endl;
return 1;
}
our_rlimit.rlim_max = our_rlimit.rlim_cur = strtoul (optarg, &num_endptr, 0);
if(*num_endptr) {
cerr << _F("Unable to convert resource limit '%s' for rlimit-cpu", optarg) << endl;
return 1;
}
if(setrlimit (RLIMIT_CPU, & our_rlimit)) {
int saved_errno = errno;
cerr << _F("Unable to set resource limits for rlimit-cpu : %s", strerror (errno)) << endl;
if (saved_errno != EPERM)
return 1;
}
break;
case LONG_OPT_RLIMIT_NPROC:
assert(optarg);
if(getrlimit(RLIMIT_NPROC, & our_rlimit))
cerr << _F("Unable to obtain resource limits for rlimit-nproc : %s", strerror (errno)) << endl;
if (strlen(optarg) == 0) {
cerr << _("An --rlimit-nproc option value must be specified.") << endl;
return 1;
}
our_rlimit.rlim_max = our_rlimit.rlim_cur = strtoul (optarg, &num_endptr, 0);
if(*num_endptr) {
cerr << _F("Unable to convert resource limit '%s' for rlimit-nproc", optarg) << endl;
return 1;
}
if(setrlimit (RLIMIT_NPROC, & our_rlimit)) {
int saved_errno = errno;
cerr << _F("Unable to set resource limits for rlimit-nproc : %s", strerror (errno)) << endl;
if (saved_errno != EPERM)
return 1;
}
break;
case LONG_OPT_RLIMIT_STACK:
assert(optarg);
if(getrlimit(RLIMIT_STACK, & our_rlimit))
cerr << _F("Unable to obtain resource limits for rlimit-stack : %s", strerror (errno)) << endl;
if (strlen(optarg) == 0) {
cerr << _("An --rlimit-stack option value must be specified.") << endl;
return 1;
}
our_rlimit.rlim_max = our_rlimit.rlim_cur = strtoul (optarg, &num_endptr, 0);
if(*num_endptr) {
cerr << _F("Unable to convert resource limit '%s' for rlimit-stack", optarg) << endl;
return 1;
}
if(setrlimit (RLIMIT_STACK, & our_rlimit)) {
int saved_errno = errno;
cerr << _F("Unable to set resource limits for rlimit-stack : %s", strerror (errno)) << endl;
if (saved_errno != EPERM)
return 1;
}
/* Disable core dumps, since exhaustion results in SIGSEGV */
our_rlimit.rlim_max = our_rlimit.rlim_cur = 0;
(void) setrlimit (RLIMIT_CORE, & our_rlimit);
break;
case LONG_OPT_RLIMIT_FSIZE:
assert(optarg);
if(getrlimit(RLIMIT_FSIZE, & our_rlimit))
cerr << _F("Unable to obtain resource limits for rlimit-fsize : %s", strerror (errno)) << endl;
if (strlen(optarg) == 0) {
cerr << _("An --rlimit-fsize option value must be specified.") << endl;
return 1;
}
our_rlimit.rlim_max = our_rlimit.rlim_cur = strtoul (optarg, &num_endptr, 0);
if(*num_endptr) {
cerr << _F("Unable to convert resource limit '%s' for rlimit-fsize", optarg) << endl;
return 1;
}
if(setrlimit (RLIMIT_FSIZE, & our_rlimit)) {
int saved_errno = errno;
cerr << _F("Unable to set resource limits for rlimit-fsize : %s", strerror (errno)) << endl;
if (saved_errno != EPERM)
return 1;
}
break;
case LONG_OPT_SYSROOT:
if (client_options) {
cerr << _F("ERROR: %s invalid with %s", "--sysroot", "--client-options") << endl;
return 1;
} else if (sysroot_option_seen) {
cerr << "ERROR: multiple --sysroot options not supported" << endl;
return 1;
} else {
char *spath;
assert(optarg);
spath = canonicalize_file_name (optarg);
if (spath == NULL) {
cerr << _F("ERROR: %s is an invalid directory for --sysroot", optarg) << endl;
return 1;
}
sysroot = string(spath);
free (spath);
// We do path creation like this:
// sysroot + "/lib/modules"
// So, we don't want the sysroot path to end with a '/',
// otherwise we'll end up with '/foo//lib/modules'.
if (!sysroot.empty() && *(sysroot.end() - 1) == '/') {
sysroot.erase(sysroot.end() - 1);
}
}
sysroot_option_seen = true;
break;
case LONG_OPT_SYSENV:
if (client_options) {
cerr << _F("ERROR: %s invalid with %s", "--sysenv", "--client-options") << endl;
return 1;
} else {
string sysenv_str = optarg;
string value;
size_t pos;
if (! sysroot_option_seen) {
cerr << "ERROR: --sysenv must follow --sysroot" << endl;
return 1;
}
pos = sysenv_str.find("=");
if (pos == string::npos) {
cerr << _F("ERROR: %s is an invalid argument for --sysenv", optarg) << endl;
return 1;
}
value = sysenv_str.substr(pos + 1);
sysenv[sysenv_str.substr(0, pos)] = value;
break;
}
case LONG_OPT_SUPPRESS_TIME_LIMITS: //require guru_mode to use
if (guru_mode == false)
{
cerr << _F("ERROR %s requires guru mode (-g)", "--suppress-time-limits") << endl;
return 1;
}
else
{
suppress_time_limits = true;
server_args.push_back (string ("--suppress-time-limits"));
c_macros.push_back (string ("STAP_SUPPRESS_TIME_LIMITS_ENABLE"));
break;
}
case LONG_OPT_RUNTIME:
if (!parse_cmdline_runtime (optarg))
return 1;
break;
case LONG_OPT_RUNTIME_DYNINST:
if (!parse_cmdline_runtime ("dyninst"))
return 1;
break;
case LONG_OPT_RUNTIME_BPF:
if (!parse_cmdline_runtime ("bpf"))
return 1;
break;
case LONG_OPT_BENCHMARK_SDT:
// XXX This option is secret, not supported, subject to change at our whim
benchmark_sdt_threads = thread::hardware_concurrency();
break;
case LONG_OPT_BENCHMARK_SDT_LOOPS:
assert(optarg != 0); // optarg can't be NULL (or getopt would choke)
// XXX This option is secret, not supported, subject to change at our whim
benchmark_sdt_loops = strtoul(optarg, NULL, 10);
break;
case LONG_OPT_BENCHMARK_SDT_THREADS:
assert(optarg != 0); // optarg can't be NULL (or getopt would choke)
// XXX This option is secret, not supported, subject to change at our whim
benchmark_sdt_threads = strtoul(optarg, NULL, 10);
break;
case LONG_OPT_COLOR_ERRS:
// --color without arg is equivalent to always
if (!optarg || !strcmp(optarg, "always"))
color_mode = color_always;
else if (!strcmp(optarg, "auto"))
color_mode = color_auto;
else if (!strcmp(optarg, "never"))
color_mode = color_never;
else {
cerr << _F("Invalid argument '%s' for --color.", optarg) << endl;
return 1;
}
color_errors = color_mode == color_always
|| (color_mode == color_auto && isatty(STDERR_FILENO) &&
strcmp(getenv("TERM") ?: "notdumb", "dumb"));
break;
case LONG_OPT_PROLOGUE_SEARCHING:
// --prologue-searching without arg is equivalent to always
if (!optarg || !strcmp(optarg, "always"))
prologue_searching_mode = prologue_searching_always;
else if (!strcmp(optarg, "auto"))
prologue_searching_mode = prologue_searching_auto;
else if (!strcmp(optarg, "never"))
prologue_searching_mode = prologue_searching_never;
else {
cerr << _F("Invalid argument '%s' for --prologue-searching.", optarg) << endl;
return 1;
}
break;
case LONG_OPT_SAVE_UPROBES:
save_uprobes = true;
break;
case LONG_OPT_TARGET_NAMESPACES:
assert(optarg);
target_namespaces_pid = (int) strtoul(optarg, &num_endptr, 10);
if (*num_endptr != '\0' || target_namespaces_pid < 1)
{
cerr << _("Invalid process ID number for target namespaces.") << endl;
return 1;
}
break;
case LONG_OPT_MONITOR:
monitor = true;
if (optarg)
{
monitor_interval = (int) strtoul(optarg, &num_endptr, 10);
if (*num_endptr != '\0' || monitor_interval < 1)
{
cerr << _("Invalid monitor interval.") << endl;
return 1;
}
}
break;
case LONG_OPT_NO_GLOBAL_VAR_DISPLAY:
no_global_var_display = true;
break;
case LONG_OPT_LANGUAGE_SERVER:
language_server_mode = true;
break;
case LONG_OPT_BUILD_AS:
if (optarg)
{
build_as = optarg;
struct passwd *pwd;
if ((pwd = getpwnam(build_as.c_str())) == NULL)
{
cerr << _F("ERROR: Failed converting userid \"%s\" to userid. Terminating.", build_as.c_str()) << endl;
return 1;
}
build_as_uid = pwd->pw_uid;
build_as_gid = pwd->pw_gid;
}
else
build_as = "";
break;
case '?':
// Invalid/unrecognized option given or argument required, but
// not given. In both cases getopt_long() will have printed the
// appropriate error message to stderr already.
usage(1);
break;
default:
// NOTREACHED unless one added a getopt option but not a corresponding case:
cerr << _F("Unhandled argument code %d", (char)grc) << endl;
return 1;
break;
}
}
// add the -c CMD / -x PID into the unwindsyms list as if -d ... were given
try {
if (cmd != "" || target_pid != 0)
additional_unwindsym_modules.insert(resolve_path(find_executable(cmd_file(),
sysroot, sysenv)));
} catch (...) { }
for (std::set<std::string>::iterator it = additional_unwindsym_modules.begin();
it != additional_unwindsym_modules.end();
it++)
{
if (is_user_module(*it))
{
unwindsym_modules.insert (resolve_path(sysroot + *it));
}
else
{
unwindsym_modules.insert (*it);
}
}
if (! kernel_release_value.empty())
{
setup_kernel_release(kernel_release_value);
}
else if (! sysroot.empty())
{
kernel_build_tree = sysroot + "/lib/modules/" + kernel_release + "/build";
}
return 0;
}
bool
systemtap_session::parse_cmdline_runtime (const string& opt_runtime)
{
if (opt_runtime == string("kernel"))
runtime_mode = kernel_runtime;
else if (opt_runtime == string("bpf"))
{
#ifndef HAVE_BPF_DECLS
cerr << _("ERROR: --runtime=bpf unavailable; this build lacks BPF feature") << endl;
version();
return false;
#else
runtime_mode = bpf_runtime;
// TODO: From early BPF development. Remove after making sure the
// cache doesn't break anything. Currently removal is blocked
// by PR22330 (module name encoded in trace_printk() calls,
// using up a lot of stack space for the cacheable script
// names).
use_cache = use_script_cache = false;
#endif
}
else if (opt_runtime == string("dyninst"))
{
#ifndef HAVE_DYNINST
cerr << _("ERROR: --runtime=dyninst unavailable; this build lacks DYNINST feature") << endl;
version();
return false;
#else
if (privilege_set && pr_unprivileged != privilege)
{
cerr << _("ERROR: --runtime=dyninst implies unprivileged mode only") << endl;
return false;
}
privilege = pr_unprivileged;
privilege_set = true;
runtime_mode = dyninst_runtime;
#endif
}
else
{
cerr << _F("ERROR: %s is an invalid argument for --runtime", opt_runtime.c_str()) << endl;
return false;
}
return true;
}
void
systemtap_session::check_options (int argc, char * const argv [])
{
for (int i = optind; i < argc; i++)
{
if (! have_script && ! dump_mode)
{
script_file = string (argv[i]);
have_script = true;
}
else
args.push_back (string (argv[i]));
}
// We don't need a script with --list-servers, --trust-servers, or any dump mode, or a lang-server
bool need_script = server_status_strings.empty () &&
server_trust_spec.empty () &&
!dump_mode && !interactive_mode && !language_server_mode;
if (benchmark_sdt_loops > 0 || benchmark_sdt_threads > 0)
{
// Secret benchmarking options are for local use only, not servers or --remote
if (client_options || !remote_uris.empty())
{
cerr << _("Benchmark options are only for local use.") << endl;
usage(1);
}
// Fill defaults if either is unset.
if (benchmark_sdt_loops == 0)
benchmark_sdt_loops = 10000000;
if (benchmark_sdt_threads == 0)
benchmark_sdt_threads = 1;
need_script = false;
}
// need a user file
// NB: this is also triggered if stap is invoked with no arguments at all
if (need_script && ! have_script)
{
cerr << _("A script must be specified.") << endl;
cerr << _("Try '-i' for building a script interactively.") << endl;
usage(1);
}
if (dump_mode && have_script)
{
cerr << _("Cannot specify a script with -l/-L/--dump-* switches.") << endl;
usage(1);
}
if (dump_mode && last_pass != 5)
{
cerr << _("Cannot specify -p with -l/-L/--dump-* switches.") << endl;
usage(1);
}
if (dump_mode && interactive_mode)
{
cerr << _("Cannot specify -i with -l/-L/--dump-* switches.") << endl;
usage(1);
}
if (dump_mode && language_server_mode)
{
cerr << _("Cannot specify --language-server with -l/-L/--dump-* switches.") << endl;
usage(1);
}
if (dump_mode && monitor)
{
cerr << _("Cannot specify --monitor with -l/-L/--dump-* switches.") << endl;
usage(1);
}
// FIXME: we need to think through other options that shouldn't be
// used with '-i' and '--language-server'.
// ignore any -E bits in list modes; their presence could flip the
// process result code even if list results are empty
if (dump_mode)
additional_scripts.clear();
#if ! HAVE_NSS
if (client_options)
print_warning("--client-options is not supported by this version of systemtap");
if (! server_status_strings.empty ())
{
print_warning("--list-servers is not supported by this version of systemtap");
server_status_strings.clear ();
}
if (! server_trust_spec.empty ())
{
print_warning("--trust-servers is not supported by this version of systemtap");
server_trust_spec.clear ();
}
#endif
#if ! HAVE_MONITOR_LIBS
if (monitor)
{
print_warning("Monitor mode is not supported by this version of systemtap");
exit(1);
}
#endif
#if ! HAVE_JSON_C || ! HAVE_LANGUAGE_SERVER_SUPPORT
if (language_server_mode)
{
print_warning("Language server mode is not supported by this version of systemtap");
exit(1);
}
#endif
if (runtime_specified && ! specified_servers.empty ())
{
print_warning("Ignoring --use-server due to the use of -R");
specified_servers.clear ();
}
if (client_options && last_pass > 4)
{
last_pass = 4; /* Quietly downgrade. Server passed through -p5 naively. */
}
// If phase 5 has been requested, automatically adjust the --privilege setting to match the
// user's actual privilege level and add --use-server, if necessary.
// Do this only if we have a script and we are not the server.
// Also do this only if we're running in the kernel (e.g. not --runtime=dyninst)
// XXX Eventually we could check remote hosts, but disable that case for now.
if (last_pass > 4 && have_script && ! client_options &&
runtime_mode == kernel_runtime && remote_uris.empty())
{
// What is the user's privilege level?
privilege_t credentials = get_privilege_credentials ();
// Don't alter specifically-requested privilege levels
if (! privilege_set && ! pr_contains (credentials, privilege))
{
// We do not have the default privilege credentials (stapdev). Lower
// the privilege level to match our credentials.
if (pr_contains (credentials, pr_stapsys))
{
privilege = pr_stapsys;
server_args.push_back ("--privilege=stapsys");
auto_privilege_level_msg =
_("--privilege=stapsys was automatically selected because you are a member "
"of the groups stapusr and stapsys. [man stap]");
}
else if (pr_contains (credentials, pr_stapusr))
{
privilege = pr_stapusr;
server_args.push_back ("--privilege=stapusr");
auto_privilege_level_msg =
_("--privilege=stapusr was automatically selected because you are a member "
"of the group stapusr. [man stap]");
}
else
{
// Completely unprivileged user.
cerr << _("You are trying to run systemtap as a normal user.\n"
"You should either be root, or be part of "
"the group \"stapusr\" and possibly one of the groups "
"\"stapsys\" or \"stapdev\". [man stap]\n");
#if HAVE_DYNINST
cerr << _("Alternatively, you may specify --runtime=dyninst for userspace probing.\n");
#endif
usage (1); // does not return.
}
}
// Add --use-server if not already specified and the user's (lack of) credentials require
// it for pass 5.
if (! pr_contains (credentials, pr_stapdev))
{
enable_auto_server (
_F("For users with the privilege level %s, the module created by compiling your "
"script must be signed by a trusted systemtap compile-server. [man stap-server]",
pr_name (credentials)));
}
}
if (client_options && ! pr_contains (privilege, pr_stapdev) && ! client_options_disallowed_for_unprivileged.empty ())
{
cerr << _F("You can't specify %s when --privilege=%s is specified.",
client_options_disallowed_for_unprivileged.c_str(),
pr_name (privilege))
<< endl;
usage (1);
}
if ((cmd != "") && (target_pid))
{
cerr << _F("You can't specify %s and %s together.", "-c", "-x") << endl;
usage (1);
}
// NB: In user-mode runtimes (dyninst), we can allow guru mode any time, but we
// need to restrict guru by privilege level in the kernel runtime.
if (! runtime_usermode_p () && ! pr_contains (privilege, pr_stapdev) && guru_mode)
{
cerr << _F("You can't specify %s and --privilege=%s together.", "-g", pr_name (privilege))
<< endl;
usage (1);
}
// Can't use --remote and --tmpdir together because with --remote,
// there may be more than one tmpdir needed.
if (!remote_uris.empty() && tmpdir_opt_set)
{
cerr << _F("You can't specify %s and %s together.", "--remote", "--tmpdir") << endl;
usage(1);
}
// Warn in case the target kernel release doesn't match the running one.
native_build = (release == kernel_release &&
machine == architecture); // NB: squashed ARCH by PR4186 logic
// Non-native builds can't be loaded locally, but may still work on remotes
if (last_pass > 4 && !native_build && remote_uris.empty())
{
print_warning("kernel release/architecture mismatch with host forces last-pass 4.");
last_pass = 4;
}
if(download_dbinfo != 0 && access ("/usr/bin/abrt-action-install-debuginfo-to-abrt-cache", X_OK) < 0
&& access ("/usr/libexec/abrt-action-install-debuginfo-to-abrt-cache", X_OK) < 0)
{
print_warning("abrt-action-install-debuginfo-to-abrt-cache is not installed. Continuing without downloading debuginfo.");
download_dbinfo = 0;
}
// translate path of runtime to absolute path
if (runtime_path[0] != '/')
{
char cwd[PATH_MAX];
if (getcwd(cwd, sizeof(cwd)))
{
runtime_path = string(cwd) + "/" + runtime_path;
}
}
// Abnormal characters in our temp path can break us, including parts out
// of our control like Kbuild. Let's enforce nice, safe characters only.
const char *tmpdir = getenv("TMPDIR");
if (tmpdir != NULL)
assert_regexp_match("TMPDIR", tmpdir, "^[-/._0-9a-z]+$");
// If the kernel is using signed modules, we need to enforce server
// use.
if (!client_options && modules_must_be_signed())
{
if (verbose > 1)
clog << _("This host requires module signing.") << endl;
// Force server use to be on, if not on already.
if (! module_sign_given)
enable_auto_server (
_("The kernel on your system requires modules to be signed for loading.\n"
"The module created by compiling your script must be signed by a systemtap "
"compile-server. [man stap-server]"));
// Cache the current system's machine owner key (MOK)
// information, to pass over to the server.
get_mok_info();
// If the mok_fingerprints are empty ... we don't have one enrolled,
// but would like to find a server - any server - and ask for one.
// Enroll a magic string. PR26665
if (mok_fingerprints.size() == 0)
mok_fingerprints.push_back("missing");
// see also: nss-server-info.cxx nss_get_or_keep_compatible_server_info()
}
}
int
systemtap_session::parse_kernel_config ()
{
// PR10702: pull config options
string kernel_config_file = kernel_build_tree + "/.config";
struct stat st;
int rc = stat(kernel_config_file.c_str(), &st);
if (rc != 0)
{
clog << _F("Checking \"%s\" failed with error: %s",
kernel_config_file.c_str(), strerror(errno)) << endl;
find_devel_rpms(*this, kernel_build_tree.c_str());
// Enable warnings, so that the rpm-installation help is sent
// out. The above message is going to go to stderr anyway
// in the case of stap -L without a necessary -devel available.
// Might as well make the text more helpful.
this->suppress_warnings = false;
missing_rpm_list_print(*this, "-devel");
return rc;
}
ifstream kcf (kernel_config_file.c_str());
string line;
while (getline (kcf, line))
{
if (!startswith(line, "CONFIG_")) continue;
size_t off = line.find('=');
if (off == string::npos) continue;
string key = line.substr(0, off);
string value = line.substr(off+1, string::npos);
kernel_config[key] = value;
}
if (verbose > 2)
clog << _F("Parsed kernel \"%s\", ", kernel_config_file.c_str())
<< _NF("containing %zu tuple", "containing %zu tuples",
kernel_config.size(), kernel_config.size()) << endl;
kcf.close();
return 0;
}
int
systemtap_session::parse_kernel_exports ()
{
string kernel_exports_file = kernel_build_tree + "/Module.symvers";
struct stat st;
int rc = stat(kernel_exports_file.c_str(), &st);
if (rc != 0)
{
clog << _F("Checking \"%s\" failed with error: %s\nEnsure kernel development headers & makefiles are installed",
kernel_exports_file.c_str(), strerror(errno)) << endl;
return rc;
}
ifstream kef (kernel_exports_file.c_str());
string line;
while (getline (kef, line))
{
vector<string> tokens;
tokenize (line, tokens, "\t");
if (tokens.size() == 4 &&
tokens[2] == "vmlinux" &&
tokens[3].substr(0,13) == string("EXPORT_SYMBOL"))
kernel_exports.insert (tokens[1]);
}
if (verbose > 2)
clog << _NF("Parsed kernel \"%s\", containing one vmlinux export",
"Parsed kernel \"%s\", containing %zu vmlinux exports",
kernel_exports.size(), kernel_exports_file.c_str(),
kernel_exports.size()) << endl;
kef.close();
return 0;
}
int
systemtap_session::parse_kernel_functions ()
{
string system_map_path = "/usr/lib/debug/boot/System.map-" + kernel_release;
ifstream system_map;
system_map.open(system_map_path.c_str(), ifstream::in);
if (! system_map.is_open())
{
if (verbose > 1)
clog << _F("Kernel symbol table %s unavailable, (%s)",
system_map_path.c_str(), strerror(errno)) << endl;
system_map_path = sysroot + "/boot/System.map-" + kernel_release;
system_map.clear();
system_map.open(system_map_path.c_str(), ifstream::in);
if (! system_map.is_open())
{
if (verbose > 1)
clog << _F("Kernel symbol table %s unavailable, (%s)",
system_map_path.c_str(), strerror(errno)) << endl;
}
}
while (system_map.good())
{
assert_no_interrupts();
string address, type, name;
system_map >> address >> type >> name;
if (verbose > 5)
clog << "'" << address << "' '" << type << "' '" << name
<< "'" << endl;
// 'T'/'t' are text code symbols
if (type != "t" && type != "T")
continue;
#ifdef __powerpc__ // XXX cross-compiling hazard
// Map ".sys_foo" to "sys_foo".
if (name[0] == '.')
name.erase(0, 1);
#endif
// FIXME: better things to do here - look for _stext before
// remembering symbols. Also:
// - stop remembering names at ???
// - what about __kprobes_text_start/__kprobes_text_end?
kernel_functions.insert(name);
}
system_map.close();
if (kernel_functions.size() == 0)
print_warning ("Kernel function symbol table missing [man warning::symbols]", 0);
if (verbose > 2)
clog << _F("Parsed kernel \"%s\", ", system_map_path.c_str())
<< _NF("containing %zu symbol", "containing %zu symbols",
kernel_functions.size(), kernel_functions.size()) << endl;
return 0;
}
string
systemtap_session::cmd_file ()
{
wordexp_t words;
string file;
if (target_pid && cmd == "")
{
// check that the target_pid corresponds to a running process
string err_msg;
if(!is_valid_pid (target_pid, err_msg))
throw SEMANTIC_ERROR(err_msg);
file = string("/proc/") + lex_cast(target_pid) + "/exe";
}
else // default is to assume -c flag was given
{
int rc = wordexp (cmd.c_str (), &words, WRDE_NOCMD|WRDE_UNDEF);
if(rc == 0)
{
if (words.we_wordc > 0)
file = words.we_wordv[0];
wordfree (& words);
}
else
{
switch (rc)
{
case WRDE_BADCHAR:
throw SEMANTIC_ERROR(_("command contains illegal characters"));
case WRDE_BADVAL:
throw SEMANTIC_ERROR(_("command contains undefined shell variables"));
case WRDE_CMDSUB:
throw SEMANTIC_ERROR(_("command contains command substitutions"));
case WRDE_NOSPACE:
throw SEMANTIC_ERROR(_("out of memory"));
case WRDE_SYNTAX:
throw SEMANTIC_ERROR(_("command contains shell syntax errors"));
default:
throw SEMANTIC_ERROR(_("unspecified wordexp failure"));
}
}
}
return file;
}
void
systemtap_session::init_try_server ()
{
#if HAVE_NSS
// If the option is disabled or we are a server or we are already using a
// server, then never retry compilation using a server.
if (! use_server_on_error || client_options || ! specified_servers.empty ())
try_server_status = dont_try_server;
else
try_server_status = try_server_unset;
#else
// No client, so don't bother.
try_server_status = dont_try_server;
#endif
}
void
systemtap_session::set_try_server (int t)
{
if (try_server_status != dont_try_server)
try_server_status = t;
}
void systemtap_session::insert_loaded_modules()
{
char line[1024];
ifstream procmods ("/proc/modules");
while (procmods.good()) {
procmods.getline (line, sizeof(line));
strtok(line, " \t");
if (line[0] == '\0')
break; // maybe print a warning?
unwindsym_modules.insert (string (line));
}
procmods.close();
unwindsym_modules.insert ("kernel");
}
void
systemtap_session::setup_kernel_release (const string& kstr)
{
// Sometimes we may get dupes here... e.g. a server may have a full
// -r /path/to/kernel followed by a client's -r kernel.
if (kernel_release == kstr)
return; // nothing new here...
kernel_release = kernel_build_tree = kernel_source_tree = "";
if (kstr[0] == '/') // fully specified path
{
kernel_build_tree = kstr;
kernel_release = kernel_release_from_build_tree (kernel_build_tree, verbose);
// PR10745
// Maybe it's a full kernel source tree, for purposes of PR10745.
// In case CONFIG_DEBUG_INFO was set, we'd find it anyway with the
// normal search in tapsets.cxx. Without CONFIG_DEBUG_INFO, we'd
// need heuristics such as this one:
string some_random_source_only_file = kernel_build_tree + "/COPYING";
ifstream epic (some_random_source_only_file.c_str());
if (! epic.fail())
{
kernel_source_tree = kernel_build_tree;
if (verbose > 2)
clog << _F("Located kernel source tree (COPYING) at '%s'", kernel_source_tree.c_str()) << endl;
}
}
else
{
update_release_sysroot = true;
kernel_release = kstr;
if (!kernel_release.empty())
kernel_build_tree = "/lib/modules/" + kernel_release + "/build";
// PR10745
// Let's not look for the kernel_source_tree; it's definitely
// not THERE. tapsets.cxx might try to find it later if tracepoints
// need it.
}
}
// Register all the aliases we've seen in library files, and the user
// file, as patterns.
void
systemtap_session::register_library_aliases()
{
vector<stapfile*> files(library_files);
files.insert(files.end(), user_files.begin(), user_files.end());
for (unsigned f = 0; f < files.size(); ++f)
{
stapfile * file = files[f];
for (unsigned a = 0; a < file->aliases.size(); ++a)
{
probe_alias * alias = file->aliases[a];
try
{
for (unsigned n = 0; n < alias->alias_names.size(); ++n)
{
probe_point * name = alias->alias_names[n];
match_node * mn = pattern_root;
for (unsigned c = 0; c < name->components.size(); ++c)
{
probe_point::component * comp = name->components[c];
// XXX: alias parameters
if (comp->arg)
throw SEMANTIC_ERROR(_F("alias component %s contains illegal parameter",
comp->functor.to_string().c_str()));
mn = mn->bind(comp->functor);
}
// PR 12916: All probe aliases are OK for all users. The actual
// referenced probe points will be checked when the alias is resolved.
mn->bind_privilege (pr_all);
mn->bind(new alias_expansion_builder(alias));
}
}
catch (const semantic_error& e)
{
semantic_error er(ERR_SRC, _("while registering probe alias"),
alias->tok, NULL, &e);
print_error (er);
}
}
}
}
// The name of the primary stap file, if any -- usually user_files[0]->name:
string
systemtap_session::script_name()
{
if (user_files.empty())
return "<unknown>";
return user_files[0]->name;
}
// The basename of the primary stap file, if any:
string
systemtap_session::script_basename()
{
if (user_files.empty())
return "<unknown>";
return user_files[0]->name.substr(user_files[0]->name.rfind('/')+1); // basename
}
// Print this given token, but abbreviate it if the last one had the
// same file name.
void
systemtap_session::print_token (ostream& o, const token* tok)
{
assert (tok);
if (last_token && last_token->location.file == tok->location.file)
{
stringstream tmpo;
tmpo << *tok;
string ts = tmpo.str();
// search & replace the file name with nothing
size_t idx = ts.find (tok->location.file->name);
if (idx != string::npos) {
ts.erase(idx, tok->location.file->name.size()); // remove path
if (color_errors) {
string src = ts.substr(idx); // keep line & col
ts.erase(idx); // remove from output string
ts += colorize(src, "source"); // re-add it colorized
}
}
o << ts;
}
else
o << colorize(tok);
last_token = tok;
}
void
systemtap_session::print_error (const semantic_error& se)
{
// skip error message printing for listing mode with low verbosity
if (this->dump_mode && this->verbose <= 1)
{
seen_errors[se.errsrc_chain()]++; // increment num_errors()
return;
}
// duplicate elimination
if (verbose > 0 || seen_errors[se.errsrc_chain()] < 1)
{
seen_errors[se.errsrc_chain()]++;
cerr << build_error_msg(se);
for (const semantic_error *e = &se; e != NULL; e = e->get_chain())
if (verbose > 1 || seen_errors[e->errsrc_chain()] < 1) // dupe-eliminate chained errors too
{
seen_errors[e->errsrc_chain()]++;
cerr << build_error_msg(*e);
}
}
else suppressed_errors++;
}
string
systemtap_session::build_error_msg (const semantic_error& e)
{
stringstream message;
string align_semantic_error (" ");
message << colorize(_("semantic error:"), "error") << ' ' << e.what ();
if (e.tok1 || e.tok2)
message << ": ";
else
{
print_error_details (message, align_semantic_error, e);
message << endl;
if (verbose > 1) // no tokens to print, so print any errsrc right there
message << _(" thrown from: ") << e.errsrc;
}
if (e.tok1)
{
print_token (message, e.tok1);
print_error_details (message, align_semantic_error, e);
message << endl;
if (verbose > 1)
message << _(" thrown from: ") << e.errsrc << endl;
print_error_source (message, align_semantic_error, e.tok1);
}
if (e.tok2)
{
print_token (message, e.tok2);
message << endl;
print_error_source (message, align_semantic_error, e.tok2);
}
message << endl;
return message.str();
}
void
systemtap_session::print_error_source (std::ostream& message,
std::string& align, const token* tok)
{
unsigned i = 0;
assert (tok);
if (!tok->location.file)
//No source to print, silently exit
return;
unsigned line = tok->location.line;
unsigned col = tok->location.column;
interned_string file_contents = tok->location.file->file_contents;
size_t start_pos = 0, end_pos = 0;
//Navigate to the appropriate line
while (i != line && end_pos != std::string::npos)
{
start_pos = end_pos;
end_pos = file_contents.find ('\n', start_pos) + 1;
i++;
}
//TRANSLATORS: Here we are printing the source string of the error
message << align << _("source: ");
interned_string srcline = file_contents.substr(start_pos, end_pos-start_pos-1);
if (color_errors) {
// before token:
message << srcline.substr(0, col-1);
// token:
// after token:
// ... hold it - the token might have been synthetic,
// or expanded from a $@ command line argument, or ...
// so tok->content may have nothing in common with the
// contents of srcline at the same point.
interned_string srcline_rest = srcline.substr(col-1);
interned_string srcline_tokenish = srcline_rest.substr(0, tok->content.size());
if (srcline_tokenish == tok->content) { // oh good
message << colorize(tok->content, "token");
message << srcline_rest.substr(tok->content.size());
message << endl;
}
else { // oh bad
message << " ... ";
col += 5; // line up with the caret
message << colorize(tok->content, "token");
message << " ... " << srcline_rest;
message << endl;
}
} else
message << srcline << endl;
message << align << " ";
//Navigate to the appropriate column
for (i=start_pos; i<start_pos+col-1; i++)
{
if(isspace(file_contents[i]))
message << file_contents[i];
else
message << ' ';
}
message << colorize("^", "caret") << endl;
// print chained macro invocations and synthesized code
if (tok->chain)
{
if (tok->location.file->synthetic)
message << _("\tin synthesized code from: ");
else
message << _("\tin expansion of macro: ");
message << colorize(tok->chain) << endl;
print_error_source (message, align, tok->chain);
}
}
void
systemtap_session::print_error_details (std::ostream& message,
std::string& align,
const semantic_error& e)
{
for (size_t i = 0; i < e.details.size(); ++i)
message << endl << align << e.details[i];
}
void
systemtap_session::print_warning (const string& message_str, const token* tok)
{
// Only output in dump mode if -vv is supplied:
if (suppress_warnings && (!dump_mode || verbose <= 1))
return; // NB: don't count towards suppressed_warnings count
// Duplicate elimination
string align_warning (" ");
if (verbose > 0 || seen_warnings.find (message_str) == seen_warnings.end())
{
seen_warnings.insert (message_str);
clog << colorize(_("WARNING:"), "warning") << ' ' << message_str;
if (tok) { clog << ": "; print_token (clog, tok); }
clog << endl;
if (tok) { print_error_source (clog, align_warning, tok); }
}
else suppressed_warnings++;
}
void
systemtap_session::print_error (const parse_error &pe,
const token* tok,
const std::string &input_name,
bool is_warningerr)
{
// duplicate elimination
if (verbose > 0 || seen_errors[pe.errsrc_chain()] < 1)
{
// Sometimes, we need to print parse errors that should not be considered
// critical. For example, when we parse tapsets and macros. In those
// cases, is_warningerr is true, and we cancel out the increase in
// seen_errors.size() by also increasing warningerr_count, so that the
// net num_errors() value is unchanged.
seen_errors[pe.errsrc_chain()]++; // can be simplified if we
if (seen_errors[pe.errsrc_chain()] == 1 && is_warningerr) // change map to a set (and
warningerr_count++; // settle on threshold of 1)
cerr << build_error_msg(pe, tok, input_name);
for (const parse_error *e = pe.chain; e != NULL; e = e->chain)
cerr << build_error_msg(*e, e->tok, input_name);
}
else suppressed_errors++;
}
string
systemtap_session::build_error_msg (const parse_error& pe,
const token* tok,
const std::string &input_name)
{
stringstream message;
string align_parse_error (" ");
// print either pe.what() or a deferred error from the lexer
bool found_junk = false;
if (tok && tok->type == tok_junk && tok->junk_type != tok_junk_unknown)
{
found_junk = true;
message << colorize(_("parse error:"), "error") << ' '
<< tok->junk_message(*this) << endl;
}
else
{
message << colorize(_("parse error:"), "error") << ' ' << pe.what() << endl;
}
// NB: It makes sense for lexer errors to always override parser
// errors, since the original obvious scheme was for the lexer to
// throw an exception before the token reached the parser.
if (pe.tok || found_junk)
{
message << align_parse_error << _(" at: ") << colorize(tok) << endl;
print_error_source (message, align_parse_error, tok);
}
else if (tok) // "expected" type error
{
message << align_parse_error << _(" saw: ") << colorize(tok) << endl;
print_error_source (message, align_parse_error, tok);
}
else
{
message << align_parse_error << _(" saw: ") << input_name << " EOF" << endl;
}
message << endl;
return message.str();
}
void
systemtap_session::report_suppression()
{
if (this->suppressed_errors > 0)
cerr << colorize(_F("Number of similar error messages suppressed: %d.",
this->suppressed_errors),
"error") << endl;
if (this->suppressed_warnings > 0)
cerr << colorize(_F("Number of similar warning messages suppressed: %d.",
this->suppressed_warnings),
"warning") << endl;
if (this->suppressed_errors > 0 || this->suppressed_warnings > 0)
cerr << "Rerun with -v to see them." << endl;
}
void
systemtap_session::create_tmp_dir()
{
if (!tmpdir.empty())
return;
if (tmpdir_opt_set)
return;
// Create the temp directory
const char * tmpdir_env = getenv("TMPDIR");
if (!tmpdir_env)
tmpdir_env = "/tmp";
string stapdir = "/stapXXXXXX";
string tmpdirt = tmpdir_env + stapdir;
const char *tmpdir_name = mkdtemp((char *)tmpdirt.c_str());
if (! tmpdir_name)
{
const char* e = strerror(errno);
//TRANSLATORS: we can't make the directory due to the error
throw runtime_error(_F("cannot create temporary directory (\" %s \"): %s", tmpdirt.c_str(), e));
}
//else
tmpdir = tmpdir_name;
if ((getuid() == 0) && (build_as != ""))
if(chown(tmpdirt.c_str(), build_as_uid, build_as_gid) != 0)
{
cout << "ERROR: Failed to chown. Terminating." << endl;
exit(1);
}
}
void
systemtap_session::remove_tmp_dir()
{
if(tmpdir.empty())
return;
// Remove temporary directory
if (keep_tmpdir && !tmpdir_opt_set)
clog << _F("Keeping temporary directory \"%s\"", tmpdir.c_str()) << endl;
else if (!tmpdir_opt_set)
{
// Mask signals while we're deleting the temporary directory.
stap_sigmasker masked;
// Remove the temporary directory.
vector<string> cleanupcmd { "rm", "-rf", tmpdir };
(void) stap_system(verbose, cleanupcmd);
if (verbose>1)
clog << _F("Removed temporary directory \"%s\"", tmpdir.c_str()) << endl;
tmpdir.clear();
}
}
void
systemtap_session::reset_tmp_dir()
{
remove_tmp_dir();
create_tmp_dir();
}
translator_output* systemtap_session::op_create_auxiliary(bool trailer_p)
{
static int counter = 0;
string tmpname = this->tmpdir + "/" + this->module_name + "_aux_" + lex_cast(counter++) + ".c";
translator_output* n = new translator_output (tmpname);
n->trailer_p = trailer_p;
auxiliary_outputs.push_back (n);
return n;
}
// Wrapper for checking if there are pending interrupts
void
assert_no_interrupts()
{
if (pending_interrupts)
throw interrupt_exception();
}
std::string
systemtap_session::colorize(const std::string& str, const std::string& type)
{
if (str.empty() || !color_errors)
return str;
else {
// Check if this type is defined in SYSTEMTAP_COLORS
std::string color = parse_stap_color(type);
if (!color.empty()) // no need to pollute terminal if not necessary
return "\033[" + color + "m\033[K" + str + "\033[m\033[K";
else
return str;
}
}
// Colorizes the path:row:col part of the token
std::string
systemtap_session::colorize(const token* tok)
{
if (tok == NULL)
return "";
stringstream tmp;
tmp << *tok;
if (!color_errors)
return tmp.str(); // Might as well stop now to save time
else {
string ts = tmp.str();
// Print token location, which is also the tail of ts
stringstream loc;
loc << tok->location;
// Remove token location and re-add it colorized
ts.erase(ts.size()-loc.str().size());
return ts + colorize(loc.str(), "source");
}
}
/* Parse SYSTEMTAP_COLORS and returns the SGR parameter(s) for the given
type. The env var SYSTEMTAP_COLORS must be in the following format:
'key1=val1:key2=val2:' etc... where valid keys are 'error', 'warning',
'source', 'caret', 'token' and valid values constitute SGR parameter(s).
For example, the default setting would be:
'error=01;31:warning=00;33:source=00;34:caret=01:token=01'
*/
std::string
systemtap_session::parse_stap_color(const std::string& type)
{
const char *key, *col, *eq;
int n = type.size();
int done = 0;
key = getenv("SYSTEMTAP_COLORS");
if (key == NULL)
key = "error=01;31:warning=00;33:source=00;34:caret=01:token=01";
else if (*key == '\0')
return ""; // disable colors if set but empty
while (!done) {
if (!(col = strchr(key, ':'))) {
col = strchr(key, '\0');
done = 1;
}
if (!((eq = strchr(key, '=')) && eq < col))
return ""; /* invalid syntax: no = in range */
if (!(key < eq && eq < col-1))
return ""; /* invalid syntax: key or val empty */
if (strspn(eq+1, "0123456789;") < (size_t)(col-eq-1))
return ""; /* invalid syntax: invalid char in val */
if (eq-key == n && type.compare(0, n, key, n) == 0)
return string(eq+1, col-eq-1);
if (!done) key = col+1; /* advance to next key */
}
// Could not find the key
return "";
}
/*
* Returns true if this system requires modules to have signatures
* (typically on a secure boot system), false otherwise.
*
* This routine parses /sys/module/module/parameters/sig_enforce to
* figure out if signatures are enforced on modules. Note that if the
* file doesn't exist, we don't really care and return false.
*
* On certain kernels (RHEL7), we also have to check
* /sys/kernel/security/securelevel.
*
* On certain kernels (Fedora28+), efi-lockdown may be in effect, but
* we lack a way of telling. RHBZ1638874. So check an environment
* variable "SYSTEMTAP_SIGN" instead for now.
*/
bool
systemtap_session::modules_must_be_signed()
{
ifstream statm("/sys/module/module/parameters/sig_enforce");
ifstream securelevel("/sys/kernel/security/securelevel");
ifstream lockdown("/sys/kernel/security/lockdown");
char status = 'N';
if (getenv("SYSTEMTAP_SIGN"))
return true;
if (getenv("SYSTEMTAP_NOSIGN"))
return false;
statm >> status;
if (status == 'Y')
return true;
securelevel >> status;
if (status == '1')
return true;
string keyword;
while(lockdown.good()) {
lockdown >> keyword;
if (keyword == "[integrity]" ||
keyword == "[confidentiality]") // eek
return true;
}
return false;
}
/*
* Get information on the list of enrolled machine owner keys (MOKs) on
* this system.
*/
void
systemtap_session::get_mok_info()
{
int rc;
stringstream out;
// FIXME: In theory, we should be able to read /sys files and use
// some of the guts of read_cert_info_from_file() to get the
// fingerprints. This would rid us of our mokutil
// dependency. However, we'd need to copy/duplicate efilib.c from
// mokutil source to be able to decipher the efi data.
vector<string> cmd { "mokutil", "--list-enrolled" };
rc = stap_system_read(verbose, cmd, out);
if (rc != 0)
// If we're here, we know the client requires module signing, but
// we can't get the list of MOKs. Quit.
throw runtime_error(_F("Failed to get list of machine owner keys (MOK) for module signing: rc %d", rc));
string state = "SHA1";
string line, fingerprint;
while (! out.eof())
{
vector<string> matches;
// Get a line of the output, then try to find the fingerprint in
// the line.
// PR26665: but only Systemtap MOK keys; there may be others.
getline(out, line);
if (verbose > 3)
clog << "MOK parse state: " << state << " line: " << line << endl;
if (state == "SHA1") { // look for a new key fingerprint
if (! regexp_match(line, "^SHA1 Fingerprint: ([0-9a-f:]+)$", matches))
{
// matches[0] is the entire line, matches[1] is the first
// submatch, in this case the actual fingerprint
fingerprint = matches[1];
if (verbose > 2)
clog << "MOK fingerprint found: " << fingerprint << endl;
state = "Issuer";
}
// else stay in SHA1 state
} else if (state == "Issuer") { // validate issuer
if (! regexp_match(line, "^[ \t]*Issuer: [A-Z]*=(.*)$", matches)) {
if (verbose > 2)
clog << "Issuer found: " << matches[1] << endl;
if (! regexp_match(matches[1], "Systemtap", matches)) {
if (verbose > 2)
clog << "Recognized Systemtap MOK fingerprint: " << fingerprint << endl;
mok_fingerprints.push_back(fingerprint);
}
state = "SHA1"; // start looking for another key
}
} else { // some other line in mokutil output ... there are plenty
; // carry on searching
}
}
if (verbose > 2)
clog << "Number of enrolled Systemtap MOK keys found: " << mok_fingerprints.size() << endl;
}
void
systemtap_session::enable_auto_server (const string &message)
{
// There may be more than one reason to enable auto server mode, so we may be called
// more than once. Accumulate the messages.
auto_server_msgs.push_back (message);
#if HAVE_NSS
// Enable auto server mode, if not enabled already.
if (specified_servers.empty())
specified_servers.push_back ("");
#else
// Compilation using a server is not supported. exit() after
// the first explanation.
explain_auto_options ();
clog << _("Unable to request compilation by a compile-server\n."
"Without NSS, --use-server is not supported by this version systemtap.") << endl;
exit(1);
#endif
}
void
systemtap_session::explain_auto_options()
{
// Was there an automatic privilege setting?
if (! auto_privilege_level_msg.empty())
clog << auto_privilege_level_msg << endl;
// Was a server was automatically requested? Handle this one after other auto_settings
// which may result in an auto_server setting.
if (! auto_server_msgs.empty())
{
for (vector<string>::iterator i = auto_server_msgs.begin(); i != auto_server_msgs.end(); ++i)
{
clog << *i << endl;
clog << _("--use-server was automatically selected in order to request compilation by "
"a compile-server.") << endl;
}
}
}
bool
systemtap_session::is_user_file (const string &name)
{
// base the check on the name of the user_file
for (vector<stapfile*>::iterator it = user_files.begin(); it != user_files.end(); it++)
if (name == (*it)->name)
return true;
return false; // no match
}
bool
systemtap_session::is_primary_probe (derived_probe *dp)
{
#if 0
// RHBZ1795159: more synthetic probes now exist that are 'primary enough'
// If the probe is synthetically generated, then it's not primary.
if (dp->synthetic)
return false;
#endif
// We check if this probe is from the primary user file by going back to its
// original probe and checking if that probe was found in the primary user
// file.
if (user_files.empty())
return false;
vector<probe*> chain;
dp->collect_derivation_chain (chain);
const source_loc& origin = chain.back()->tok->location;
return origin.file == user_files[0];
}
void
systemtap_session::clear_script_data()
{
delete pattern_root;
pattern_root = new match_node;
// We need to be sure to reset all our error counts, so that an
// error on one script won't be counted against the next script.
seen_warnings.clear();
suppressed_warnings = 0;
seen_errors.clear();
suppressed_errors = 0;
warningerr_count = 0;
}
// --------------------------------------------------------------------------
/*
Perngrq sebz fzvyrlgnc.fit, rkcbegrq gb n 1484k1110 fzvyrlgnc.cat,
gurapr catgbcnz | cazfpnyr -jvqgu 160 |
cczqvgure -qvz 4 -erq 2 -terra 2 -oyhr 2 | cczgbnafv -2k4 | bq -i -j19 -g k1 |
phg -s2- -q' ' | frq -r 'f,^,\\k,' -r 'f, ,\\k,t' -r 'f,^,",' -r 'f,$,",'
*/
const char*
systemtap_session::morehelp =
"\x1b\x5b\x30\x6d\x1b\x5b\x33\x37\x6d\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x60\x20\x20\x2e\x60\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x60\x1b\x5b"
"\x33\x33\x6d\x20\x1b\x5b\x33\x37\x6d\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x1b\x5b\x33\x33\x6d\x20\x60"
"\x2e\x60\x1b\x5b\x33\x37\x6d\x20\x3a\x2c\x3a\x2e\x60\x20\x60\x20\x60\x20\x60"
"\x2c\x3b\x2c\x3a\x20\x1b\x5b\x33\x33\x6d\x60\x2e\x60\x20\x1b\x5b\x33\x37\x6d"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x1b\x5b\x33"
"\x33\x6d\x20\x60\x20\x60\x20\x3a\x27\x60\x1b\x5b\x33\x37\x6d\x20\x60\x60\x60"
"\x20\x20\x20\x60\x20\x60\x60\x60\x20\x1b\x5b\x33\x33\x6d\x60\x3a\x60\x20\x60"
"\x20\x60\x20\x1b\x5b\x33\x37\x6d\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x2e\x1b\x5b\x33\x33\x6d\x60\x2e\x60\x20\x60\x20\x60\x20\x20\x1b\x5b\x33"
"\x37\x6d\x20\x3a\x20\x20\x20\x60\x20\x20\x20\x60\x20\x20\x2e\x1b\x5b\x33\x33"
"\x6d\x60\x20\x60\x2e\x60\x20\x60\x2e\x60\x20\x1b\x5b\x33\x37\x6d\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x2e\x3a\x20\x20"
"\x20\x20\x20\x20\x20\x20\x2e\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x2e\x76\x53\x1b\x5b\x33\x34\x6d\x53\x1b\x5b\x33\x37\x6d\x53\x1b\x5b"
"\x33\x31\x6d\x2b\x1b\x5b\x33\x33\x6d\x60\x20\x60\x20\x60\x20\x20\x20\x20\x1b"
"\x5b\x33\x31\x6d\x3f\x1b\x5b\x33\x30\x6d\x53\x1b\x5b\x33\x33\x6d\x2b\x1b\x5b"
"\x33\x37\x6d\x20\x20\x20\x20\x20\x20\x20\x2e\x1b\x5b\x33\x30\x6d\x24\x1b\x5b"
"\x33\x37\x6d\x3b\x1b\x5b\x33\x31\x6d\x7c\x1b\x5b\x33\x33\x6d\x20\x60\x20\x60"
"\x20\x60\x20\x60\x1b\x5b\x33\x31\x6d\x2c\x1b\x5b\x33\x32\x6d\x53\x1b\x5b\x33"
"\x37\x6d\x53\x53\x3e\x2c\x2e\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x2e"
"\x3b\x27\x20\x20\x20\x20\x20\x20\x20\x20\x20\x60\x3c\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x2e\x2e\x3a\x1b\x5b\x33\x30\x6d\x26\x46\x46\x46\x48\x46\x1b\x5b"
"\x33\x33\x6d\x60\x2e\x60\x20\x60\x20\x60\x20\x60\x1b\x5b\x33\x30\x6d\x4d\x4d"
"\x46\x1b\x5b\x33\x33\x6d\x20\x20\x1b\x5b\x33\x37\x6d\x20\x20\x20\x20\x1b\x5b"
"\x33\x33\x6d\x20\x3a\x1b\x5b\x33\x30\x6d\x4d\x4d\x46\x1b\x5b\x33\x33\x6d\x20"
"\x20\x20\x60\x20\x60\x2e\x60\x1b\x5b\x33\x31\x6d\x3c\x1b\x5b\x33\x30\x6d\x46"
"\x46\x46\x24\x53\x46\x1b\x5b\x33\x37\x6d\x20\x20\x20\x20\x20\x0a\x20\x20\x20"
"\x20\x2e\x3c\x3a\x60\x20\x20\x20\x20\x2e\x3a\x2e\x3a\x2e\x2e\x3b\x27\x20\x20"
"\x20\x20\x20\x20\x2e\x60\x2e\x3a\x60\x60\x3c\x27\x1b\x5b\x33\x31\x6d\x3c\x27"
"\x1b\x5b\x33\x33\x6d\x20\x60\x20\x60\x20\x60\x20\x20\x20\x60\x3c\x1b\x5b\x33"
"\x30\x6d\x26\x1b\x5b\x33\x31\x6d\x3f\x1b\x5b\x33\x33\x6d\x20\x1b\x5b\x33\x37"
"\x6d\x20\x1b\x5b\x33\x33\x6d\x20\x20\x20\x20\x20\x1b\x5b\x33\x37\x6d\x60\x1b"
"\x5b\x33\x30\x6d\x2a\x46\x1b\x5b\x33\x37\x6d\x27\x1b\x5b\x33\x33\x6d\x20\x60"
"\x20\x60\x20\x60\x20\x60\x20\x1b\x5b\x33\x31\x6d\x60\x3a\x1b\x5b\x33\x37\x6d"
"\x27\x3c\x1b\x5b\x33\x30\x6d\x23\x1b\x5b\x33\x37\x6d\x3c\x60\x3a\x20\x20\x20"
"\x0a\x20\x20\x20\x20\x3a\x60\x3a\x60\x20\x20\x20\x60\x3a\x2e\x2e\x2e\x2e\x3c"
"\x3c\x20\x20\x20\x20\x20\x20\x3a\x2e\x60\x3a\x60\x20\x20\x20\x60\x1b\x5b\x33"
"\x33\x6d\x3a\x1b\x5b\x33\x31\x6d\x60\x1b\x5b\x33\x33\x6d\x20\x60\x2e\x60\x20"
"\x60\x20\x60\x20\x60\x20\x60\x1b\x5b\x33\x37\x6d\x20\x20\x1b\x5b\x33\x33\x6d"
"\x20\x60\x20\x20\x20\x60\x1b\x5b\x33\x37\x6d\x20\x60\x20\x60\x1b\x5b\x33\x33"
"\x6d\x20\x60\x2e\x60\x20\x60\x2e\x60\x20\x60\x3a\x1b\x5b\x33\x37\x6d\x20\x20"
"\x20\x60\x3a\x2e\x60\x2e\x20\x0a\x20\x20\x20\x60\x3a\x60\x3a\x60\x20\x20\x20"
"\x20\x20\x60\x60\x60\x60\x20\x3a\x2d\x20\x20\x20\x20\x20\x60\x20\x60\x20\x20"
"\x20\x20\x20\x60\x1b\x5b\x33\x33\x6d\x3a\x60\x2e\x60\x20\x60\x20\x60\x20\x60"
"\x20\x60\x20\x20\x2e\x3b\x1b\x5b\x33\x31\x6d\x76\x1b\x5b\x33\x30\x6d\x24\x24"
"\x24\x1b\x5b\x33\x31\x6d\x2b\x53\x1b\x5b\x33\x33\x6d\x2c\x60\x20\x60\x20\x60"
"\x20\x60\x20\x60\x20\x60\x2e\x1b\x5b\x33\x31\x6d\x60\x1b\x5b\x33\x33\x6d\x3a"
"\x1b\x5b\x33\x37\x6d\x20\x20\x20\x20\x60\x2e\x60\x20\x20\x0a\x20\x20\x20\x60"
"\x3a\x3a\x3a\x3a\x20\x20\x20\x20\x3a\x60\x60\x60\x60\x3a\x53\x20\x20\x20\x20"
"\x20\x20\x3a\x2e\x60\x2e\x20\x20\x20\x20\x20\x1b\x5b\x33\x33\x6d\x3a\x1b\x5b"
"\x33\x31\x6d\x3a\x1b\x5b\x33\x33\x6d\x2e\x60\x2e\x60\x20\x60\x2e\x60\x20\x60"
"\x20\x3a\x1b\x5b\x33\x30\x6d\x24\x46\x46\x48\x46\x46\x46\x46\x46\x1b\x5b\x33"
"\x31\x6d\x53\x1b\x5b\x33\x33\x6d\x2e\x60\x20\x60\x2e\x60\x20\x60\x2e\x60\x2e"
"\x1b\x5b\x33\x31\x6d\x3a\x1b\x5b\x33\x33\x6d\x3a\x1b\x5b\x33\x37\x6d\x20\x20"
"\x20\x2e\x60\x2e\x3a\x20\x20\x0a\x20\x20\x20\x60\x3a\x3a\x3a\x60\x20\x20\x20"
"\x60\x3a\x20\x2e\x20\x3b\x27\x3a\x20\x20\x20\x20\x20\x20\x3a\x2e\x60\x3a\x20"
"\x20\x20\x20\x20\x3a\x1b\x5b\x33\x33\x6d\x3c\x3a\x1b\x5b\x33\x31\x6d\x60\x1b"
"\x5b\x33\x33\x6d\x2e\x60\x20\x60\x20\x60\x20\x60\x2e\x1b\x5b\x33\x30\x6d\x53"
"\x46\x46\x46\x53\x46\x46\x46\x53\x46\x46\x1b\x5b\x33\x33\x6d\x20\x60\x20\x60"
"\x20\x60\x2e\x60\x2e\x60\x3a\x1b\x5b\x33\x31\x6d\x3c\x1b\x5b\x33\x37\x6d\x20"
"\x20\x20\x20\x3a\x60\x3a\x60\x20\x20\x0a\x20\x20\x20\x20\x60\x3c\x3b\x3c\x20"
"\x20\x20\x20\x20\x60\x60\x60\x20\x3a\x3a\x20\x20\x20\x20\x20\x20\x20\x3a\x3a"
"\x2e\x60\x20\x20\x20\x20\x20\x3a\x1b\x5b\x33\x33\x6d\x3b\x1b\x5b\x33\x31\x6d"
"\x3c\x3a\x60\x1b\x5b\x33\x33\x6d\x2e\x60\x2e\x60\x20\x60\x3a\x1b\x5b\x33\x30"
"\x6d\x53\x46\x53\x46\x46\x46\x53\x46\x46\x46\x53\x1b\x5b\x33\x33\x6d\x2e\x60"
"\x20\x60\x2e\x60\x2e\x60\x3a\x1b\x5b\x33\x31\x6d\x3c\x1b\x5b\x33\x33\x6d\x3b"
"\x1b\x5b\x33\x37\x6d\x27\x20\x20\x20\x60\x3a\x3a\x60\x20\x20\x20\x0a\x20\x20"
"\x20\x20\x20\x60\x3b\x3c\x20\x20\x20\x20\x20\x20\x20\x3a\x3b\x60\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x60\x3a\x60\x2e\x20\x20\x20\x20\x20\x3a\x1b\x5b\x33"
"\x33\x6d\x3c\x3b\x1b\x5b\x33\x31\x6d\x3c\x1b\x5b\x33\x33\x6d\x3a\x1b\x5b\x33"
"\x31\x6d\x3a\x1b\x5b\x33\x33\x6d\x2e\x60\x2e\x60\x20\x1b\x5b\x33\x31\x6d\x3a"
"\x1b\x5b\x33\x30\x6d\x46\x53\x46\x53\x46\x53\x46\x53\x46\x1b\x5b\x33\x31\x6d"
"\x3f\x1b\x5b\x33\x33\x6d\x20\x60\x2e\x60\x2e\x3a\x3a\x1b\x5b\x33\x31\x6d\x3c"
"\x1b\x5b\x33\x33\x6d\x3b\x1b\x5b\x33\x31\x6d\x3c\x1b\x5b\x33\x37\x6d\x60\x20"
"\x20\x20\x3a\x3a\x3a\x60\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x53\x3c"
"\x20\x20\x20\x20\x20\x20\x3a\x53\x3a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x60\x3a\x3a\x60\x2e\x20\x20\x20\x20\x60\x3a\x1b\x5b\x33\x31\x6d\x3c\x1b"
"\x5b\x33\x33\x6d\x3b\x1b\x5b\x33\x31\x6d\x3c\x3b\x3c\x1b\x5b\x33\x33\x6d\x3a"
"\x60\x2e\x60\x3c\x1b\x5b\x33\x30\x6d\x53\x46\x53\x24\x53\x46\x53\x24\x1b\x5b"
"\x33\x33\x6d\x60\x3a\x1b\x5b\x33\x31\x6d\x3a\x1b\x5b\x33\x33\x6d\x3a\x1b\x5b"
"\x33\x31\x6d\x3a\x3b\x3c\x1b\x5b\x33\x33\x6d\x3b\x1b\x5b\x33\x31\x6d\x3c\x1b"
"\x5b\x33\x33\x6d\x3a\x1b\x5b\x33\x37\x6d\x60\x20\x20\x2e\x60\x3a\x3a\x60\x20"
"\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x3b\x3c\x2e\x2e\x2c\x2e\x2e\x20"
"\x3a\x3c\x3b\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x60\x3a\x3a\x3a"
"\x60\x20\x20\x20\x20\x20\x60\x3a\x1b\x5b\x33\x33\x6d\x3c\x3b\x1b\x5b\x33\x31"
"\x6d\x3c\x3b\x3c\x1b\x5b\x33\x33\x6d\x3b\x1b\x5b\x33\x31\x6d\x3c\x1b\x5b\x33"
"\x33\x6d\x3b\x1b\x5b\x33\x31\x6d\x3c\x3c\x1b\x5b\x33\x30\x6d\x53\x24\x53\x1b"
"\x5b\x33\x31\x6d\x53\x1b\x5b\x33\x37\x6d\x27\x1b\x5b\x33\x33\x6d\x2e\x3a\x3b"
"\x1b\x5b\x33\x31\x6d\x3c\x3b\x3c\x1b\x5b\x33\x33\x6d\x3a\x1b\x5b\x33\x31\x6d"
"\x3c\x1b\x5b\x33\x33\x6d\x3a\x1b\x5b\x33\x37\x6d\x60\x20\x20\x20\x60\x2e\x3a"
"\x3a\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x2e\x3a\x3a\x3c\x53\x3c\x3a\x60"
"\x3a\x3a\x3a\x3a\x53\x1b\x5b\x33\x32\x6d\x53\x1b\x5b\x33\x37\x6d\x3b\x27\x3a"
"\x3c\x2c\x2e\x20\x20\x20\x20\x20\x20\x20\x20\x20\x60\x3a\x3a\x3a\x3a\x2e\x60"
"\x2e\x60\x2e\x60\x3a\x1b\x5b\x33\x33\x6d\x3c\x3a\x1b\x5b\x33\x31\x6d\x3c\x1b"
"\x5b\x33\x33\x6d\x53\x1b\x5b\x33\x31\x6d\x3c\x1b\x5b\x33\x33\x6d\x3b\x1b\x5b"
"\x33\x31\x6d\x3c\x2c\x1b\x5b\x33\x33\x6d\x3c\x3b\x3a\x1b\x5b\x33\x31\x6d\x2c"
"\x1b\x5b\x33\x33\x6d\x3c\x3b\x1b\x5b\x33\x31\x6d\x3c\x1b\x5b\x33\x33\x6d\x53"
"\x1b\x5b\x33\x31\x6d\x3c\x1b\x5b\x33\x33\x6d\x3b\x3c\x1b\x5b\x33\x37\x6d\x3a"
"\x60\x2e\x60\x2e\x3b\x1b\x5b\x33\x34\x6d\x53\x1b\x5b\x33\x37\x6d\x53\x3f\x27"
"\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x2e\x60\x3a\x60\x3a\x3c\x53\x53\x3b\x3c"
"\x3a\x60\x3a\x3a\x53\x53\x53\x3c\x3a\x60\x3a\x1b\x5b\x33\x30\x6d\x53\x1b\x5b"
"\x33\x37\x6d\x2b\x20\x20\x20\x20\x20\x20\x60\x20\x20\x20\x3a\x1b\x5b\x33\x34"
"\x6d\x53\x1b\x5b\x33\x30\x6d\x53\x46\x24\x1b\x5b\x33\x37\x6d\x2c\x60\x3a\x3a"
"\x3a\x3c\x3a\x3c\x1b\x5b\x33\x33\x6d\x53\x1b\x5b\x33\x37\x6d\x3c\x1b\x5b\x33"
"\x33\x6d\x53\x1b\x5b\x33\x31\x6d\x53\x1b\x5b\x33\x33\x6d\x3b\x1b\x5b\x33\x31"
"\x6d\x53\x3b\x53\x1b\x5b\x33\x33\x6d\x3b\x1b\x5b\x33\x31\x6d\x53\x1b\x5b\x33"
"\x33\x6d\x53\x1b\x5b\x33\x37\x6d\x3c\x1b\x5b\x33\x33\x6d\x53\x1b\x5b\x33\x37"
"\x6d\x3c\x53\x3c\x3a\x3a\x3a\x3a\x3f\x1b\x5b\x33\x30\x6d\x53\x24\x48\x1b\x5b"
"\x33\x37\x6d\x27\x60\x20\x60\x20\x20\x20\x20\x20\x20\x0a\x2e\x60\x3a\x60\x2e"
"\x60\x3a\x60\x2e\x60\x3a\x60\x2e\x60\x3a\x60\x2e\x60\x3a\x60\x2e\x1b\x5b\x33"
"\x30\x6d\x53\x46\x1b\x5b\x33\x37\x6d\x20\x20\x20\x20\x60\x20\x20\x20\x60\x20"
"\x60\x3a\x1b\x5b\x33\x30\x6d\x3c\x46\x46\x46\x1b\x5b\x33\x37\x6d\x3f\x2e\x60"
"\x3a\x60\x3a\x60\x3a\x60\x3a\x60\x3a\x3c\x3a\x60\x3a\x27\x3a\x60\x3a\x60\x3a"
"\x60\x3a\x60\x3b\x1b\x5b\x33\x30\x6d\x53\x46\x48\x46\x1b\x5b\x33\x37\x6d\x27"
"\x20\x60\x20\x60\x20\x60\x20\x20\x20\x20\x0a\x20\x3c\x3b\x3a\x2e\x60\x20\x60"
"\x2e\x60\x20\x60\x2e\x60\x20\x60\x2e\x60\x2c\x53\x1b\x5b\x33\x32\x6d\x53\x1b"
"\x5b\x33\x30\x6d\x53\x1b\x5b\x33\x37\x6d\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x60\x20\x60\x3c\x1b\x5b\x33\x30\x6d\x46\x46\x46\x1b\x5b\x33\x34\x6d"
"\x2b\x1b\x5b\x33\x37\x6d\x3a\x20\x60\x20\x60\x20\x60\x2e\x60\x20\x60\x2e\x60"
"\x20\x60\x2e\x60\x20\x60\x20\x60\x2c\x1b\x5b\x33\x30\x6d\x24\x46\x48\x46\x1b"
"\x5b\x33\x37\x6d\x27\x20\x60\x20\x20\x20\x60\x20\x20\x20\x20\x20\x20\x0a\x20"
"\x60\x3a\x1b\x5b\x33\x30\x6d\x53\x24\x1b\x5b\x33\x37\x6d\x53\x53\x53\x3b\x3c"
"\x2c\x60\x2c\x3b\x3b\x53\x3f\x53\x1b\x5b\x33\x30\x6d\x24\x46\x3c\x1b\x5b\x33"
"\x37\x6d\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x60\x20\x60"
"\x3c\x1b\x5b\x33\x30\x6d\x48\x46\x46\x46\x1b\x5b\x33\x37\x6d\x3f\x2e\x60\x20"
"\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x3b\x76\x1b\x5b\x33\x30\x6d"
"\x48\x46\x48\x46\x1b\x5b\x33\x37\x6d\x27\x20\x60\x20\x20\x20\x60\x20\x20\x20"
"\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x60\x3c\x1b\x5b\x33\x30\x6d\x46\x24\x1b"
"\x5b\x33\x37\x6d\x53\x53\x53\x53\x53\x53\x1b\x5b\x33\x30\x6d\x53\x24\x53\x46"
"\x46\x46\x1b\x5b\x33\x37\x6d\x27\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x60\x3c\x1b\x5b\x33\x30\x6d\x23\x46\x46\x46"
"\x24\x1b\x5b\x33\x37\x6d\x76\x2c\x2c\x20\x2e\x20\x2e\x20\x2c\x2c\x76\x1b\x5b"
"\x33\x30\x6d\x26\x24\x46\x46\x48\x3c\x1b\x5b\x33\x37\x6d\x27\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x60"
"\x3c\x1b\x5b\x33\x30\x6d\x53\x46\x46\x24\x46\x24\x46\x46\x48\x46\x53\x1b\x5b"
"\x33\x37\x6d\x20\x20\x20\x20\x20\x20\x20\x20\x2e\x60\x20\x60\x2e\x60\x2e\x60"
"\x2e\x60\x2e\x60\x3a\x3a\x3a\x3a\x3a\x1b\x5b\x33\x30\x6d\x2a\x46\x46\x46\x48"
"\x46\x48\x46\x48\x46\x46\x46\x48\x46\x48\x46\x48\x1b\x5b\x33\x37\x6d\x3c\x22"
"\x2e\x60\x2e\x60\x2e\x60\x2e\x60\x2e\x60\x20\x20\x20\x20\x20\x20\x20\x20\x0a"
"\x20\x20\x20\x20\x20\x20\x20\x60\x3a\x1b\x5b\x33\x30\x6d\x48\x46\x46\x46\x48"
"\x46\x46\x46\x1b\x5b\x33\x37\x6d\x27\x20\x20\x20\x60\x20\x60\x2e\x60\x20\x60"
"\x2e\x60\x2e\x60\x3a\x60\x3a\x60\x3a\x60\x3a\x60\x3a\x3a\x3a\x60\x3a\x3c\x3c"
"\x1b\x5b\x33\x30\x6d\x3c\x46\x48\x46\x46\x46\x48\x46\x46\x46\x1b\x5b\x33\x37"
"\x6d\x27\x3a\x60\x3a\x60\x3a\x60\x3a\x60\x2e\x60\x2e\x60\x20\x60\x2e\x60\x20"
"\x60\x20\x60\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x60\x22\x1b\x5b"
"\x33\x30\x6d\x2a\x46\x48\x46\x1b\x5b\x33\x37\x6d\x3f\x20\x20\x20\x60\x20\x60"
"\x2e\x60\x20\x60\x2e\x60\x2e\x60\x3a\x60\x2e\x60\x3a\x60\x3a\x60\x3a\x60\x3a"
"\x60\x3a\x60\x3a\x60\x3a\x60\x3a\x1b\x5b\x33\x30\x6d\x46\x46\x48\x46\x48\x46"
"\x1b\x5b\x33\x37\x6d\x27\x3a\x60\x3a\x60\x3a\x60\x3a\x60\x2e\x60\x3a\x60\x2e"
"\x60\x2e\x60\x20\x60\x2e\x60\x20\x60\x20\x60\x0a\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x60\x3c\x1b\x5b\x33\x30\x6d\x48\x46\x46\x1b\x5b\x33\x37\x6d"
"\x2b\x60\x20\x20\x20\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x60\x2e\x60\x20"
"\x60\x2e\x60\x20\x60\x2e\x60\x20\x60\x3a\x60\x2e\x60\x3b\x1b\x5b\x33\x30\x6d"
"\x48\x46\x46\x46\x1b\x5b\x33\x37\x6d\x27\x2e\x60\x2e\x60\x20\x60\x2e\x60\x20"
"\x60\x2e\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x20\x20\x60\x20\x20\x0a\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x22\x1b\x5b\x33\x30\x6d\x3c"
"\x48\x46\x53\x1b\x5b\x33\x37\x6d\x2b\x3a\x20\x20\x20\x60\x20\x60\x20\x60\x20"
"\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x60\x2c\x1b"
"\x5b\x33\x30\x6d\x24\x46\x48\x46\x1b\x5b\x33\x37\x6d\x3f\x20\x60\x20\x60\x20"
"\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x60\x20\x20\x20\x60"
"\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x60\x22\x3c\x1b\x5b\x33\x30\x6d\x48\x24\x46\x46\x1b\x5b\x33\x37\x6d\x3e\x2c"
"\x2e\x2e\x20\x20\x20\x20\x20\x20\x20\x20\x60\x20\x20\x20\x60\x20\x20\x20\x3b"
"\x2c\x2c\x1b\x5b\x33\x30\x6d\x24\x53\x46\x46\x46\x1b\x5b\x33\x37\x6d\x27\x22"
"\x20\x20\x60\x20\x20\x20\x60\x20\x20\x20\x60\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x60\x22\x1b\x5b\x33\x30\x6d\x2a\x3c\x48"
"\x46\x46\x24\x53\x24\x1b\x5b\x33\x37\x6d\x53\x53\x53\x3e\x3e\x3e\x3e\x3e\x53"
"\x3e\x53\x1b\x5b\x33\x30\x6d\x24\x53\x24\x46\x24\x48\x46\x23\x1b\x5b\x33\x37"
"\x6d\x27\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x60\x60\x22\x3c\x1b\x5b\x33\x30\x6d\x2a\x3c\x3c\x3c\x48\x46\x46\x46\x48\x46"
"\x46\x46\x23\x3c\x1b\x5b\x33\x36\x6d\x3c\x1b\x5b\x33\x37\x6d\x3c\x27\x22\x22"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x1b"
"\x5b\x30\x6d";
/* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
|