Pull arm64 fixes from Will Deacon: "There's no real pattern to the fixes, but the main one fixes our pmd_leaf() definition to resolve a NULL dereference on the migration path. - Fix PMU event validation in the absence of any event counters - Fix allmodconfig build using clang in conjunction with binutils - Fix definitions of pXd_leaf() to handle PROT_NONE entries - More typo fixes" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: mm: fix p?d_leaf() arm64: fix typos in comments arm64: Improve HAVE_DYNAMIC_FTRACE_WITH_REGS selection for clang arm_pmu: Validate single/group leader events
Unified · Split
| @@ -175,8 +175,6 @@ config ARM64 · 174 unmodified lines | ||
| 175 | 175 | select HAVE_DEBUG_KMEMLEAK |
| 176 | 176 | select HAVE_DMA_CONTIGUOUS |
| 177 | 177 | select HAVE_DYNAMIC_FTRACE |
| 178 | − select HAVE_DYNAMIC_FTRACE_WITH_REGS \ | |
| 179 | − if $(cc-option,-fpatchable-function-entry=2) | |
| 180 | 178 | select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY \ |
| 181 | 179 | if DYNAMIC_FTRACE_WITH_REGS |
| 182 | 180 | select HAVE_EFFICIENT_UNALIGNED_ACCESS |
| @@ -228,6 +226,17 @@ config ARM64 · 45 unmodified lines | ||
| 228 | 226 | help |
| 229 | 227 | ARM 64-bit (AArch64) Linux support. |
| 230 | 228 | |
| 229 | +config CLANG_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS | |
| 230 | + def_bool CC_IS_CLANG | |
| 231 | + # https://github.com/ClangBuiltLinux/linux/issues/1507 | |
| 232 | + depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600)) | |
| 233 | + select HAVE_DYNAMIC_FTRACE_WITH_REGS | |
| 234 | + | |
| 235 | +config GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS | |
| 236 | + def_bool CC_IS_GCC | |
| 237 | + depends on $(cc-option,-fpatchable-function-entry=2) | |
| 238 | + select HAVE_DYNAMIC_FTRACE_WITH_REGS | |
| 239 | + | |
| 231 | 240 | config 64BIT |
| 232 | 241 | def_bool y |
| 233 | 242 | |
| @@ -678,7 +687,7 @@ config ARM64_ERRATUM_2051678 · 444 unmodified lines | ||
| 678 | 687 | default y |
| 679 | 688 | help |
| 680 | 689 | This options adds the workaround for ARM Cortex-A510 erratum ARM64_ERRATUM_2051678. |
| 681 | − Affected Coretex-A510 might not respect the ordering rules for | |
| 690 | + Affected Cortex-A510 might not respect the ordering rules for | |
| 682 | 691 | hardware update of the page table's dirty bit. The workaround |
| 683 | 692 | is to not enable the feature on affected CPUs. |
| 684 | 693 | |
| @@ -535,7 +535,7 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, · 534 unmodified lines | ||
| 535 | 535 | PMD_TYPE_TABLE) |
| 536 | 536 | #define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ |
| 537 | 537 | PMD_TYPE_SECT) |
| 538 | −#define pmd_leaf(pmd) pmd_sect(pmd) | |
| 538 | +#define pmd_leaf(pmd) (pmd_present(pmd) && !pmd_table(pmd)) | |
| 539 | 539 | #define pmd_bad(pmd) (!pmd_table(pmd)) |
| 540 | 540 | |
| 541 | 541 | #define pmd_leaf_size(pmd) (pmd_cont(pmd) ? CONT_PMD_SIZE : PMD_SIZE) |
| @@ -625,7 +625,7 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd) · 83 unmodified lines | ||
| 625 | 625 | #define pud_none(pud) (!pud_val(pud)) |
| 626 | 626 | #define pud_bad(pud) (!pud_table(pud)) |
| 627 | 627 | #define pud_present(pud) pte_present(pud_pte(pud)) |
| 628 | −#define pud_leaf(pud) pud_sect(pud) | |
| 628 | +#define pud_leaf(pud) (pud_present(pud) && !pud_table(pud)) | |
| 629 | 629 | #define pud_valid(pud) pte_valid(pud_pte(pud)) |
| 630 | 630 | |
| 631 | 631 | static inline void set_pud(pud_t *pudp, pud_t pud) |
| @@ -400,6 +400,9 @@ validate_group(struct perf_event *event) · 399 unmodified lines | ||
| 400 | 400 | if (!validate_event(event->pmu, &fake_pmu, leader)) |
| 401 | 401 | return -EINVAL; |
| 402 | 402 | |
| 403 | + if (event == leader) | |
| 404 | + return 0; | |
| 405 | + | |
| 403 | 406 | for_each_sibling_event(sibling, leader) { |
| 404 | 407 | if (!validate_event(event->pmu, &fake_pmu, sibling)) |
| 405 | 408 | return -EINVAL; |
| @@ -489,12 +492,7 @@ __hw_perf_event_init(struct perf_event *event) · 83 unmodified lines | ||
| 489 | 492 | local64_set(&hwc->period_left, hwc->sample_period); |
| 490 | 493 | } |
| 491 | 494 | |
| 492 | − if (event->group_leader != event) { | |
| 493 | − if (validate_group(event) != 0) | |
| 494 | − return -EINVAL; | |
| 495 | − } | |
| 496 | − | |
| 497 | − return 0; | |
| 495 | + return validate_group(event); | |
| 498 | 496 | } |
| 499 | 497 | |
| 500 | 498 | static int armpmu_event_init(struct perf_event *event) |