Re: [PATCH v4 2/9] perf/core: open access for CAP_SYS_PERFMON privileged process

2020-01-10 Thread Song Liu
> On Jan 10, 2020, at 3:47 PM, Masami Hiramatsu wrote: > > On Fri, 10 Jan 2020 13:45:31 -0300 > Arnaldo Carvalho de Melo wrote: > >> Em Sat, Jan 11, 2020 at 12:52:13AM +0900, Masami Hiramatsu escreveu: >>> On Fri, 10 Jan 2020 15:02:34 +0100 Peter Zijlstra >>> wrote: Again, this only

Re: [PATCH v4 5/9] trace/bpf_trace: open access for CAP_SYS_PERFMON privileged process

2020-01-13 Thread Song Liu
> CAP_SYS_ADMIN usage for secure bpf_trace monitoring is discouraged > with respect to CAP_SYS_PERFMON capability. > > Signed-off-by: Alexey Budankov Acked-by: Song Liu > --- > kernel/trace/bpf_trace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff

Re: [PATCH v4 1/9] capabilities: introduce CAP_SYS_PERFMON to kernel and user space

2020-01-13 Thread Song Liu
R1rpgE9vEv4HppVlOXDIzKzoGL30c=FNJpET4buKFRuqktVHQphaY1qE7IsdFpU4iYwpCn4tY= > > > Signed-off-by: Alexey Budankov Acked-by: Song Liu

Re: [PATCH 12/15] md: stop using ->queuedata

2020-05-13 Thread Song Liu
On Wed, May 13, 2020 at 11:33 AM Christoph Hellwig wrote: > > On Wed, May 13, 2020 at 11:29:17AM -0700, Song Liu wrote: > > On Fri, May 8, 2020 at 9:17 AM Christoph Hellwig wrote: > > > > > > Signed-off-by: Christoph Hellwig > > > > Thanks for the clean

Re: [PATCH 12/15] md: stop using ->queuedata

2020-05-13 Thread Song Liu
On Fri, May 8, 2020 at 9:17 AM Christoph Hellwig wrote: > > Signed-off-by: Christoph Hellwig Thanks for the cleanup. IIUC, you want this go through md tree? Otherwise, Acked-by: Song Liu > --- > drivers/md/md.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-)

Re: [PATCH 17/20] block: rename generic_make_request to submit_bio_noacct

2020-07-02 Thread Song Liu
| 14 > drivers/md/raid10.c | 28 > drivers/md/raid5.c | 10 +++--- For md part: Acked-by: Song Liu

Re: [PATCH 12/20] block: remove the request_queue argument from blk_queue_split

2020-07-02 Thread Song Liu
On Wed, Jul 1, 2020 at 2:02 AM Christoph Hellwig wrote: > > The queue can be trivially derived from the bio, so pass one less > argument. > > Signed-off-by: Christoph Hellwig > --- [...] > drivers/md/md.c | 2 +- For md.c: Acked-by: Song Liu

Re: [PATCH 4/9] powerpc/bpf: Handle large branch ranges with BPF_EXIT

2021-10-01 Thread Song Liu
; emitted after the initial run and do a second pass since BPF_EXIT can > end up emitting different number of instructions depending on the > program size. > > Suggested-by: Jordan Niethe > Signed-off-by: Naveen N. Rao Acked-by: Song Liu > --- > arch/powerpc/net/bpf_jit.h

Re: [PATCH 5/9] powerpc/bpf: Fix BPF_MOD when imm == 1

2021-10-01 Thread Song Liu
On Fri, Oct 1, 2021 at 2:16 PM Naveen N. Rao wrote: > > Only ignore the operation if dividing by 1. > > Fixes: 156d0e290e969c ("powerpc/ebpf/jit: Implement JIT compiler for extended > BPF") > Signed-off-by: Naveen N. Rao Acked-by: Song Liu > --- > arch

Re: [PATCH 1/9] powerpc/lib: Add helper to check if offset is within conditional branch range

2021-10-01 Thread Song Liu
On Fri, Oct 1, 2021 at 2:16 PM Naveen N. Rao wrote: > > Add a helper to check if a given offset is within the branch range for a > powerpc conditional branch instruction, and update some sites to use the > new helper. > > Signed-off-by: Naveen N. Rao Acked-by: Song Liu

Re: [PATCH 2/9] powerpc/bpf: Validate branch ranges

2021-10-01 Thread Song Liu
On Fri, Oct 1, 2021 at 2:16 PM Naveen N. Rao wrote: > > Add checks to ensure that we never emit branch instructions with > truncated branch offsets. > > Suggested-by: Michael Ellerman > Signed-off-by: Naveen N. Rao Acked-by: Song Liu > --- > arch/powerpc/n

Re: [PATCH 3/9] powerpc/bpf: Remove unused SEEN_STACK

2021-10-01 Thread Song Liu
On Fri, Oct 1, 2021 at 2:16 PM Naveen N. Rao wrote: > > From: Ravi Bangoria > > SEEN_STACK is unused on PowerPC. Remove it. Also, have > SEEN_TAILCALL use 0x4000. > > Signed-off-by: Ravi Bangoria > Reviewed-by: Christophe Leroy Acked-by: Song Liu > --- >

Re: [PATCH 6/9] powerpc/bpf: Fix BPF_SUB when imm == 0x80000000

