vsprintf.c (f43dc23d5ea91fca257be02138a255f02d98e806) | vsprintf.c (455cd5ab305c90ffc422dd2e0fb634730942b257) |
---|---|
1/* 2 * linux/lib/vsprintf.c 3 * 4 * Copyright (C) 1991, 1992 Linus Torvalds 5 */ 6 7/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */ 8/* --- 922 unchanged lines hidden (view full) --- 931 do { 932 *p = toupper(*p); 933 } while (*(++p)); 934 } 935 936 return string(buf, end, uuid, spec); 937} 938 | 1/* 2 * linux/lib/vsprintf.c 3 * 4 * Copyright (C) 1991, 1992 Linus Torvalds 5 */ 6 7/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */ 8/* --- 922 unchanged lines hidden (view full) --- 931 do { 932 *p = toupper(*p); 933 } while (*(++p)); 934 } 935 936 return string(buf, end, uuid, spec); 937} 938 |
939int kptr_restrict = 1; 940 |
|
939/* 940 * Show a '%p' thing. A kernel extension is that the '%p' is followed 941 * by an extra set of alphanumeric characters that are extended format 942 * specifiers. 943 * 944 * Right now we handle: 945 * 946 * - 'F' For symbolic function descriptor pointers with offset --- 27 unchanged lines hidden (view full) --- 974 * [0][1][2][3]-[4][5]-[6][7]-[8][9]-[10][11][12][13][14][15] 975 * little endian output byte order is: 976 * [3][2][1][0]-[5][4]-[7][6]-[8][9]-[10][11][12][13][14][15] 977 * - 'V' For a struct va_format which contains a format string * and va_list *, 978 * call vsnprintf(->format, *->va_list). 979 * Implements a "recursive vsnprintf". 980 * Do not use this feature without some mechanism to verify the 981 * correctness of the format string and va_list arguments. | 941/* 942 * Show a '%p' thing. A kernel extension is that the '%p' is followed 943 * by an extra set of alphanumeric characters that are extended format 944 * specifiers. 945 * 946 * Right now we handle: 947 * 948 * - 'F' For symbolic function descriptor pointers with offset --- 27 unchanged lines hidden (view full) --- 976 * [0][1][2][3]-[4][5]-[6][7]-[8][9]-[10][11][12][13][14][15] 977 * little endian output byte order is: 978 * [3][2][1][0]-[5][4]-[7][6]-[8][9]-[10][11][12][13][14][15] 979 * - 'V' For a struct va_format which contains a format string * and va_list *, 980 * call vsnprintf(->format, *->va_list). 981 * Implements a "recursive vsnprintf". 982 * Do not use this feature without some mechanism to verify the 983 * correctness of the format string and va_list arguments. |
984 * - 'K' For a kernel pointer that should be hidden from unprivileged users |
|
982 * 983 * Note: The difference between 'S' and 'F' is that on ia64 and ppc64 984 * function pointers are really function descriptors, which contain a 985 * pointer to the real address. 986 */ 987static noinline_for_stack 988char *pointer(const char *fmt, char *buf, char *end, void *ptr, 989 struct printf_spec spec) --- 40 unchanged lines hidden (view full) --- 1030 } 1031 break; 1032 case 'U': 1033 return uuid_string(buf, end, ptr, spec, fmt); 1034 case 'V': 1035 return buf + vsnprintf(buf, end - buf, 1036 ((struct va_format *)ptr)->fmt, 1037 *(((struct va_format *)ptr)->va)); | 985 * 986 * Note: The difference between 'S' and 'F' is that on ia64 and ppc64 987 * function pointers are really function descriptors, which contain a 988 * pointer to the real address. 989 */ 990static noinline_for_stack 991char *pointer(const char *fmt, char *buf, char *end, void *ptr, 992 struct printf_spec spec) --- 40 unchanged lines hidden (view full) --- 1033 } 1034 break; 1035 case 'U': 1036 return uuid_string(buf, end, ptr, spec, fmt); 1037 case 'V': 1038 return buf + vsnprintf(buf, end - buf, 1039 ((struct va_format *)ptr)->fmt, 1040 *(((struct va_format *)ptr)->va)); |
1041 case 'K': 1042 /* 1043 * %pK cannot be used in IRQ context because its test 1044 * for CAP_SYSLOG would be meaningless. 1045 */ 1046 if (in_irq() || in_serving_softirq() || in_nmi()) { 1047 if (spec.field_width == -1) 1048 spec.field_width = 2 * sizeof(void *); 1049 return string(buf, end, "pK-error", spec); 1050 } else if ((kptr_restrict == 0) || 1051 (kptr_restrict == 1 && 1052 has_capability_noaudit(current, CAP_SYSLOG))) 1053 break; 1054 1055 if (spec.field_width == -1) { 1056 spec.field_width = 2 * sizeof(void *); 1057 spec.flags |= ZEROPAD; 1058 } 1059 return number(buf, end, 0, spec); |
|
1038 } 1039 spec.flags |= SMALL; 1040 if (spec.field_width == -1) { 1041 spec.field_width = 2 * sizeof(void *); 1042 spec.flags |= ZEROPAD; 1043 } 1044 spec.base = 16; 1045 --- 1118 unchanged lines hidden --- | 1060 } 1061 spec.flags |= SMALL; 1062 if (spec.field_width == -1) { 1063 spec.field_width = 2 * sizeof(void *); 1064 spec.flags |= ZEROPAD; 1065 } 1066 spec.base = 16; 1067 --- 1118 unchanged lines hidden --- |