From: Robin Murphy <robin.murphy@arm.com>
To: Christoffer Dall <christoffer.dall@linaro.org>,
Maninder Singh <maninder1.s@samsung.com>
Cc: mark.rutland@arm.com, wangkefeng.wang@huawei.com,
kvm@vger.kernel.org, rkrcmar@redhat.com, catalin.marinas@arm.com,
will.deacon@arm.com, kvmarm@lists.cs.columbia.edu,
panand@redhat.com, cpgs@samsung.com, shijie.huang@arm.com,
labbott@redhat.com, Vaneet Narang <v.narang@samsung.com>,
cmetcalf@mellanox.com, marc.zyngier@arm.com, ajeet.y@samsung.com,
sandeepa.s.prabhu@gmail.com,
linux-arm-kernel@lists.infradead.org, pankaj.m@samsung.com,
ard.biesheuvel@linaro.org, linux-kernel@vger.kernel.org,
james.morse@arm.com, pbonzini@redhat.com,
akpm@linux-foundation.org
Subject: Re: [PATCH 1/1] arm64: Correcting format specifier for printing 64 bit addresses
Date: Tue, 6 Dec 2016 16:32:18 +0000 [thread overview]
Message-ID: <dbf5af31-2a36-5216-4544-13ade6dddd3a@arm.com> (raw)
In-Reply-To: <20161206161116.GD4816@cbox>
On 06/12/16 16:11, Christoffer Dall wrote:
> On Mon, Dec 05, 2016 at 01:39:53PM +0530, Maninder Singh wrote:
>> This patch corrects format specifier for printing 64 bit addresses.
>>
>> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
>> Signed-off-by: Vaneet Narang <v.narang@samsung.com>
>> ---
>> arch/arm64/kernel/signal.c | 2 +-
>> arch/arm64/kvm/sys_regs.c | 8 ++++++--
>> arch/arm64/mm/fault.c | 15 ++++++++++-----
>> arch/arm64/mm/mmu.c | 4 ++--
>> 4 files changed, 19 insertions(+), 10 deletions(-)
>>
>> diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
>> index c7b6de6..c89d5fd 100644
>> --- a/arch/arm64/kernel/signal.c
>> +++ b/arch/arm64/kernel/signal.c
>> @@ -155,7 +155,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
>>
>> badframe:
>> if (show_unhandled_signals)
>> - pr_info_ratelimited("%s[%d]: bad frame in %s: pc=%08llx sp=%08llx\n",
>> + pr_info_ratelimited("%s[%d]: bad frame in %s: pc=%016llx sp=%016llx\n",
>> current->comm, task_pid_nr(current), __func__,
>> regs->pc, regs->sp);
>> force_sig(SIGSEGV, current);
>> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
>> index 87e7e66..89bf5c1 100644
>> --- a/arch/arm64/kvm/sys_regs.c
>> +++ b/arch/arm64/kvm/sys_regs.c
>> @@ -1554,8 +1554,12 @@ static void unhandled_cp_access(struct kvm_vcpu *vcpu,
>> WARN_ON(1);
>> }
>>
>> - kvm_err("Unsupported guest CP%d access at: %08lx\n",
>> - cp, *vcpu_pc(vcpu));
>> + if (params->is_32bit)
>> + kvm_err("Unsupported guest CP%d access at: %08lx\n",
>> + cp, *vcpu_pc(vcpu));
>> + else
>> + kvm_err("Unsupported guest CP%d access at: %016lx\n",
>> + cp, *vcpu_pc(vcpu));
>
> It feels a bit much to me to have an if-statement to differentiate the
> number of leading zeros, so if it's important to always have fixed
> widths then I would just use %016lx in both cases.
Actually, it looks like vsnprintf does support the '*' field width
specifier, so even if the format _is_ critical there's still no reason
to have such duplicated code.
Robin.
>> print_sys_reg_instr(params);
>> kvm_inject_undefined(vcpu);
>> }
>> diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
>> index a78a5c4..d96a42a 100644
>> --- a/arch/arm64/mm/fault.c
>> +++ b/arch/arm64/mm/fault.c
>> @@ -77,7 +77,7 @@ void show_pte(struct mm_struct *mm, unsigned long addr)
>>
>> pr_alert("pgd = %p\n", mm->pgd);
>> pgd = pgd_offset(mm, addr);
>> - pr_alert("[%08lx] *pgd=%016llx", addr, pgd_val(*pgd));
>> + pr_alert("[%016lx] *pgd=%016llx", addr, pgd_val(*pgd));
>>
>> do {
>> pud_t *pud;
>> @@ -177,7 +177,7 @@ static void __do_kernel_fault(struct mm_struct *mm, unsigned long addr,
>> * No handler, we'll have to terminate things with extreme prejudice.
>> */
>> bust_spinlocks(1);
>> - pr_alert("Unable to handle kernel %s at virtual address %08lx\n",
>> + pr_alert("Unable to handle kernel %s at virtual address %016lx\n",
>> (addr < PAGE_SIZE) ? "NULL pointer dereference" :
>> "paging request", addr);
>>
>> @@ -198,9 +198,14 @@ static void __do_user_fault(struct task_struct *tsk, unsigned long addr,
>> struct siginfo si;
>>
>> if (unhandled_signal(tsk, sig) && show_unhandled_signals_ratelimited()) {
>> - pr_info("%s[%d]: unhandled %s (%d) at 0x%08lx, esr 0x%03x\n",
>> - tsk->comm, task_pid_nr(tsk), fault_name(esr), sig,
>> - addr, esr);
>> + if (compat_user_mode(regs))
>> + pr_info("%s[%d]: unhandled %s (%d) at 0x%08lx, esr 0x%03x\n",
>> + tsk->comm, task_pid_nr(tsk), fault_name(esr), sig,
>> + addr, esr);
>> + else
>> + pr_info("%s[%d]: unhandled %s (%d) at 0x%016lx, esr 0x%03x\n",
>> + tsk->comm, task_pid_nr(tsk), fault_name(esr), sig,
>> + addr, esr);
>
> same here.
>
> Thanks,
> -Christoffer
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
next prev parent reply other threads:[~2016-12-06 16:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-05 8:09 Maninder Singh
2016-12-05 11:24 ` Will Deacon
2016-12-06 15:26 ` Catalin Marinas
2016-12-06 15:28 ` Will Deacon
2016-12-06 16:11 ` Christoffer Dall
2016-12-06 16:32 ` Robin Murphy [this message]
2016-12-14 16:35 ` Paolo Bonzini
2016-12-06 16:43 ` Robin Murphy
-- strict thread matches above, loose matches on Subject: below --
2016-12-05 8:06 Maninder Singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dbf5af31-2a36-5216-4544-13ade6dddd3a@arm.com \
--to=robin.murphy@arm.com \
--cc=ajeet.y@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=christoffer.dall@linaro.org \
--cc=cmetcalf@mellanox.com \
--cc=cpgs@samsung.com \
--cc=james.morse@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=labbott@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maninder1.s@samsung.com \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=panand@redhat.com \
--cc=pankaj.m@samsung.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=sandeepa.s.prabhu@gmail.com \
--cc=shijie.huang@arm.com \
--cc=v.narang@samsung.com \
--cc=wangkefeng.wang@huawei.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®