2021-10-01 Thread Song Liu
On Fri, Oct 1, 2021 at 2:17 PM Naveen N. Rao wrote: > > We aren't handling subtraction involving an immediate value of > 0x8000 properly. Fix the same. > > Fixes: 156d0e290e969c ("powerpc/ebpf/jit: Implement JIT compiler for extended > BPF") > Signed-off-by:

Re: [PATCH 1/3] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3

2022-02-07 Thread Song Liu
Hi Paul, Sorry for the delayed reply. On Wed, Jan 26, 2022 at 3:42 AM Paul Menzel wrote: > > Buidling `raid6test` on Ubuntu 21.10 (ppc64le) with GNU Make 4.3 shows the > errors below: Please do not use `xxx` in the commit log (and subject). > > $ cd lib/raid6/test/ > $ make >

Re: [PATCH v2 1/2] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3

2022-02-08 Thread Song Liu
On Tue, Feb 8, 2022 at 7:22 AM Paul Menzel wrote: > > Buidling `raid6test` on Ubuntu 21.10 (ppc64le) with GNU Make 4.3 shows the > errors below: > > $ cd lib/raid6/test/ > $ make > :1:1: error: stray ‘\’ in program > :1:2: error: stray ‘#’ in program > :1:11: error: expected

Re: [PATCH v7 0/4] kexec: Fix kexec_file_load for llvm16 with PGO

2023-09-07 Thread Song Liu
Hi Ricardo and folks, On Fri, May 19, 2023 at 7:48 AM Ricardo Ribalda wrote: > > When upreving llvm I realised that kexec stopped working on my test > platform. > > The reason seems to be that due to PGO there are multiple .text sections > on the purgatory, and kexec does not supports that. > >

Re: [PATCH v7 0/4] kexec: Fix kexec_file_load for llvm16 with PGO

2023-09-08 Thread Song Liu
On Fri, Sep 8, 2023 at 2:52 PM Ricardo Ribalda wrote: > > Hi Song > > On Fri, 8 Sept 2023 at 23:48, Song Liu wrote: > > > > Hi Ricardo, > > > > Thanks for your kind reply. > > > > On Fri, Sep 8, 2023 at 2:18 PM Ricardo Ribalda wrote: > > &g

Re: [PATCH v7 0/4] kexec: Fix kexec_file_load for llvm16 with PGO

2023-09-08 Thread Song Liu
Hi Ricardo, Thanks for your kind reply. On Fri, Sep 8, 2023 at 2:18 PM Ricardo Ribalda wrote: > > Hi Song > > On Fri, 8 Sept 2023 at 01:08, Song Liu wrote: > > > > Hi Ricardo and folks, > > > > On Fri, May 19, 2023 at 7:48 AM Ricardo Ribalda > &g

Re: [PATCH v3 02/13] mm: introduce execmem_text_alloc() and execmem_free()

2023-09-23 Thread Song Liu
On Sat, Sep 23, 2023 at 8:39 AM Mike Rapoport wrote: > > On Thu, Sep 21, 2023 at 03:34:18PM -0700, Song Liu wrote: > > On Mon, Sep 18, 2023 at 12:30 AM Mike Rapoport wrote: > > > > > > > [...] > > > > > diff --git a/arch/s390/kernel/module.c b/ar

Re: [PATCH v3 02/13] mm: introduce execmem_text_alloc() and execmem_free()

2023-09-21 Thread Song Liu
On Mon, Sep 18, 2023 at 12:30 AM Mike Rapoport wrote: > [...] > + > +/** > + * enum execmem_type - types of executable memory ranges > + * > + * There are several subsystems that allocate executable memory. > + * Architectures define different restrictions on placement, > + * permissions,

Re: [PATCH v3 02/13] mm: introduce execmem_text_alloc() and execmem_free()

2023-09-21 Thread Song Liu
On Mon, Sep 18, 2023 at 12:30 AM Mike Rapoport wrote: > [...] > + > +#include > +#include > +#include > +#include > + > +static void *execmem_alloc(size_t size) > +{ > + return module_alloc(size); > +} > + > +void *execmem_text_alloc(enum execmem_type type, size_t size) > +{ > +

Re: [PATCH v3 09/13] powerpc: extend execmem_params for kprobes allocations

2023-09-21 Thread Song Liu
On Mon, Sep 18, 2023 at 12:31 AM Mike Rapoport wrote: > [...] > @@ -135,5 +138,13 @@ struct execmem_params __init *execmem_arch_params(void) > > range->pgprot = prot; > > + execmem_params.ranges[EXECMEM_KPROBES].start = VMALLOC_START; > +

Re: [PATCH v3 02/13] mm: introduce execmem_text_alloc() and execmem_free()

2023-09-21 Thread Song Liu
On Mon, Sep 18, 2023 at 12:30 AM Mike Rapoport wrote: > [...] > diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c > index 42215f9404af..db5561d0c233 100644 > --- a/arch/s390/kernel/module.c > +++ b/arch/s390/kernel/module.c > @@ -21,6 +21,7 @@ > #include > #include >

Re: [PATCH v3 06/13] mm/execmem: introduce execmem_data_alloc()

2023-09-21 Thread Song Liu
On Mon, Sep 18, 2023 at 12:31 AM Mike Rapoport wrote: > [...] > diff --git a/include/linux/execmem.h b/include/linux/execmem.h > index 519bdfdca595..09d45ac786e9 100644 > --- a/include/linux/execmem.h > +++ b/include/linux/execmem.h > @@ -29,6 +29,7 @@ > * @EXECMEM_KPROBES: parameters for

Re: [PATCH v3 06/13] mm/execmem: introduce execmem_data_alloc()

2023-09-22 Thread Song Liu
On Fri, Sep 22, 2023 at 12:17 AM Christophe Leroy wrote: > > > > Le 22/09/2023 à 00:52, Song Liu a écrit : > > On Mon, Sep 18, 2023 at 12:31 AM Mike Rapoport wrote: > >> > > [...] > >> diff --git a/include/linux/execmem.h b/include/linux/execmem.h &g

Re: [PATCH 13/15] raid: Remove now superfluous sentinel element from ctl_table array

2023-09-28 Thread Song Liu
= sizeof(int), > .mode = S_IRUGO|S_IWUSR, > .proc_handler = proc_dointvec, > - }, > - { } > + } > }; Please keep "}," as Greg suggested. Otherwise, Acked-by: Song Liu Thanks, Song

Re: [PATCH v5 3/5] powerpc/bpf: implement bpf_arch_text_invalidate for bpf_prog_pack

2023-09-28 Thread Song Liu
On Thu, Sep 28, 2023 at 12:49 PM Hari Bathini wrote: > > Implement bpf_arch_text_invalidate and use it to fill unused part of > the bpf_prog_pack with trap instructions when a BPF program is freed. > > Signed-off-by: Hari Bathini Acked-by: Song Liu

Re: [PATCH v5 1/5] powerpc/code-patching: introduce patch_instructions()

2023-09-28 Thread Song Liu
e more than one instruction needs to be patched. > > Signed-off-by: Hari Bathini Acked-by: Song Liu With a nit below. [...] > +/* > + * A page is mapped and instructions that fit the page are patched. > + * Assumes 'len' to be (PAGE_SIZE - offset_in_page(addr)) or below. > + */

