arch/Kconfig | 3 + arch/ia64/Kconfig | 1 + arch/ia64/include/asm/elf.h | 2 +- arch/ia64/include/asm/sections.h | 24 +------- arch/ia64/kernel/module.c | 6 +- arch/parisc/Kconfig | 1 + arch/parisc/include/asm/sections.h | 16 ++---- arch/parisc/kernel/process.c | 21 ------- arch/powerpc/Kconfig | 1 + arch/powerpc/Makefile | 2 +- arch/powerpc/include/asm/code-patching.h | 2 +- arch/powerpc/include/asm/elf.h | 6 ++ arch/powerpc/include/asm/sections.h | 29 ++-------- arch/powerpc/include/asm/types.h | 6 -- arch/powerpc/include/uapi/asm/elf.h | 8 --- arch/powerpc/kernel/module_64.c | 42 ++++++-------- arch/powerpc/kernel/ptrace/ptrace.c | 6 ++ arch/powerpc/kernel/signal_64.c | 8 +-- drivers/misc/lkdtm/core.c | 1 + drivers/misc/lkdtm/lkdtm.h | 1 + drivers/misc/lkdtm/perms.c | 71 +++++++++++++++++++----- include/asm-generic/sections.h | 15 ++++- include/linux/kallsyms.h | 2 +- kernel/extable.c | 24 +++++++- tools/testing/selftests/lkdtm/tests.txt | 1 + 25 files changed, 155 insertions(+), 144 deletions(-)
PPC64/IA64/PARISC have function descriptors. LKDTM doesn't work
on those three architectures because LKDTM messes up function
descriptors with functions.
This series does some cleanup in the three architectures and
refactors function descriptors so that it can then easily use it
in a generic way in LKDTM.
Changes in v4:
- Added patch 1 which Fixes 'sparse' for powerpc64le after wrong report on previous series, refer https://github.com/ruscur/linux-ci/actions/runs/1351427671
- Exported dereference_function_descriptor() to modules
- Addressed other received comments
- Rebased on latest powerpc/next (5a72345e6a78120368fcc841b570331b6c5a50da)
Changes in v3:
- Addressed received comments
- Swapped some of the powerpc patches to keep func_descr_t renamed as struct func_desc and remove 'struct ppc64_opd_entry'
- Changed HAVE_FUNCTION_DESCRIPTORS macro to a config item CONFIG_HAVE_FUNCTION_DESCRIPTORS
- Dropped patch 11 ("Fix lkdtm_EXEC_RODATA()")
Changes in v2:
- Addressed received comments
- Moved dereference_[kernel]_function_descriptor() out of line
- Added patches to remove func_descr_t and func_desc_t in powerpc
- Using func_desc_t instead of funct_descr_t
- Renamed HAVE_DEREFERENCE_FUNCTION_DESCRIPTOR to HAVE_FUNCTION_DESCRIPTORS
- Added a new lkdtm test to check protection of function descriptors
Christophe Leroy (13):
powerpc: Fix 'sparse' checking on PPC64le
powerpc: Move and rename func_descr_t
powerpc: Use 'struct func_desc' instead of 'struct ppc64_opd_entry'
powerpc: Remove 'struct ppc64_opd_entry'
powerpc: Prepare func_desc_t for refactorisation
ia64: Rename 'ip' to 'addr' in 'struct fdesc'
asm-generic: Define CONFIG_HAVE_FUNCTION_DESCRIPTORS
asm-generic: Define 'func_desc_t' to commonly describe function
descriptors
asm-generic: Refactor dereference_[kernel]_function_descriptor()
lkdtm: Force do_nothing() out of line
lkdtm: Really write into kernel text in WRITE_KERN
lkdtm: Fix execute_[user]_location()
lkdtm: Add a test for function descriptors protection
arch/Kconfig | 3 +
arch/ia64/Kconfig | 1 +
arch/ia64/include/asm/elf.h | 2 +-
arch/ia64/include/asm/sections.h | 24 +-------
arch/ia64/kernel/module.c | 6 +-
arch/parisc/Kconfig | 1 +
arch/parisc/include/asm/sections.h | 16 ++----
arch/parisc/kernel/process.c | 21 -------
arch/powerpc/Kconfig | 1 +
arch/powerpc/Makefile | 2 +-
arch/powerpc/include/asm/code-patching.h | 2 +-
arch/powerpc/include/asm/elf.h | 6 ++
arch/powerpc/include/asm/sections.h | 29 ++--------
arch/powerpc/include/asm/types.h | 6 --
arch/powerpc/include/uapi/asm/elf.h | 8 ---
arch/powerpc/kernel/module_64.c | 42 ++++++--------
arch/powerpc/kernel/ptrace/ptrace.c | 6 ++
arch/powerpc/kernel/signal_64.c | 8 +--
drivers/misc/lkdtm/core.c | 1 +
drivers/misc/lkdtm/lkdtm.h | 1 +
drivers/misc/lkdtm/perms.c | 71 +++++++++++++++++++-----
include/asm-generic/sections.h | 15 ++++-
include/linux/kallsyms.h | 2 +-
kernel/extable.c | 24 +++++++-
tools/testing/selftests/lkdtm/tests.txt | 1 +
25 files changed, 155 insertions(+), 144 deletions(-)
--
2.34.1
Hi! On 2/15/22 13:40, Christophe Leroy wrote: > PPC64/IA64/PARISC have function descriptors. LKDTM doesn't work > on those three architectures because LKDTM messes up function > descriptors with functions. > > This series does some cleanup in the three architectures and > refactors function descriptors so that it can then easily use it > in a generic way in LKDTM. I'll test the series on ia64 later this week. I have an Itanium box at home for testing kernel patches. Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaubitz@debian.org `. `' Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Hi! On 2/16/22 13:25, John Paul Adrian Glaubitz wrote: >> This series does some cleanup in the three architectures and >> refactors function descriptors so that it can then easily use it >> in a generic way in LKDTM. > > I'll test the series on ia64 later this week. I have an Itanium box at > home for testing kernel patches. Series applied on top of 038101e6b2cd5c55f888f85db42ea2ad3aecb4b6 and successfully tested on my HP Integrity RX2600 server. Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaubitz@debian.org `. `' Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
On Tue, Feb 15, 2022 at 01:40:55PM +0100, Christophe Leroy wrote:
> PPC64/IA64/PARISC have function descriptors. LKDTM doesn't work
> on those three architectures because LKDTM messes up function
> descriptors with functions.
>
> This series does some cleanup in the three architectures and
> refactors function descriptors so that it can then easily use it
> in a generic way in LKDTM.
Thanks for doing this! It looks good to me. :)
-Kees
>
> Changes in v4:
> - Added patch 1 which Fixes 'sparse' for powerpc64le after wrong report on previous series, refer https://github.com/ruscur/linux-ci/actions/runs/1351427671
> - Exported dereference_function_descriptor() to modules
> - Addressed other received comments
> - Rebased on latest powerpc/next (5a72345e6a78120368fcc841b570331b6c5a50da)
>
> Changes in v3:
> - Addressed received comments
> - Swapped some of the powerpc patches to keep func_descr_t renamed as struct func_desc and remove 'struct ppc64_opd_entry'
> - Changed HAVE_FUNCTION_DESCRIPTORS macro to a config item CONFIG_HAVE_FUNCTION_DESCRIPTORS
> - Dropped patch 11 ("Fix lkdtm_EXEC_RODATA()")
>
> Changes in v2:
> - Addressed received comments
> - Moved dereference_[kernel]_function_descriptor() out of line
> - Added patches to remove func_descr_t and func_desc_t in powerpc
> - Using func_desc_t instead of funct_descr_t
> - Renamed HAVE_DEREFERENCE_FUNCTION_DESCRIPTOR to HAVE_FUNCTION_DESCRIPTORS
> - Added a new lkdtm test to check protection of function descriptors
>
> Christophe Leroy (13):
> powerpc: Fix 'sparse' checking on PPC64le
> powerpc: Move and rename func_descr_t
> powerpc: Use 'struct func_desc' instead of 'struct ppc64_opd_entry'
> powerpc: Remove 'struct ppc64_opd_entry'
> powerpc: Prepare func_desc_t for refactorisation
> ia64: Rename 'ip' to 'addr' in 'struct fdesc'
> asm-generic: Define CONFIG_HAVE_FUNCTION_DESCRIPTORS
> asm-generic: Define 'func_desc_t' to commonly describe function
> descriptors
> asm-generic: Refactor dereference_[kernel]_function_descriptor()
> lkdtm: Force do_nothing() out of line
> lkdtm: Really write into kernel text in WRITE_KERN
> lkdtm: Fix execute_[user]_location()
> lkdtm: Add a test for function descriptors protection
>
> arch/Kconfig | 3 +
> arch/ia64/Kconfig | 1 +
> arch/ia64/include/asm/elf.h | 2 +-
> arch/ia64/include/asm/sections.h | 24 +-------
> arch/ia64/kernel/module.c | 6 +-
> arch/parisc/Kconfig | 1 +
> arch/parisc/include/asm/sections.h | 16 ++----
> arch/parisc/kernel/process.c | 21 -------
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/Makefile | 2 +-
> arch/powerpc/include/asm/code-patching.h | 2 +-
> arch/powerpc/include/asm/elf.h | 6 ++
> arch/powerpc/include/asm/sections.h | 29 ++--------
> arch/powerpc/include/asm/types.h | 6 --
> arch/powerpc/include/uapi/asm/elf.h | 8 ---
> arch/powerpc/kernel/module_64.c | 42 ++++++--------
> arch/powerpc/kernel/ptrace/ptrace.c | 6 ++
> arch/powerpc/kernel/signal_64.c | 8 +--
> drivers/misc/lkdtm/core.c | 1 +
> drivers/misc/lkdtm/lkdtm.h | 1 +
> drivers/misc/lkdtm/perms.c | 71 +++++++++++++++++++-----
> include/asm-generic/sections.h | 15 ++++-
> include/linux/kallsyms.h | 2 +-
> kernel/extable.c | 24 +++++++-
> tools/testing/selftests/lkdtm/tests.txt | 1 +
> 25 files changed, 155 insertions(+), 144 deletions(-)
>
> --
> 2.34.1
>
--
Kees Cook
Kees Cook <keescook@chromium.org> writes: > On Tue, Feb 15, 2022 at 01:40:55PM +0100, Christophe Leroy wrote: >> PPC64/IA64/PARISC have function descriptors. LKDTM doesn't work >> on those three architectures because LKDTM messes up function >> descriptors with functions. >> >> This series does some cleanup in the three architectures and >> refactors function descriptors so that it can then easily use it >> in a generic way in LKDTM. > > Thanks for doing this! It looks good to me. :) How should we merge this series, it's a bit all over the map. I could put it in a topic branch? cheers
On Wed, Feb 16, 2022 at 11:22:33PM +1100, Michael Ellerman wrote: > Kees Cook <keescook@chromium.org> writes: > > On Tue, Feb 15, 2022 at 01:40:55PM +0100, Christophe Leroy wrote: > >> PPC64/IA64/PARISC have function descriptors. LKDTM doesn't work > >> on those three architectures because LKDTM messes up function > >> descriptors with functions. > >> > >> This series does some cleanup in the three architectures and > >> refactors function descriptors so that it can then easily use it > >> in a generic way in LKDTM. > > > > Thanks for doing this! It looks good to me. :) > > How should we merge this series, it's a bit all over the map. > > I could put it in a topic branch? That's fine by me -- I had assumed it'd go via the ppc tree. But if you'd rather I take it as a topic branch I can do that too. -- Kees Cook
On 2/15/22 17:07, Kees Cook wrote:
> On Tue, Feb 15, 2022 at 01:40:55PM +0100, Christophe Leroy wrote:
>> PPC64/IA64/PARISC have function descriptors. LKDTM doesn't work
>> on those three architectures because LKDTM messes up function
>> descriptors with functions.
>>
>> This series does some cleanup in the three architectures and
>> refactors function descriptors so that it can then easily use it
>> in a generic way in LKDTM.
>
> Thanks for doing this! It looks good to me. :)
I endorse that.
Thank you, Christophe!
Acked-by: Helge Deller <deller@gmx.de>
Helge
> -Kees
>
>>
>> Changes in v4:
>> - Added patch 1 which Fixes 'sparse' for powerpc64le after wrong report on previous series, refer https://github.com/ruscur/linux-ci/actions/runs/1351427671
>> - Exported dereference_function_descriptor() to modules
>> - Addressed other received comments
>> - Rebased on latest powerpc/next (5a72345e6a78120368fcc841b570331b6c5a50da)
>>
>> Changes in v3:
>> - Addressed received comments
>> - Swapped some of the powerpc patches to keep func_descr_t renamed as struct func_desc and remove 'struct ppc64_opd_entry'
>> - Changed HAVE_FUNCTION_DESCRIPTORS macro to a config item CONFIG_HAVE_FUNCTION_DESCRIPTORS
>> - Dropped patch 11 ("Fix lkdtm_EXEC_RODATA()")
>>
>> Changes in v2:
>> - Addressed received comments
>> - Moved dereference_[kernel]_function_descriptor() out of line
>> - Added patches to remove func_descr_t and func_desc_t in powerpc
>> - Using func_desc_t instead of funct_descr_t
>> - Renamed HAVE_DEREFERENCE_FUNCTION_DESCRIPTOR to HAVE_FUNCTION_DESCRIPTORS
>> - Added a new lkdtm test to check protection of function descriptors
>>
>> Christophe Leroy (13):
>> powerpc: Fix 'sparse' checking on PPC64le
>> powerpc: Move and rename func_descr_t
>> powerpc: Use 'struct func_desc' instead of 'struct ppc64_opd_entry'
>> powerpc: Remove 'struct ppc64_opd_entry'
>> powerpc: Prepare func_desc_t for refactorisation
>> ia64: Rename 'ip' to 'addr' in 'struct fdesc'
>> asm-generic: Define CONFIG_HAVE_FUNCTION_DESCRIPTORS
>> asm-generic: Define 'func_desc_t' to commonly describe function
>> descriptors
>> asm-generic: Refactor dereference_[kernel]_function_descriptor()
>> lkdtm: Force do_nothing() out of line
>> lkdtm: Really write into kernel text in WRITE_KERN
>> lkdtm: Fix execute_[user]_location()
>> lkdtm: Add a test for function descriptors protection
>>
>> arch/Kconfig | 3 +
>> arch/ia64/Kconfig | 1 +
>> arch/ia64/include/asm/elf.h | 2 +-
>> arch/ia64/include/asm/sections.h | 24 +-------
>> arch/ia64/kernel/module.c | 6 +-
>> arch/parisc/Kconfig | 1 +
>> arch/parisc/include/asm/sections.h | 16 ++----
>> arch/parisc/kernel/process.c | 21 -------
>> arch/powerpc/Kconfig | 1 +
>> arch/powerpc/Makefile | 2 +-
>> arch/powerpc/include/asm/code-patching.h | 2 +-
>> arch/powerpc/include/asm/elf.h | 6 ++
>> arch/powerpc/include/asm/sections.h | 29 ++--------
>> arch/powerpc/include/asm/types.h | 6 --
>> arch/powerpc/include/uapi/asm/elf.h | 8 ---
>> arch/powerpc/kernel/module_64.c | 42 ++++++--------
>> arch/powerpc/kernel/ptrace/ptrace.c | 6 ++
>> arch/powerpc/kernel/signal_64.c | 8 +--
>> drivers/misc/lkdtm/core.c | 1 +
>> drivers/misc/lkdtm/lkdtm.h | 1 +
>> drivers/misc/lkdtm/perms.c | 71 +++++++++++++++++++-----
>> include/asm-generic/sections.h | 15 ++++-
>> include/linux/kallsyms.h | 2 +-
>> kernel/extable.c | 24 +++++++-
>> tools/testing/selftests/lkdtm/tests.txt | 1 +
>> 25 files changed, 155 insertions(+), 144 deletions(-)
>>
>> --
>> 2.34.1
>>
>
On Tue, 15 Feb 2022 13:40:55 +0100, Christophe Leroy wrote:
> PPC64/IA64/PARISC have function descriptors. LKDTM doesn't work
> on those three architectures because LKDTM messes up function
> descriptors with functions.
>
> This series does some cleanup in the three architectures and
> refactors function descriptors so that it can then easily use it
> in a generic way in LKDTM.
>
> [...]
Applied to powerpc/next.
[01/13] powerpc: Fix 'sparse' checking on PPC64le
https://git.kernel.org/powerpc/c/81df21de8fb45d3a55d41da9c7f5724797d51ce6
[02/13] powerpc: Move and rename func_descr_t
https://git.kernel.org/powerpc/c/5b23cb8cc6b0aab0535253cc2aa362572bab7072
[03/13] powerpc: Use 'struct func_desc' instead of 'struct ppc64_opd_entry'
https://git.kernel.org/powerpc/c/d3e32b997a4ca2e7be71cb770bcb2c000ee20b36
[04/13] powerpc: Remove 'struct ppc64_opd_entry'
https://git.kernel.org/powerpc/c/0a9c5ae279c963149df9a84588281d3d607f7a1f
[05/13] powerpc: Prepare func_desc_t for refactorisation
https://git.kernel.org/powerpc/c/2fd986377d546bedaf27e36554dc9090d272f15d
[06/13] ia64: Rename 'ip' to 'addr' in 'struct fdesc'
https://git.kernel.org/powerpc/c/41a88b45479da873bfc5d29ba1a545a780c5329a
[07/13] asm-generic: Define CONFIG_HAVE_FUNCTION_DESCRIPTORS
https://git.kernel.org/powerpc/c/a257cacc38718c83cee003487e03197f237f5c3f
[08/13] asm-generic: Define 'func_desc_t' to commonly describe function descriptors
https://git.kernel.org/powerpc/c/0dc690e4ef5b901e9d4b53520854fbd5c749e09d
[09/13] asm-generic: Refactor dereference_[kernel]_function_descriptor()
https://git.kernel.org/powerpc/c/e1478d8eaf27704db17a44dee4c53696ed01fc9c
[10/13] lkdtm: Force do_nothing() out of line
https://git.kernel.org/powerpc/c/69b420ed8fd3917ac7073256b4929aa246b6fe31
[11/13] lkdtm: Really write into kernel text in WRITE_KERN
https://git.kernel.org/powerpc/c/b64913394f123e819bffabc79a0e48f98e78dc5d
[12/13] lkdtm: Fix execute_[user]_location()
https://git.kernel.org/powerpc/c/72a86433049dcfe918886645ac3d19c1eaaa67ab
[13/13] lkdtm: Add a test for function descriptors protection
https://git.kernel.org/powerpc/c/5e5a6c5441654d1b9e576ce4ca8a1759e701079e
cheers
Michael Ellerman <patch-notifications@ellerman.id.au> writes: > On Tue, 15 Feb 2022 13:40:55 +0100, Christophe Leroy wrote: >> PPC64/IA64/PARISC have function descriptors. LKDTM doesn't work >> on those three architectures because LKDTM messes up function >> descriptors with functions. >> >> This series does some cleanup in the three architectures and >> refactors function descriptors so that it can then easily use it >> in a generic way in LKDTM. >> >> [...] > > Applied to powerpc/next. I also have it in an rc2-based topic branch if there are any merge conflicts that people want to resolve, I don't see any in linux-next at the moment though. https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/log/?h=topic/func-desc-lkdtm cheers
On Wed, Mar 09, 2022 at 12:37:14PM +1100, Michael Ellerman wrote: > Michael Ellerman <patch-notifications@ellerman.id.au> writes: > > On Tue, 15 Feb 2022 13:40:55 +0100, Christophe Leroy wrote: > >> PPC64/IA64/PARISC have function descriptors. LKDTM doesn't work > >> on those three architectures because LKDTM messes up function > >> descriptors with functions. > >> > >> This series does some cleanup in the three architectures and > >> refactors function descriptors so that it can then easily use it > >> in a generic way in LKDTM. > >> > >> [...] > > > > Applied to powerpc/next. > > I also have it in an rc2-based topic branch if there are any merge > conflicts that people want to resolve, I don't see any in linux-next at > the moment though. > > https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/log/?h=topic/func-desc-lkdtm Thanks! I've got some core changes coming for lkdtm, but I'm waiting until after the merge window to rebase them and get them into -next. -- Kees Cook
© 2016 - 2026 Red Hat, Inc.