On 2022-05-05 13:26:41 [-0500], Eric W. Biederman wrote:
> After ptrace_freeze_traced succeeds it is known that the the tracee
the
> has a __state value of __TASK_TRACED and that no __ptrace_unlink will
> happen because the tracer is waiting f
On Thu, May 05, 2022 at 04:22:44PM +0900 Masahiro Yamada wrote:
> Like built-in.a, the command length of the *.mod rule scales with
> the depth of the directory times the number of objects in the Makefile.
>
> Add $(obj)/ by the shell command (awk) instead of by Make's builtin
> function.
>
> In-
On Thu, May 05, 2022 at 04:22:43PM +0900 Masahiro Yamada wrote:
> Kbuild runs at the top of objtree instead of changing the working
> directory to subdirectories. I think this design is nice overall but
> some commands have a scapability issue.
>
> The build command of built-in.a is one of them wh
On Thu, May 05, 2022 at 04:22:41PM +0900 Masahiro Yamada wrote:
> ->is_static is set to true at allocation, then to false if the symbol
> comes from the dump file.
>
> It is simpler to use !mod->from_dump as the init value.
>
> Signed-off-by: Masahiro Yamada
> ---
>
> (no changes since v2)
>
>
On Thu, May 05, 2022 at 04:22:39PM +0900 Masahiro Yamada wrote:
> Make genksyms output symbol versions in the format modpost expects,
> so the 'sed' is unneeded.
>
> This commit makes *.symversions completely unneeded.
>
> I will keep *.symversions in .gitignore and 'make clean' for a while.
> Ot
On Thu, May 05, 2022 at 04:22:38PM +0900 Masahiro Yamada wrote:
> Now modpost reads symbol versions from .*.cmd files.
>
> These merged *.symversions are not used any more.
>
> Signed-off-by: Masahiro Yamada
> ---
>
> (no changes since v1)
>
> scripts/Makefile.build | 21 ++--
On Thu, May 05, 2022 at 04:22:36PM +0900 Masahiro Yamada wrote:
> Currently, CONFIG_MODVERSIONS needs extra link to embed the symbol
> versions into ELF objects. Then, modpost extracts the version CRCs
> from them.
>
> The following figures show how it currently works, and how I am trying
> to cha
On Thu, May 05, 2022 at 04:22:33PM +0900 Masahiro Yamada wrote:
> A later commit will add more code to this list_for_each_entry loop.
>
> Before that, move the loop body into a separate helper function.
>
> Signed-off-by: Masahiro Yamada
> ---
>
> Changes in v3:
> - New patch
>
> scripts/mo
On Thu, May 05, 2022 at 04:22:32PM +0900 Masahiro Yamada wrote:
> add_intree_flag(), add_retpoline(), and add_staging_flag() are small
> enough to be merged into add_header().
>
> Signed-off-by: Masahiro Yamada
> ---
>
> Changes in v3:
> - New patch
>
> scripts/mod/modpost.c | 25 +++
On Thu, May 05, 2022 at 10:48:55PM +0900 Masahiro Yamada wrote:
> On Thu, May 5, 2022 at 4:24 PM Masahiro Yamada wrote:
> >
> > Currently, enum export is tristate, but export_unknown does not make
> > sense in any way.
> >
> > If the symbol name starts with "__ksymtab_", but the section name
> > d
On 05/05/2022 15:55, Hari Bathini wrote:
> [...]
>
> The change looks good. I have tested it on an LPAR (ppc64).
>
> Reviewed-by: Hari Bathini
Thanks a bunch Hari, much appreciated!
___
linux-um mailing list
linux-um@lists.infradead.org
http://lists
On Thu, May 05, 2022 at 04:22:30PM +0900 Masahiro Yamada wrote:
> The 'static' specifier and EXPORT_SYMBOL() are an odd combination.
>
> Since commit 15bfc2348d54 ("modpost: check for static EXPORT_SYMBOL*
> functions"), modpost tries to detect it, but there are false negatives.
>
> Here is the s
On 28/04/22 4:19 am, Guilherme G. Piccoli wrote:
The panic notifiers infrastructure is a bit limited in the scope of
the callbacks - basically every kind of functionality is dropped
in a list that runs in the same point during the kernel panic path.
This is not really on par with the complexiti
From: Peter Zijlstra
Currently ptrace_stop() / do_signal_stop() rely on the special states
TASK_TRACED and TASK_STOPPED resp. to keep unique state. That is, this
state exists only in task->__state and nowhere else.
There's two spots of bother with this:
- PREEMPT_RT has task->saved_state which
Make code analysis simpler and future changes easier by
always taking siglock in ptrace_resume.
Signed-off-by: "Eric W. Biederman"
---
kernel/ptrace.c | 13 ++---
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 83ed28262708..36a5b7a0
Stop playing with tsk->__state to remove TASK_WAKEKILL while a ptrace
command is executing.
Instead remove TASK_WAKEKILL from the definition of TASK_TRACED, and
implement a new jobctl flag TASK_PTRACE_FROZEN. This new flag is set
in jobctl_freeze_task and cleared when ptrace_stop is awoken or in
Long ago and far away there was a BUG_ON at the start of ptrace_stop
that did "BUG_ON(!(current->ptrace & PT_PTRACED));" [1]. The BUG_ON
had never triggered but examination of the code showed that the BUG_ON
could actually trigger. To complement removing the BUG_ON an attempt
to better handle the
After ptrace_freeze_traced succeeds it is known that the the tracee
has a __state value of __TASK_TRACED and that no __ptrace_unlink will
happen because the tracer is waiting for the tracee, and the tracee is
in ptrace_stop.
The function ptrace_freeze_traced can succeed at any point after
ptrace_s
The current implementation of PTRACE_KILL is buggy and has been for
many years as it assumes it's target has stopped in ptrace_stop. At a
quick skim it looks like this assumption has existed since ptrace
support was added in linux v1.0.
While PTRACE_KILL has been deprecated we can not remove it a
The distinction is that assert_spin_locked() checks if the lock is
held *by*anyone* whereas lockdep_assert_held() asserts the current
context holds the lock. Also, the check goes away if you build
without lockdep.
Suggested-by: Peter Zijlstra
Link:
https://lkml.kernel.org/r/Ympr/+PX4XgT/u...@hi
The last remaining implementation of arch_ptrace_attach is ia64's
ptrace_attach_sync_user_rbs which was added at the end of 2007 in
commit aa91a2e90044 ("[IA64] Synchronize RBS on PTRACE_ATTACH").
Reading the comments and examining the code ptrace_attach_sync_user_rbs
has the sole purpose of savin
xtensa is the last user of the PT_SINGLESTEP flag. Changing tsk->ptrace in
user_enable_single_step and user_disable_single_step without locking could
potentiallly cause problems.
So use a thread info flag instead of a flag in tsk->ptrace. Use TIF_SINGLESTEP
that xtensa already had defined but un
User mode linux is the last user of the PT_DTRACE flag. Using the flag to
indicate
single stepping is a little confusing and worse changing tsk->ptrace without
locking
could potentionally cause problems.
So use a thread info flag with a better name instead of flag in tsk->ptrace.
Remove the de
Rename send_signal and __send_signal to send_signal_locked and
__send_signal_locked to make send_signal usable outside of
signal.c.
Signed-off-by: "Eric W. Biederman"
---
include/linux/signal.h | 2 ++
kernel/signal.c| 24
2 files changed, 14 insertions(+), 12 d
The function __group_send_sig_info is just a light wrapper around
send_signal_locked with one parameter fixed to a constant value. As
the wrapper adds no real value update the code to directly call the
wrapped function.
Signed-off-by: "Eric W. Biederman"
---
drivers/tty/tty_jobctrl.c | 4 +
The states TASK_STOPPED and TASK_TRACE are special in they can not
handle spurious wake-ups. This plus actively depending upon and
changing the value of tsk->__state causes problems for PREEMPT_RT and
Peter's freezer rewrite.
There are a lot of details we have to get right to sort out the
techn
On 05/05, Eric W. Biederman wrote:
>
> So I vote for deleting code, and making ptrace_stop easier to reason
> about.
Yes, yes, agreed.
Oleg.
___
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
Oleg Nesterov writes:
> On 05/04, Eric W. Biederman wrote:
>>
>> -static int ptrace_stop(int exit_code, int why, int clear_code,
>> -unsigned long message, kernel_siginfo_t *info)
>> +static int ptrace_stop(int exit_code, int why, unsigned long message,
>> +
On 05/05, Eric W. Biederman wrote:
>
> And yes that WARN_ON_ONCE can trigger on PREEMPT_RT but that is just
> because PREMPT_RT is currently broken with respect to ptrace. Which
> makes a WARN_ON_ONCE appropriate.
Yes agreed. In this case WARN_ON_ONCE() can help a user to understand
that a failur
Oleg Nesterov writes:
> On 05/04, Eric W. Biederman wrote:
>>
>> With the removal of the incomplete detection of the tracer going away
>> in ptrace_stop, ptrace_stop always sleeps in schedule after
>> ptrace_freeze_traced succeeds. Modify ptrace_check_attach to
>> warn if wait_task_inactive fail
Oleg Nesterov writes:
> On 05/04, Eric W. Biederman wrote:
>>
>> -static int ptrace_stop(int exit_code, int why, int clear_code,
>> -unsigned long message, kernel_siginfo_t *info)
>> +static int ptrace_stop(int exit_code, int why, unsigned long message,
>> +
On Thu, May 5, 2022 at 4:24 PM Masahiro Yamada wrote:
>
>
> This is the third batch of cleanups in this development cycle.
This series is available at:
git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
lto-cleanup-v3
--
Best Regards
Masahiro Yamada
__
Sebastian Andrzej Siewior writes:
> On 2022-05-04 17:40:56 [-0500], Eric W. Biederman wrote:
>> Stop playing with tsk->__state to remove TASK_WAKEKILL while a ptrace
>> command is executing.
>>
>> Instead remove TASK_WAKEKILL from the definition of TASK_TRACED, and
>> implemention a new jobctl f
On 05/04, Eric W. Biederman wrote:
>
> -static int ptrace_stop(int exit_code, int why, int clear_code,
> - unsigned long message, kernel_siginfo_t *info)
> +static int ptrace_stop(int exit_code, int why, unsigned long message,
> +kernel_siginfo_t *info)
Forg
On 05/04, Eric W. Biederman wrote:
>
> With the removal of the incomplete detection of the tracer going away
> in ptrace_stop, ptrace_stop always sleeps in schedule after
> ptrace_freeze_traced succeeds. Modify ptrace_check_attach to
> warn if wait_task_inactive fails.
Oh. Again, I don't understa
On 05/04, Eric W. Biederman wrote:
>
> -static int ptrace_stop(int exit_code, int why, int clear_code,
> - unsigned long message, kernel_siginfo_t *info)
> +static int ptrace_stop(int exit_code, int why, unsigned long message,
> +kernel_siginfo_t *info)
>
On Thu, May 5, 2022 at 4:24 PM Masahiro Yamada wrote:
>
> Currently, enum export is tristate, but export_unknown does not make
> sense in any way.
>
> If the symbol name starts with "__ksymtab_", but the section name
> does not start with "___ksymtab+" or "___ksymtab_gpl+", it is not
> an exported
On 2022-05-04 17:40:56 [-0500], Eric W. Biederman wrote:
> Stop playing with tsk->__state to remove TASK_WAKEKILL while a ptrace
> command is executing.
>
> Instead remove TASK_WAKEKILL from the definition of TASK_TRACED, and
> implemention a new jobctl flag TASK_PTRACE_FROZEN. This new flag is
i
include/{linux,asm-generic}/export.h defines a weak symbol, __crc_*
as a placeholder.
Genksyms writes the version CRCs into the linker script, which will be
used for filling the __crc_* symbols. The linker script format depends
on CONFIG_MODULE_REL_CRCS. If it is enabled, __crc_* holds the offset
Like built-in.a, the command length of the *.mod rule scales with
the depth of the directory times the number of objects in the Makefile.
Add $(obj)/ by the shell command (awk) instead of by Make's builtin
function.
In-tree modules still have some room to the limit (ARG_MAX=2097152),
but this is
Now modpost reads symbol versions from .*.cmd files.
These merged *.symversions are not used any more.
Signed-off-by: Masahiro Yamada
---
(no changes since v1)
scripts/Makefile.build | 21 ++---
scripts/link-vmlinux.sh | 15 ---
2 files changed, 2 insertions(+), 3
Import hlist macros from include/linux/list.h to implement the hash
table in a more generic way.
While I was here, I increased the hash table size from 1024 to 8192
to decrease the hash collision.
I moved ARRAY_SIZE() from file2alias.c to modpost.h because it is needed
in modpost.c as well.
Sign
Currently, CONFIG_MODVERSIONS needs extra link to embed the symbol
versions into ELF objects. Then, modpost extracts the version CRCs
from them.
The following figures show how it currently works, and how I am trying
to change it.
Current implementation
==
Kbuild runs at the top of objtree instead of changing the working
directory to subdirectories. I think this design is nice overall but
some commands have a scapability issue.
The build command of built-in.a is one of them whose length scales with:
O(D * N)
Here, D is the length of the direct
When CONFIG_LTO_CLANG=y, additional intermediate *.prelink.o is created
for each module. Also, objtool is postponed until LLVM bitcode is
converted to ELF.
CONFIG_X86_KERNEL_IBT works in a similar way to postpone objtool until
objects are merged together.
This commit stops generating *.prelink.o,
->is_static is set to true at allocation, then to false if the symbol
comes from the dump file.
It is simpler to use !mod->from_dump as the init value.
Signed-off-by: Masahiro Yamada
---
(no changes since v2)
Changes in v2:
- New patch
scripts/mod/modpost.c | 4 ++--
1 file changed, 2 inse
Currently, enum export is tristate, but export_unknown does not make
sense in any way.
If the symbol name starts with "__ksymtab_", but the section name
does not start with "___ksymtab+" or "___ksymtab_gpl+", it is not
an exported symbol. The variable name just happens to start with
"__ksymtab_".
Make genksyms output symbol versions in the format modpost expects,
so the 'sed' is unneeded.
This commit makes *.symversions completely unneeded.
I will keep *.symversions in .gitignore and 'make clean' for a while.
Otherwise, some people might be upset with 'git status'.
Signed-off-by: Masahir
When CONFIG_MODVERSIONS=y, the output from genksyms is saved in
separate *.symversions files, and will be used much later when
CONFIG_LTO_CLANG=y because it is impossible to update LLVM bit code
here.
This approach is not robust because:
- *.symversions may or may not exist. If *.symversions doe
A later commit will add more code to this list_for_each_entry loop.
Before that, move the loop body into a separate helper function.
Signed-off-by: Masahiro Yamada
---
Changes in v3:
- New patch
scripts/mod/modpost.c | 56 ---
1 file changed, 31 inser
The 'static' specifier and EXPORT_SYMBOL() are an odd combination.
Since commit 15bfc2348d54 ("modpost: check for static EXPORT_SYMBOL*
functions"), modpost tries to detect it, but there are false negatives.
Here is the sample code.
[Sample 1]
Makefile:
obj-m += mymod1.o mymod2.o
mymo
This is the third batch of cleanups in this development cycle.
Major changes in v3:
- Generate symbol CRCs as C code, and remove CONFIG_MODULE_REL_CRCS.
Major changes in v2:
- V1 did not work with CONFIG_MODULE_REL_CRCS.
I fixed this for v2.
- Reflect some review comments in v1
- Ref
add_intree_flag(), add_retpoline(), and add_staging_flag() are small
enough to be merged into add_header().
Signed-off-by: Masahiro Yamada
---
Changes in v3:
- New patch
scripts/mod/modpost.c | 25 +++--
1 file changed, 7 insertions(+), 18 deletions(-)
diff --git a/scrip
A *.mod file lists the member objects of a module, but vmlinux does
not have such a file to list out all the member objects.
Generate this list to allow modpost to know all the member objects.
Signed-off-by: Masahiro Yamada
Reviewed-by: Nicolas Schier
---
(no changes since v2)
Changes in v2:
54 matches
Mail list logo