Re: [PATCH v5 2/5] powerpc/bpf: implement bpf_arch_text_copy

2023-09-28 Thread Song Liu
On Thu, Sep 28, 2023 at 12:48 PM Hari Bathini wrote: > > bpf_arch_text_copy is used to dump JITed binary to RX page, allowing > multiple BPF programs to share the same page. Use the newly introduced > patch_instructions() to implement it. > > Signed-off-by: Hari Bathini Acked-by: Song Liu

Re: [PATCH v5 4/5] powerpc/bpf: rename powerpc64_jit_data to powerpc_jit_data

2023-09-28 Thread Song Liu
On Thu, Sep 28, 2023 at 12:48 PM Hari Bathini wrote: > > powerpc64_jit_data is a misnomer as it is meant for both ppc32 and > ppc64. Rename it to powerpc_jit_data. > > Signed-off-by: Hari Bathini Acked-by: Song Liu

Re: [PATCH v5 5/5] powerpc/bpf: use bpf_jit_binary_pack_[alloc|finalize|free]

2023-09-28 Thread Song Liu
gt; if necessary. As bpf_flush_icache() is not needed anymore, remove it. > > Signed-off-by: Hari Bathini Acked-by: Song Liu

Re: [PATCH v4 1/5] powerpc/bpf: implement bpf_arch_text_copy

2023-09-25 Thread Song Liu
On Fri, Sep 8, 2023 at 6:28 AM Hari Bathini wrote: > > bpf_arch_text_copy is used to dump JITed binary to RX page, allowing > multiple BPF programs to share the same page. Use patch_instruction() > to implement it. > > Signed-off-by: Hari Bathini > --- > arch/powerpc/net/bpf_jit_comp.c | 41

Re: [PATCH v4 3/5] powerpc/bpf: use bpf_jit_binary_pack_[alloc|finalize|free]

2023-09-25 Thread Song Liu
On Fri, Sep 8, 2023 at 6:28 AM Hari Bathini wrote: > > Use bpf_jit_binary_pack_alloc in powerpc jit. The jit engine first > writes the program to the rw buffer. When the jit is done, the program > is copied to the final location with bpf_jit_binary_pack_finalize. > With multiple jit_subprogs,

Re: [PATCH v4 4/5] powerpc/code-patching: introduce patch_instructions()

2023-09-25 Thread Song Liu
On Fri, Sep 8, 2023 at 6:28 AM Hari Bathini wrote: > > patch_instruction() entails setting up pte, patching the instruction, > clearing the pte and flushing the tlb. If multiple instructions need > to be patched, every instruction would have to go through the above > drill unnecessarily. Instead,

Re: [PATCH] kprobes: Enable tracing for mololithic kernel images

2022-06-10 Thread Song Liu
ot; Errors-To: linuxppc-dev-bounces+archive=mail-archive@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, Jun 9, 2022 at 1:34 AM Christophe Leroy wrote: > > > > Le 08/06/2022 à 18:12, Song Liu a écrit : > > On Wed, Jun 8, 2022 at 7:21 AM Masami Hiramatsu wrote: &g

Re: [PATCH] kprobes: Enable tracing for mololithic kernel images

2022-06-10 Thread Song Liu
k...@kernel.org" , "ebied...@xmission.com" , "aneesh.ku...@linux.ibm.com" , "bris...@redhat.com" , "wangkefeng.w...@huawei.com" , "ker...@esmil.dk" , "jniet...@gmail.com" , "paul.walms...@sifive.com" , "a...@kernel.org" , "w...@kernel.org" , "masahi...@kernel.org" , "Sakkinen, Jarkko" ,

Re: [PATCH] kprobes: Enable tracing for mololithic kernel images

