diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Kconfig.debug | 15 | ||||
| -rw-r--r-- | lib/Kconfig.ubsan | 4 | ||||
| -rw-r--r-- | lib/klist.c | 6 | ||||
| -rw-r--r-- | lib/scatterlist.c | 6 | ||||
| -rw-r--r-- | lib/vsprintf.c | 26 |
5 files changed, 37 insertions, 20 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index ecb9e75614bf..8bfd1aca7a3d 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
| @@ -1400,6 +1400,21 @@ config RCU_EQS_DEBUG | |||
| 1400 | 1400 | ||
| 1401 | endmenu # "RCU Debugging" | 1401 | endmenu # "RCU Debugging" |
| 1402 | 1402 | ||
| 1403 | config DEBUG_WQ_FORCE_RR_CPU | ||
| 1404 | bool "Force round-robin CPU selection for unbound work items" | ||
| 1405 | depends on DEBUG_KERNEL | ||
| 1406 | default n | ||
| 1407 | help | ||
| 1408 | Workqueue used to implicitly guarantee that work items queued | ||
| 1409 | without explicit CPU specified are put on the local CPU. This | ||
| 1410 | guarantee is no longer true and while local CPU is still | ||
| 1411 | preferred work items may be put on foreign CPUs. Kernel | ||
| 1412 | parameter "workqueue.debug_force_rr_cpu" is added to force | ||
| 1413 | round-robin CPU selection to flush out usages which depend on the | ||
| 1414 | now broken guarantee. This config option enables the debug | ||
| 1415 | feature by default. When enabled, memory and cache locality will | ||
| 1416 | be impacted. | ||
| 1417 | |||
| 1403 | config DEBUG_BLOCK_EXT_DEVT | 1418 | config DEBUG_BLOCK_EXT_DEVT |
| 1404 | bool "Force extended block device numbers and spread them" | 1419 | bool "Force extended block device numbers and spread them" |
| 1405 | depends on DEBUG_KERNEL | 1420 | depends on DEBUG_KERNEL |
diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan index 49518fb48cab..e07c1ba9ba13 100644 --- a/lib/Kconfig.ubsan +++ b/lib/Kconfig.ubsan | |||
| @@ -18,6 +18,8 @@ config UBSAN_SANITIZE_ALL | |||
| 18 | This option activates instrumentation for the entire kernel. | 18 | This option activates instrumentation for the entire kernel. |
| 19 | If you don't enable this option, you have to explicitly specify | 19 | If you don't enable this option, you have to explicitly specify |
| 20 | UBSAN_SANITIZE := y for the files/directories you want to check for UB. | 20 | UBSAN_SANITIZE := y for the files/directories you want to check for UB. |
| 21 | Enabling this option will get kernel image size increased | ||
| 22 | significantly. | ||
| 21 | 23 | ||
| 22 | config UBSAN_ALIGNMENT | 24 | config UBSAN_ALIGNMENT |
| 23 | bool "Enable checking of pointers alignment" | 25 | bool "Enable checking of pointers alignment" |
| @@ -25,5 +27,5 @@ config UBSAN_ALIGNMENT | |||
| 25 | default y if !HAVE_EFFICIENT_UNALIGNED_ACCESS | 27 | default y if !HAVE_EFFICIENT_UNALIGNED_ACCESS |
| 26 | help | 28 | help |
| 27 | This option enables detection of unaligned memory accesses. | 29 | This option enables detection of unaligned memory accesses. |
| 28 | Enabling this option on architectures that support unalligned | 30 | Enabling this option on architectures that support unaligned |
| 29 | accesses may produce a lot of false positives. | 31 | accesses may produce a lot of false positives. |
diff --git a/lib/klist.c b/lib/klist.c index d74cf7a29afd..0507fa5d84c5 100644 --- a/lib/klist.c +++ b/lib/klist.c | |||
| @@ -282,9 +282,9 @@ void klist_iter_init_node(struct klist *k, struct klist_iter *i, | |||
| 282 | struct klist_node *n) | 282 | struct klist_node *n) |
| 283 | { | 283 | { |
| 284 | i->i_klist = k; | 284 | i->i_klist = k; |
| 285 | i->i_cur = n; | 285 | i->i_cur = NULL; |
| 286 | if (n) | 286 | if (n && kref_get_unless_zero(&n->n_ref)) |
| 287 | kref_get(&n->n_ref); | 287 | i->i_cur = n; |
| 288 | } | 288 | } |
| 289 | EXPORT_SYMBOL_GPL(klist_iter_init_node); | 289 | EXPORT_SYMBOL_GPL(klist_iter_init_node); |
| 290 | 290 | ||
diff --git a/lib/scatterlist.c b/lib/scatterlist.c index bafa9933fa76..004fc70fc56a 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c | |||
| @@ -598,9 +598,9 @@ EXPORT_SYMBOL(sg_miter_next); | |||
| 598 | * | 598 | * |
| 599 | * Description: | 599 | * Description: |
| 600 | * Stops mapping iterator @miter. @miter should have been started | 600 | * Stops mapping iterator @miter. @miter should have been started |
| 601 | * started using sg_miter_start(). A stopped iteration can be | 601 | * using sg_miter_start(). A stopped iteration can be resumed by |
| 602 | * resumed by calling sg_miter_next() on it. This is useful when | 602 | * calling sg_miter_next() on it. This is useful when resources (kmap) |
| 603 | * resources (kmap) need to be released during iteration. | 603 | * need to be released during iteration. |
| 604 | * | 604 | * |
| 605 | * Context: | 605 | * Context: |
| 606 | * Preemption disabled if the SG_MITER_ATOMIC is set. Don't care | 606 | * Preemption disabled if the SG_MITER_ATOMIC is set. Don't care |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 48ff9c36644d..f44e178e6ede 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
| @@ -1590,22 +1590,23 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, | |||
| 1590 | return buf; | 1590 | return buf; |
| 1591 | } | 1591 | } |
| 1592 | case 'K': | 1592 | case 'K': |
| 1593 | /* | ||
| 1594 | * %pK cannot be used in IRQ context because its test | ||
| 1595 | * for CAP_SYSLOG would be meaningless. | ||
| 1596 | */ | ||
| 1597 | if (kptr_restrict && (in_irq() || in_serving_softirq() || | ||
| 1598 | in_nmi())) { | ||
| 1599 | if (spec.field_width == -1) | ||
| 1600 | spec.field_width = default_width; | ||
| 1601 | return string(buf, end, "pK-error", spec); | ||
| 1602 | } | ||
| 1603 | |||
| 1604 | switch (kptr_restrict) { | 1593 | switch (kptr_restrict) { |
| 1605 | case 0: | 1594 | case 0: |
| 1606 | /* Always print %pK values */ | 1595 | /* Always print %pK values */ |
| 1607 | break; | 1596 | break; |
| 1608 | case 1: { | 1597 | case 1: { |
| 1598 | const struct cred *cred; | ||
| 1599 | |||
| 1600 | /* | ||
| 1601 | * kptr_restrict==1 cannot be used in IRQ context | ||
| 1602 | * because its test for CAP_SYSLOG would be meaningless. | ||
| 1603 | */ | ||
| 1604 | if (in_irq() || in_serving_softirq() || in_nmi()) { | ||
| 1605 | if (spec.field_width == -1) | ||
| 1606 | spec.field_width = default_width; | ||
| 1607 | return string(buf, end, "pK-error", spec); | ||
| 1608 | } | ||
| 1609 | |||
| 1609 | /* | 1610 | /* |
| 1610 | * Only print the real pointer value if the current | 1611 | * Only print the real pointer value if the current |
| 1611 | * process has CAP_SYSLOG and is running with the | 1612 | * process has CAP_SYSLOG and is running with the |
| @@ -1615,8 +1616,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, | |||
| 1615 | * leak pointer values if a binary opens a file using | 1616 | * leak pointer values if a binary opens a file using |
| 1616 | * %pK and then elevates privileges before reading it. | 1617 | * %pK and then elevates privileges before reading it. |
| 1617 | */ | 1618 | */ |
| 1618 | const struct cred *cred = current_cred(); | 1619 | cred = current_cred(); |
| 1619 | |||
| 1620 | if (!has_capability_noaudit(current, CAP_SYSLOG) || | 1620 | if (!has_capability_noaudit(current, CAP_SYSLOG) || |
| 1621 | !uid_eq(cred->euid, cred->uid) || | 1621 | !uid_eq(cred->euid, cred->uid) || |
| 1622 | !gid_eq(cred->egid, cred->gid)) | 1622 | !gid_eq(cred->egid, cred->gid)) |
