lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdn6bMGZFAwH8iS5xD+Ce7oV8U6Fgi_SrFpCjo2-1hEUrw@mail.gmail.com>
Date:   Thu, 12 Sep 2019 15:45:50 -0700
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Joe Perches <joe@...ches.com>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Stephen Rothwell <sfr@...b.auug.org.au>,
        Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
        clang-built-linux <clang-built-linux@...glegroups.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [rfc patch script] treewide conversion of __section(foo) to section("foo");

On Sun, Sep 8, 2019 at 9:21 PM Joe Perches <joe@...ches.com> wrote:
<snip>
> So running the script:
>
> $ perl section.pl
>
> produces a commit
> ---
> From 04e52f34fd4ee7008ea5bf0d8896bf8d1fdf9f3f Mon Sep 17 00:00:00 2001
> Message-Id: <04e52f34fd4ee7008ea5bf0d8896bf8d1fdf9f3f.1568001863.git.joe@...ches.com>
> From: Joe Perches <joe@...ches.com>
> Date: Sun, 8 Sep 2019 20:53:41 -0700
> Subject: [PATCH] treewide: Convert macro and uses of __section(foo) to
>  __section("foo")
>
> Use a more generic form for __section that requires quotes to avoid
> complications with clang and gcc differences.
>
> Remove the quote operator # from compiler_attributes.h __section macro.
>
> Convert all unquoted __section(foo) uses to quoted __section("foo").
> Also convert __attribute__((section("foo"))) uses to __section("foo")
> even if the __attribute__ has multiple list entry forms.
>
> Signed-off-by: Joe Perches <joe@...ches.com>
> ---
>  arch/arc/include/asm/linkage.h                    |  8 +++---
>  arch/arc/include/asm/mach_desc.h                  |  2 +-
>  arch/arc/plat-hsdk/platform.c                     |  2 +-
>  arch/arm/include/asm/cache.h                      |  2 +-
>  arch/arm/include/asm/cpuidle.h                    |  2 +-
>  arch/arm/include/asm/idmap.h                      |  2 +-
>  arch/arm/include/asm/kvm_hyp.h                    |  2 +-
>  arch/arm/include/asm/mach/arch.h                  |  4 +--
>  arch/arm/include/asm/setup.h                      |  2 +-
>  arch/arm/include/asm/smp.h                        |  2 +-
>  arch/arm/include/asm/tcm.h                        |  8 +++---
>  arch/arm/kernel/cpuidle.c                         |  2 +-
>  arch/arm/kernel/devtree.c                         |  2 +-
>  arch/arm64/include/asm/cache.h                    |  2 +-
>  arch/arm64/include/asm/exception.h                |  2 +-
>  arch/arm64/include/asm/kvm_hyp.h                  |  2 +-
>  arch/arm64/kernel/efi.c                           |  2 +-
>  arch/arm64/kernel/smp_spin_table.c                |  2 +-
>  arch/ia64/include/asm/cache.h                     |  2 +-
>  arch/microblaze/kernel/setup.c                    |  2 +-
>  arch/mips/include/asm/cache.h                     |  2 +-
>  arch/mips/include/asm/mach-pmcs-msp71xx/msp_pci.h |  4 +--
>  arch/mips/include/asm/machine.h                   |  2 +-
>  arch/mips/include/asm/mips_machine.h              |  2 +-
>  arch/mips/kernel/setup.c                          |  2 +-
>  arch/mips/mm/init.c                               |  2 +-
>  arch/parisc/include/asm/cache.h                   |  2 +-
>  arch/parisc/include/asm/ldcw.h                    |  2 +-
>  arch/parisc/kernel/ftrace.c                       |  2 +-
>  arch/parisc/mm/init.c                             |  6 ++--
>  arch/powerpc/boot/main.c                          |  2 +-
>  arch/powerpc/boot/ps3.c                           |  2 +-
>  arch/powerpc/include/asm/cache.h                  |  2 +-
>  arch/powerpc/include/asm/machdep.h                |  2 +-
>  arch/powerpc/kernel/btext.c                       |  2 +-
>  arch/powerpc/kernel/prom_init.c                   |  2 +-
>  arch/powerpc/kvm/book3s_64_vio_hv.c               |  2 +-
>  arch/s390/boot/compressed/decompressor.c          |  2 +-
>  arch/s390/boot/ipl_parm.c                         |  4 +--
>  arch/s390/boot/startup.c                          |  2 +-
>  arch/s390/include/asm/cache.h                     |  2 +-
>  arch/s390/include/asm/sections.h                  |  4 +--
>  arch/s390/kernel/setup.c                          |  2 +-
>  arch/s390/mm/init.c                               |  2 +-
>  arch/sh/boards/of-generic.c                       |  2 +-
>  arch/sh/include/asm/cache.h                       |  2 +-
>  arch/sh/include/asm/machvec.h                     |  2 +-
>  arch/sh/include/asm/smp.h                         |  2 +-
>  arch/sparc/include/asm/cache.h                    |  2 +-
>  arch/sparc/kernel/btext.c                         |  2 +-
>  arch/um/include/shared/init.h                     | 22 +++++++--------
>  arch/um/kernel/skas/clone.c                       |  2 +-
>  arch/um/kernel/um_arch.c                          |  2 +-
>  arch/x86/boot/compressed/pgtable_64.c             |  2 +-
>  arch/x86/boot/tty.c                               |  8 +++---
>  arch/x86/boot/video.h                             |  2 +-
>  arch/x86/include/asm/apic.h                       |  4 +--
>  arch/x86/include/asm/cache.h                      |  2 +-
>  arch/x86/include/asm/intel-mid.h                  |  2 +-
>  arch/x86/include/asm/iommu_table.h                |  2 +-
>  arch/x86/include/asm/irqflags.h                   |  2 +-
>  arch/x86/include/asm/mem_encrypt.h                |  2 +-
>  arch/x86/include/asm/setup.h                      |  2 +-
>  arch/x86/kernel/cpu/cpu.h                         |  2 +-
>  arch/x86/kernel/head64.c                          |  2 +-
>  arch/x86/mm/mem_encrypt.c                         |  4 +--
>  arch/x86/mm/mem_encrypt_identity.c                |  2 +-
>  arch/x86/platform/pvh/enlighten.c                 |  4 +--
>  arch/x86/purgatory/purgatory.c                    | 10 +++----
>  arch/x86/um/stub_segv.c                           |  2 +-
>  arch/x86/xen/enlighten.c                          |  2 +-
>  arch/x86/xen/enlighten_pvh.c                      |  2 +-
>  arch/xtensa/kernel/setup.c                        |  2 +-
>  drivers/clk/clk.c                                 |  2 +-
>  drivers/clocksource/timer-probe.c                 |  2 +-
>  drivers/firmware/efi/libstub/efi-stub-helper.c    |  6 ++--
>  drivers/irqchip/irqchip.c                         |  2 +-
>  drivers/of/of_reserved_mem.c                      |  2 +-
>  drivers/s390/char/sclp_early_core.c               |  4 +--
>  drivers/thermal/thermal_core.h                    |  2 +-
>  include/asm-generic/bug.h                         |  6 ++--
>  include/asm-generic/error-injection.h             |  2 +-
>  include/asm-generic/kprobes.h                     |  4 +--
>  include/linux/acpi.h                              |  2 +-
>  include/linux/cache.h                             |  4 +--
>  include/linux/compiler.h                          |  8 +++---
>  include/linux/compiler_attributes.h               | 12 +-------
>  include/linux/cpu.h                               |  2 +-
>  include/linux/dynamic_debug.h                     |  2 +-
>  include/linux/export.h                            |  4 +--
>  include/linux/firmware.h                          |  2 +-
>  include/linux/frame.h                             |  2 +-
>  include/linux/init.h                              | 34 +++++++++++------------
>  include/linux/init_task.h                         |  4 +--
>  include/linux/interrupt.h                         |  4 +--
>  include/linux/kernel.h                            |  6 ++--
>  include/linux/linkage.h                           |  4 +--
>  include/linux/lsm_hooks.h                         |  4 +--
>  include/linux/module.h                            |  2 +-
>  include/linux/moduleparam.h                       |  4 +--
>  include/linux/mtd/xip.h                           |  2 +-
>  include/linux/of.h                                |  2 +-
>  include/linux/percpu-defs.h                       |  2 +-
>  include/linux/printk.h                            |  4 +--
>  include/linux/rcupdate.h                          |  2 +-
>  include/linux/sched/debug.h                       |  2 +-
>  include/linux/serial_core.h                       |  2 +-
>  include/linux/spinlock.h                          |  2 +-
>  include/linux/srcutree.h                          |  2 +-
>  include/linux/syscalls.h                          |  6 ++--
>  include/linux/trace_events.h                      |  2 +-
>  include/linux/tracepoint.h                        |  8 +++---
>  include/trace/bpf_probe.h                         |  2 +-
>  include/trace/trace_events.h                      | 10 +++----
>  kernel/kallsyms.c                                 |  4 +--
>  kernel/trace/trace_export.c                       |  2 +-

Diff stats look good based on what I could find myself with grep.  I
also manually eyeballed each hunk (#eyestrain).  When you send, please
include my:
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
This patchset shows the need to follow up with conversions for some of
the other attributes like __used, __aligned, and __weak.
Good job handling some of the trickier cases.
One case I'm not sure is perfect (or if it even matters TBH) is when
there's a trailing backslash for a macro definition that continues
onto the next line, if those are all still tabbed out correctly.  But
the meat of this change is what's important and looks correct to.  If
you want to email me just the patch file (so I don't have to
copy+pasta from an email), I'd be happy to apply it and compile+boot
test a few more arch's than x86.

>  116 files changed, 193 insertions(+), 203 deletions(-)
-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