2022-06-08 Thread Song Liu
rchive=mail-archive@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, Jun 8, 2022 at 9:12 AM Song Liu wrote: > > On Wed, Jun 8, 2022 at 7:21 AM Masami Hiramatsu wrote: > > > > Hi Jarkko, > > > > On Wed, 8 Jun 2022 08:25:38 +0300 > > Jarkko Sakk

Re: [PATCH] kprobes: Enable tracing for mololithic kernel images

2022-06-08 Thread Song Liu
masahi...@kernel.org>, Jarkko Sakkinen , Sami Tolvanen , "Naveen N. Rao" , Marco Elver , Kees Cook , Steven Rostedt , Nathan Chancellor , "Russell King \(Oracle\)" , Mark Brown , Borislav Petkov , Alexander Egorenkov , Thomas Bogendoerfer , Parisc List , Nathaniel McCallum , Dmitry

Re: [PATCH] kprobes: Enable tracing for mololithic kernel images

2022-06-08 Thread Song Liu
sahiro Yamada , Jarkko Sakkinen , Sami Tolvanen , "Naveen N. Rao" , Marco Elver , Kees Cook , Steven Rostedt , Nathan Chancellor , "Russell King \(Oracle\)" , Mark Brown , Borislav Petkov , Alexander Egorenkov , Thomas Bogendoerfer , linux-par...@vger.kernel.org, Nathaniel McCallum ,

[PATCH v5] livepatch: Clear relocation targets on a module removal

2022-08-30 Thread Song Liu
code a lot. We thus decided to reverse the relocation patching (clear all relocation targets on x86_64). The solution is not universal and is too much arch-specific, but it may prove to be simpler in the end. Reported-by: Josh Poimboeuf Signed-off-by: Miroslav Benes Signed-off-by: Song Liu

Re: [PATCH v5] livepatch: Clear relocation targets on a module removal

2022-09-01 Thread Song Liu
On Wed, Aug 31, 2022 at 7:05 PM Joe Lawrence wrote: > > On Wed, Aug 31, 2022 at 03:48:26PM -0700, Song Liu wrote: > > On Wed, Aug 31, 2022 at 3:30 PM Michael Ellerman > > wrote: > > > > > > Joe Lawrence writes: > > > > On Tue, Aug 30, 2022 at

[PATCH v6] livepatch: Clear relocation targets on a module removal

2022-09-01 Thread Song Liu
code a lot. We thus decided to reverse the relocation patching (clear all relocation targets on x86_64). The solution is not universal and is too much arch-specific, but it may prove to be simpler in the end. Reported-by: Josh Poimboeuf Signed-off-by: Miroslav Benes Signed-off-by: Song Liu

Re: [PATCH v5] livepatch: Clear relocation targets on a module removal

2022-08-31 Thread Song Liu
On Wed, Aug 31, 2022 at 1:01 AM Christophe Leroy wrote: > > > > Le 30/08/2022 à 20:53, Song Liu a écrit : > > From: Miroslav Benes > > > > Josh reported a bug: > > > >When the object to be patched is a module, and that module is >

Re: [PATCH v5] livepatch: Clear relocation targets on a module removal

2022-08-31 Thread Song Liu
On Wed, Aug 31, 2022 at 3:30 PM Michael Ellerman wrote: > > Joe Lawrence writes: > > On Tue, Aug 30, 2022 at 11:53:13AM -0700, Song Liu wrote: > >> From: Miroslav Benes > >> > >> Josh reported a bug: > >> > >> When the object to b

Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-12-09 Thread Song Liu
On Fri, Dec 9, 2022 at 10:52 AM Christophe Leroy wrote: > > > > Le 09/12/2022 à 19:30, Song Liu a écrit : > > On Fri, Dec 9, 2022 at 4:55 AM Miroslav Benes wrote: > >> > >> Hi, > >> > >> first thank you for taking over and I also appologize

Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-12-09 Thread Song Liu
On Fri, Dec 9, 2022 at 4:55 AM Miroslav Benes wrote: > > Hi, > > first thank you for taking over and I also appologize for not replying > much sooner. > > On Thu, 1 Sep 2022, Song Liu wrote: > > > From: Miroslav Benes > > > > Josh reported a bu

Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-12-09 Thread Song Liu
On Fri, Dec 9, 2022 at 5:54 AM Petr Mladek wrote: > > On Mon 2022-11-28 17:57:06, Song Liu wrote: > > On Fri, Nov 18, 2022 at 8:24 AM Petr Mladek wrote: > > > > --- a/kernel/livepatch/core.c > > > > +++ b/kernel/livepatch/core.c > > > > @@ -316,

Re: powerpc-part: was: Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-12-09 Thread Song Liu
support of livepatch symbols"). > > > On Mon 2022-11-28 17:57:06, Song Liu wrote: > > On Fri, Nov 18, 2022 at 8:24 AM Petr Mladek wrote: > > > > > > > --- a/arch/powerpc/kernel/module_64.c > > > > +++ b/arch/powerpc/kernel/module_64.c > >

Re: powerpc-part: was: Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-12-12 Thread Song Liu
On Mon, Dec 12, 2022 at 9:12 AM Petr Mladek wrote: > > On Fri 2022-12-09 11:59:35, Song Liu wrote: > > On Fri, Dec 9, 2022 at 3:41 AM Petr Mladek wrote: > > > On Mon 2022-11-28 17:57:06, Song Liu wrote: > > > > On Fri, Nov 18, 2022 at 8:24 AM Petr Mladek wrote:

