
From: Miguel Ojeda <ojeda@kernel.org> maillist inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5J75G CVE: NA Reference: https://lore.kernel.org/rust-for-linux/CANiq72nDcJLSB3pLhkdqGdLitfmqqCUVVfkY... -------------------------------- The `%pA` format specifier is only intended to be used from Rust. `checkpatch.pl` already gives a warning for invalid specificers: WARNING: Invalid vsprintf pointer extension '%pA' With this change, we introduce an error message with further explanation: ERROR: '%pA' is only intended to be used from Rust code Suggested-by: Kees Cook <keescook@chromium.org> Co-developed-by: Alex Gaynor <alex.gaynor@gmail.com> Signed-off-by: Alex Gaynor <alex.gaynor@gmail.com> Co-developed-by: Wedson Almeida Filho <wedsonaf@google.com> Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com> Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Weilong Chen <chenweilong@huawei.com> --- scripts/checkpatch.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 0ad235ee96f9..0fcfb21cca0d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -6312,6 +6312,10 @@ sub process { my $stat_real = get_stat_real($linenr, $lc); my $ext_type = "Invalid"; my $use = ""; + if ($bad_specifier =~ /pA/) { + ERROR("VSPRINTF_RUST", + "'\%pA' is only intended to be used from Rust code\n" . "$here\n$stat_real\n"); + } if ($bad_specifier =~ /p[Ff]/) { $use = " - use %pS instead"; $use =~ s/pS/ps/ if ($bad_specifier =~ /pf/); -- 2.20.1