Re: powerpc-part: was: Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-12-13 Thread Song Liu
support of livepatch symbols"). > > > On Mon 2022-11-28 17:57:06, Song Liu wrote: > > On Fri, Nov 18, 2022 at 8:24 AM Petr Mladek wrote: > > > > > > > --- a/arch/powerpc/kernel/module_64.c > > > > +++ b/arch/powerpc/kernel/module_64.c > >

Re: powerpc-part: was: Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-12-13 Thread Song Liu
)() ()On Mon, Dec 12, 2022 at 9:12 AM Petr Mladek wrote: > > On Fri 2022-12-09 11:59:35, Song Liu wrote: > > On Fri, Dec 9, 2022 at 3:41 AM Petr Mladek wrote: > > > On Mon 2022-11-28 17:57:06, Song Liu wrote: > > > > On Fri, Nov 18, 2

Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-12-13 Thread Song Liu
On Fri, Dec 9, 2022 at 4:55 AM Miroslav Benes wrote: > > Hi, > > first thank you for taking over and I also appologize for not replying > much sooner. > > On Thu, 1 Sep 2022, Song Liu wrote: > > > From: Miroslav Benes > > > > Josh reported a bu

Re: [RFC PATCH 0/3] enable bpf_prog_pack allocator for powerpc

2022-11-18 Thread Song Liu
On Fri, Nov 18, 2022 at 3:47 AM Christophe Leroy wrote: > > > > Le 18/11/2022 à 10:39, Hari Bathini a écrit : > > > > > > On 18/11/22 2:21 pm, Christophe Leroy wrote: > > > I had the same config but hit this problem: > > > ># echo 1 > /proc/sys/net/core/bpf_jit_enable;

Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-11-18 Thread Song Liu
Hi Petr, On Fri, Nov 18, 2022 at 8:24 AM Petr Mladek wrote: > > On Thu 2022-09-01 10:12:52, Song Liu wrote: [...] > > > > arch/powerpc/kernel/module_32.c | 10 > > arch/powerpc/kernel/module_64.c | 49 +++ > > arch/s390/kernel/module.c

Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-11-28 Thread Song Liu
On Fri, Nov 18, 2022 at 8:24 AM Petr Mladek wrote: > [...] > > > > +#ifdef CONFIG_LIVEPATCH > > +void clear_relocate_add(Elf64_Shdr *sechdrs, > > +const char *strtab, > > +unsigned int symindex, > > +unsigned int relsec, > > +

Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-11-21 Thread Song Liu
On Mon, Nov 21, 2022 at 8:32 AM Joe Lawrence wrote: > > On 11/18/22 12:14 PM, Song Liu wrote: > > Hi Petr, > > > > On Fri, Nov 18, 2022 at 8:24 AM Petr Mladek wrote: > >> > >> On Thu 2022-09-01 10:12:52, Song Liu wrote: > > [...] &g

Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-11-17 Thread Song Liu
Hi folks, It seems we forgot about this work... What shall we do to move forward? Thanks, Song On Thu, Sep 1, 2022 at 10:16 AM Song Liu wrote: > > From: Miroslav Benes > > Josh reported a bug: > > When the object to be patched is a module, and that module is >

Re: [PATCH 1/2] powerpc/module_64: Improve restore_r2() return semantics

2023-01-24 Thread Song Liu
On Tue, Jan 24, 2023 at 7:38 PM Josh Poimboeuf wrote: > > restore_r2() returns 1 on success, which is surprising for a non-boolean > function. Change it to return 0 on success and -errno on error to match > kernel coding convention. > > Signed-off-by: Josh Poimboeuf Acked-by: Song Liu

Re: [PATCH 2/2] powerpc/module_64: Fix "expected nop" error on module re-patching

2023-01-24 Thread Song Liu
On Tue, Jan 24, 2023 at 7:38 PM Josh Poimboeuf wrote: > > When a module with a livepatched function is unloaded and then reloaded, > klp attempts to dynamically re-patch it. On ppc64, that fails with the > following error: > > module_64: livepatch_nfsd: Expected nop after call, got e8410018 at

Re: [PATCH 2/2] powerpc/module_64: Fix "expected nop" error on module re-patching

2023-01-25 Thread Song Liu
On Wed, Jan 25, 2023 at 10:53 AM Josh Poimboeuf wrote: > > On Wed, Jan 25, 2023 at 09:36:02AM -0800, Song Liu wrote: > > On Wed, Jan 25, 2023 at 8:46 AM Josh Poimboeuf wrote: > > > > > > On Tue, Jan 24, 2023 at 10:09:56PM -0800, Song Liu wrote: > > &

Re: [PATCH 2/2] powerpc/module_64: Fix "expected nop" error on module re-patching

2023-01-25 Thread Song Liu
On Wed, Jan 25, 2023 at 8:46 AM Josh Poimboeuf wrote: > > On Tue, Jan 24, 2023 at 10:09:56PM -0800, Song Liu wrote: > > > @@ -514,9 +515,18 @@ static int restore_r2(const char *name, u32 > > > *instruction, struct module *me) > > > if (!instr_is_relativ

Re: [PATCH bpf-next v2 0/5] execmem_alloc for BPF programs

2022-11-09 Thread Song Liu
On Wed, Nov 9, 2022 at 1:24 PM Christophe Leroy wrote: > > + linuxppc-dev list as we start mentioning powerpc. > > Le 09/11/2022 à 18:43, Song Liu a écrit : > > On Wed, Nov 9, 2022 at 3:18 AM Mike Rapoport wrote: > >> > > [...] > > > >>>> >

Re: [PATCH v2 3/4] powerpc/bpf: implement bpf_arch_text_invalidate for bpf_prog_pack

2023-03-10 Thread Song Liu
On Thu, Mar 9, 2023 at 10:02 AM Hari Bathini wrote: > > Implement bpf_arch_text_invalidate and use it to fill unused part of > the bpf_prog_pack with trap instructions when a BPF program is freed. > > Signed-off-by: Hari Bathini > --- > arch/powerpc/net/bpf_jit_comp.c | 15 +++ > 1

Re: [PATCH v2 4/4] powerpc/bpf: use bpf_jit_binary_pack_[alloc|finalize|free]

2023-03-10 Thread Song Liu
On Thu, Mar 9, 2023 at 10:03 AM Hari Bathini wrote: > > Use bpf_jit_binary_pack_alloc in powerpc jit. The jit engine first > writes the program to the rw buffer. When the jit is done, the program > is copied to the final location with bpf_jit_binary_pack_finalize. > With multiple jit_subprogs,

Re: [PATCH v2 2/4] powerpc/bpf: implement bpf_arch_text_copy

2023-03-10 Thread Song Liu
On Thu, Mar 9, 2023 at 10:02 AM Hari Bathini wrote: > > bpf_arch_text_copy is used to dump JITed binary to RX page, allowing > multiple BPF programs to share the same page. Use the newly introduced > patch_instructions() to implement it. Around 5X improvement in speed > of execution observed,

Re: [PATCH 12/13] x86/jitalloc: prepare to allocate exectuatble memory as ROX

2023-06-01 Thread Song Liu
On Thu, Jun 1, 2023 at 4:07 AM Mike Rapoport wrote: > > On Thu, Jun 01, 2023 at 12:30:50PM +0200, Peter Zijlstra wrote: > > On Thu, Jun 01, 2023 at 01:12:56PM +0300, Mike Rapoport wrote: > > > > > +static void __init_or_module do_text_poke(void *addr, const void > > > *opcode, size_t len) > > >

Re: [PATCH 04/13] mm/jitalloc, arch: convert remaining overrides of module_alloc to jitalloc

2023-06-01 Thread Song Liu
On Thu, Jun 1, 2023 at 3:13 AM Mike Rapoport wrote: > > From: "Mike Rapoport (IBM)" > > Extend jitalloc parameters to accommodate more complex overrides of > module_alloc() by architectures. > > This includes specification of a fallback range required by arm, arm64 > and powerpc and support for

Re: [PATCH 00/13] mm: jit/text allocator

2023-06-01 Thread Song Liu
On Thu, Jun 1, 2023 at 3:13 AM Mike Rapoport wrote: > > From: "Mike Rapoport (IBM)" > > Hi, > > module_alloc() is used everywhere as a mean to allocate memory for code. > > Beside being semantically wrong, this unnecessarily ties all subsystmes > that need to allocate code, such as ftrace,

Re: [PATCH 12/13] x86/jitalloc: prepare to allocate exectuatble memory as ROX

2023-06-01 Thread Song Liu
On Thu, Jun 1, 2023 at 3:15 AM Mike Rapoport wrote: > > From: Song Liu > > Replace direct memory writes to memory allocated for code with text poking > to allow allocation of executable memory as ROX. > > The only exception is arch_prepare_bpf_trampoline() that cannot jit &

Re: [PATCH 00/13] mm: jit/text allocator

2023-06-02 Thread Song Liu
On Fri, Jun 2, 2023 at 2:35 AM Mark Rutland wrote: > > On Thu, Jun 01, 2023 at 02:14:56PM -0400, Kent Overstreet wrote: > > On Thu, Jun 01, 2023 at 05:12:03PM +0100, Mark Rutland wrote: > > > For a while I have wanted to give kprobes its own allocator so that it > > > can work > > > even with

Re: [PATCH 00/13] mm: jit/text allocator

2023-06-04 Thread Song Liu
On Sun, Jun 4, 2023 at 11:02 AM Kent Overstreet wrote: > > On Fri, Jun 02, 2023 at 11:20:58AM -0700, Song Liu wrote: > > IIUC, arm64 uses VMALLOC address space for BPF programs. The reason > > is each BPF program uses at least 64kB (one page) out of the 128MB > > addre

Re: [PATCH 00/13] mm: jit/text allocator

2023-06-04 Thread Song Liu
On Sun, Jun 4, 2023 at 2:40 PM Kent Overstreet wrote: > > On Sun, Jun 04, 2023 at 02:22:30PM -0700, Song Liu wrote: > > On Sun, Jun 4, 2023 at 11:02 AM Kent Overstreet > > wrote: > > > > > > On Fri, Jun 02, 2023 at 11:20:58AM -0700, Song Liu wrote: > >

Re: [PATCH 00/13] mm: jit/text allocator

2023-06-06 Thread Song Liu
On Mon, Jun 5, 2023 at 3:09 AM Mark Rutland wrote: [...] > > > > Can you give more detail on what parameters you need? If the only extra > > > > parameter is just "does this allocation need to live close to kernel > > > > text", that's not that big of a deal. > > > > > > My thinking was that we

Re: [PATCH 00/13] mm: jit/text allocator

2023-06-09 Thread Song Liu
On Thu, Jun 8, 2023 at 11:41 AM Mike Rapoport wrote: > > On Tue, Jun 06, 2023 at 11:21:59AM -0700, Song Liu wrote: > > On Mon, Jun 5, 2023 at 3:09 AM Mark Rutland wrote: > > > > [...] > > > > > > > > Can you give more detail on what par

Re: [PATCH v2 02/12] mm: introduce execmem_text_alloc() and jit_text_alloc()

2023-06-26 Thread Song Liu
On Sun, Jun 25, 2023 at 11:07 AM Kent Overstreet wrote: > > On Sun, Jun 25, 2023 at 08:42:57PM +0300, Mike Rapoport wrote: > > On Sun, Jun 25, 2023 at 09:59:34AM -0700, Andy Lutomirski wrote: > > > > > > > > > On Sun, Jun 25, 2023, at 9:14 AM, Mike Rapoport wrote: > > > > On Mon, Jun 19, 2023 at

Re: [PATCH v2 02/12] mm: introduce execmem_text_alloc() and jit_text_alloc()

2023-06-26 Thread Song Liu
On Mon, Jun 26, 2023 at 5:31 AM Mark Rutland wrote: > [...] > > > > So the idea was that jit_text_alloc() will have a cache of large pages > > mapped ROX, will allocate memory from those caches and there will be > > jit_update() that uses text poking for writing to that memory. > > > > Upon

Re: [PATCH v2 04/12] mm/execmem, arch: convert remaining overrides of module_alloc to execmem

2023-06-16 Thread Song Liu
On Fri, Jun 16, 2023 at 1:51 AM Mike Rapoport wrote: [...] > diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c > index 5af4975caeb5..c3d999f3a3dd 100644 > --- a/arch/arm64/kernel/module.c > +++ b/arch/arm64/kernel/module.c > @@ -17,56 +17,50 @@ > #include > #include >

Re: [PATCH v2 02/12] mm: introduce execmem_text_alloc() and jit_text_alloc()

2023-06-16 Thread Song Liu
> execmem_text_alloc(). > > > > The names execmem_text_alloc() and jit_text_alloc() emphasize that the > > allocated memory is for executable code, the allocations of the > > associated data, like data sections of a module will use > > execmem_data_alloc() interface that will be added later. > > I like the API split - at the risk of further bikeshedding, perhaps > near_text_alloc() and far_text_alloc()? Would be more explicit. > > Reviewed-by: Kent Overstreet Acked-by: Song Liu

Re: [PATCH v2 07/12] arm64, execmem: extend execmem_params for generated code definitions

2023-06-16 Thread Song Liu
5 when we split data into rw data, ro data, ro after init data. I wonder whether we should still do some type enum here. But we can revisit this topic later. Other than that Acked-by: Song Liu

Re: [PATCH v2 01/12] nios2: define virtual address space for modules

2023-06-16 Thread Song Liu
d switch nios2 to > use vmalloc for module allocations. > > Suggested-by: Thomas Gleixner > Signed-off-by: Mike Rapoport (IBM) > Acked-by: Dinh Nguyen Acked-by: Song Liu > --- > arch/nios2/include/asm/pgtable.h | 5 - > arch/nios2/kernel/module.c | 19

Re: [PATCH v2 03/12] mm/execmem, arch: convert simple overrides of module_alloc to execmem

2023-06-16 Thread Song Liu
ons of a module will use execmem_data_alloc() interface that will > be added later. > > Signed-off-by: Mike Rapoport (IBM) Acked-by: Song Liu

Re: [PATCH v2 05/12] modules, execmem: drop module_alloc

2023-06-16 Thread Song Liu
hitecure does not supply its specific > parameters. > > With this, execmem_text_alloc() implements memory allocation in a way > compatible with module_alloc() and can be used as a replacement for > module_alloc(). > > Signed-off-by: Mike Rapoport (IBM) Acked-by: Song

Re: [PATCH v2 09/12] powerpc: extend execmem_params for kprobes allocations

2023-06-16 Thread Song Liu
low using the generic > kprobes::alloc_insn_page() with the desired permissions. > > As powerpc uses breakpoint instructions to inject kprobes, it does not > need to constrain kprobe allocations to the modules area and can use the > entire vmalloc address space. > > Signed-off-by: Mike

Re: [PATCH v2 08/12] riscv: extend execmem_params for kprobes allocations

2023-06-16 Thread Song Liu
itialization to support both 32 and 64 > bit variantsi and add definition of jit area to execmem_params to support > generic kprobes::alloc_insn_page(). > > Signed-off-by: Mike Rapoport (IBM) Acked-by: Song Liu > --- > arch/riscv/kernel/module.c | 16 ++

Re: [PATCH v2 11/12] x86/ftrace: enable dynamic ftrace without CONFIG_MODULES

2023-06-16 Thread Song Liu
loc() is > available regardless of CONFIG_MODULES. > > Remove dependency of dynamic ftrace on CONFIG_MODULES and make > CONFIG_DYNAMIC_FTRACE select CONFIG_EXECMEM in Kconfig. > > Signed-off-by: Mike Rapoport (IBM) Acked-by: Song Liu > --- > arch/x86/Kconfig | 1 + > arch

Re: [PATCH v2 10/12] arch: make execmem setup available regardless of CONFIG_MODULES

2023-06-16 Thread Song Liu
(); Aha, this addresses my comment on the earlier patch. Thanks! Acked-by: Song Liu > + > + module_alloc_end = module_alloc_base + MODULES_VSIZE; > + > + execmem_params.modules.text.pgprot = PAGE_KERNEL; > + execmem_params.modules.text.start =

Re: [PATCH v2 06/12] mm/execmem: introduce execmem_data_alloc()

2023-06-16 Thread Song Liu
On Fri, Jun 16, 2023 at 1:51 AM Mike Rapoport wrote: > > From: "Mike Rapoport (IBM)" > > Data related to code allocations, such as module data section, need to > comply with architecture constraints for its placement and its > allocation right now was done using execmem_text_alloc(). > > Create

Re: [PATCH v2 07/12] arm64, execmem: extend execmem_params for generated code definitions

2023-06-17 Thread Song Liu
On Sat, Jun 17, 2023 at 8:37 AM Kent Overstreet wrote: > > On Sat, Jun 17, 2023 at 09:57:59AM +0300, Mike Rapoport wrote: > > > This is growing fast. :) We have 3 now: text, data, jit. And it will be > > > 5 when we split data into rw data, ro data, ro after init data. I wonder > > > whether we

Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free()

2024-04-17 Thread Song Liu
On Tue, Apr 16, 2024 at 12:23 AM Mike Rapoport wrote: > > On Mon, Apr 15, 2024 at 06:36:39PM +0100, Mark Rutland wrote: > > On Mon, Apr 15, 2024 at 09:52:41AM +0200, Peter Zijlstra wrote: > > > On Thu, Apr 11, 2024 at 07:00:41PM +0300, Mike Rapoport wrote: > > > > +/** > > > > + * enum

Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free()

2024-04-19 Thread Song Liu
On Fri, Apr 19, 2024 at 10:03 AM Mike Rapoport wrote: [...] > > > > > > [1] https://lore.kernel.org/all/20240411160526.2093408-1-r...@kernel.org > > > > For the ROX to work, we need different users (module text, kprobe, etc.) to > > have > > the same execmem_range. From [1]: > > > > static void

Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free()

2024-04-19 Thread Song Liu
On Fri, Apr 19, 2024 at 1:00 PM Mike Rapoport wrote: > > On Fri, Apr 19, 2024 at 10:32:39AM -0700, Song Liu wrote: > > On Fri, Apr 19, 2024 at 10:03 AM Mike Rapoport wrote: > > [...] > > > > > > > > > > [1] > > > > > https

Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free()

2024-04-18 Thread Song Liu
On Thu, Apr 18, 2024 at 8:37 AM Mike Rapoport wrote: > [...] > > > > Is +/- 2G enough for all realistic use cases? If so, I guess we don't > > really need > > EXECMEM_ANYWHERE below? > > > > > > > > > > * I'm not sure about BPF's requirements; it seems happy doing the same > > > > as > > > >

Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free()

2024-04-18 Thread Song Liu
On Thu, Apr 18, 2024 at 10:54 AM Mike Rapoport wrote: > > On Thu, Apr 18, 2024 at 09:13:27AM -0700, Song Liu wrote: > > On Thu, Apr 18, 2024 at 8:37 AM Mike Rapoport wrote: > > > > > > > > > > I'm looking at execmem_types more as definition of the cons

Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free()

2024-04-22 Thread Song Liu
Hi Masami and Mike, On Sat, Apr 20, 2024 at 2:11 AM Masami Hiramatsu wrote: [...] > > > > > > IIUC, we need to update __execmem_cache_alloc() to take a range pointer as > > > input. module text will use "range" for EXECMEM_MODULE_TEXT, while kprobe > > > will use "range" for EXECMEM_KPROBE.

Re: [PATCH v6 05/16] module: make module_memory_{alloc,free} more self-contained

2024-04-26 Thread Song Liu
On Fri, Apr 26, 2024 at 1:30 AM Mike Rapoport wrote: > > From: "Mike Rapoport (IBM)" > > Move the logic related to the memory allocation and freeing into > module_memory_alloc() and module_memory_free(). > > Signed-off-by: Mike Rapoport (IBM) Acked-by: Song Liu

Re: [PATCH v6 07/16] mm/execmem, arch: convert simple overrides of module_alloc to execmem

2024-04-26 Thread Song Liu
ture does > not implement execmem_arch_setup(), execmem_alloc() will fall back to > module_alloc(). > > Signed-off-by: Mike Rapoport (IBM) Acked-by: Song Liu

Re: [PATCH v6 08/16] mm/execmem, arch: convert remaining overrides of module_alloc to execmem

2024-04-26 Thread Song Liu
g > warnings when the initial allocation fails but there is a fallback range > defined. > > Signed-off-by: Mike Rapoport (IBM) > Acked-by: Will Deacon nit: We should probably move the logic for ARCH_WANTS_EXECMEM_LATE to a separate patch. Otherwise, Acked-by: Song Liu

Re: [PATCH v6 06/16] mm: introduce execmem_alloc() and execmem_free()

2024-04-26 Thread Song Liu
will be used to identify the calling subsystem and to > allow architectures define parameters for ranges suitable for that > subsystem. > > No functional changes. > > Signed-off-by: Mike Rapoport (IBM) > Acked-by: Masami Hiramatsu (Google) Acked-by: Song Liu

Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free()

2024-04-19 Thread Song Liu
On Thu, Apr 18, 2024 at 11:56 PM Mike Rapoport wrote: > > On Thu, Apr 18, 2024 at 02:01:22PM -0700, Song Liu wrote: > > On Thu, Apr 18, 2024 at 10:54 AM Mike Rapoport wrote: > > > > > > On Thu, Apr 18, 2024 at 09:13:27AM -0700, Song Liu wrote: > > >