linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
To: Robin Murphy <robin.murphy@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: b.zolnierkie@samsung.com, peterz@infradead.org,
	catalin.marinas@arm.com, will.deacon@arm.com,
	linux@armlinux.org.uk, acme@kernel.org, oleg@redhat.com,
	alexander.shishkin@linux.intel.com, mingo@redhat.com,
	k.lewandowsk@samsung.com, namhyung@kernel.org, jolsa@redhat.com,
	m.szyprowski@samsung.com
Subject: Re: [PATCH v2 7/7] arm64: uprobes - ARM32 instruction probing
Date: Mon, 1 Oct 2018 15:40:28 +0200	[thread overview]
Message-ID: <20181001134031eucas1p20355222b5692ca99bbeb915b9dbc6818~Zf8TZ4bLI3108031080eucas1p2e@eucas1p2.samsung.com> (raw)
In-Reply-To: <89110505-da2e-3266-c2aa-6e5128c520a4@arm.com>

Hi Robin,

Thank you for having a look at my patchset.

On 27.09.2018 19:01, Robin Murphy wrote:
> On 26/09/18 13:12, Maciej Slodczyk wrote:
> [...]
>> @@ -38,16 +78,44 @@ int arch_uprobe_analyze_insn(struct arch_uprobe 
>> *auprobe, struct mm_struct *mm,
>>           unsigned long addr)
>>   {
>>       probes_opcode_t insn;
>> +    enum probes_insn retval;
>> +    unsigned int bpinsn;
>> -    /* TODO: Currently we do not support AARCH32 instruction probing */
>> -    if (mm->context.flags & MMCF_AARCH32)
>> -        return -ENOTSUPP;
>> -    else if (!IS_ALIGNED(addr, AARCH64_INSN_SIZE))
>> +    insn = *(probes_opcode_t *)(&auprobe->insn[0]);
>> +
>> +    if (!IS_ALIGNED(addr, AARCH64_INSN_SIZE))
>>           return -EINVAL;
>> -    insn = *(probes_opcode_t *)(&auprobe->insn[0]);
>> +    /* check if AARCH32 */
>> +    if (is_compat_task()) {
>> +
>> +        /* Thumb is not supported yet */
>> +        if (addr & 0x3)
> 
> I'm only skimming, so forgive me if I'm missing something which should 
> be obvious, but this has a big red flag all over it. If "addr" is the 
> actual instruction address (or even a branch target, for a 
> non-interworking branch), plenty of Thumb instructions will just happen 
> to lie at 4-byte-aligned addresses anyway.
> 
That's the same way Thumb instructions are filtered out in arch/arm 
uprobes and kprobes code. I believe that at this point all Thumb 
instruction have bit 0 set. Please correct me if I'm wrong.

> Furthermore, how would this check ever catch anything anyway given 
> !IS_ALIGNED(addr, AARCH64_INSN_SIZE) above?

You're right, there's no point in checking it here. I'll fix it in v3.

Thank you,
Maciej


  reply	other threads:[~2018-10-01 13:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180926121213eucas1p1e85f71d1187eb6b50c320377e5ea907f@eucas1p1.samsung.com>
2018-09-26 12:11 ` [PATCH v2 0/7] arm64: uprobes - ARM32 instruction probing Maciej Slodczyk
     [not found]   ` <CGME20180926121214eucas1p2b262936ddd96980b7b4369f16b52c6ce@eucas1p2.samsung.com>
2018-09-26 12:11     ` [PATCH v2 1/7] arm64: move arm uprobes code to be reused by arm64 Maciej Slodczyk
2018-09-29  9:37       ` Suzuki K Poulose
2018-10-01 13:12         ` Maciej Slodczyk
     [not found]   ` <CGME20180926121214eucas1p1660542d20425551038da8d3feaf7e1b7@eucas1p1.samsung.com>
2018-09-26 12:12     ` [PATCH v2 2/7] arm64: uprobes - fix checkpatch issues Maciej Slodczyk
2018-09-29  9:39       ` Suzuki K Poulose
     [not found]   ` <CGME20180926121215eucas1p10437d5bd9db81bedbcc363d24d196ded@eucas1p1.samsung.com>
2018-09-26 12:12     ` [PATCH v2 3/7] arm64: introduce get_swbp_insn() instead of static assignment Maciej Slodczyk
     [not found]   ` <CGME20180926121216eucas1p28c13ab1a21ac5ef5058206b92954604f@eucas1p2.samsung.com>
2018-09-26 12:12     ` [PATCH v2 4/7] arm64: change arm64 probes handler prototype Maciej Slodczyk
     [not found]   ` <CGME20180926121216eucas1p2b896ce19f49214d497721db9d6e59bfb@eucas1p2.samsung.com>
2018-09-26 12:12     ` [PATCH v2 5/7] arm64: make arm uprobes code reusable by arm64 Maciej Slodczyk
2018-09-27 15:52       ` Julien Thierry
2018-10-01 13:28         ` Maciej Slodczyk
2018-10-02  8:08           ` Julien Thierry
     [not found]   ` <CGME20180926121217eucas1p198d96ed637d1aa8a98c1b90466dde745@eucas1p1.samsung.com>
2018-09-26 12:12     ` [PATCH v2 6/7] arm64: change arm_probe_decode_insn() function name Maciej Slodczyk
     [not found]   ` <CGME20180926121218eucas1p1b20a88cfec17c6403a35e4f23de96ade@eucas1p1.samsung.com>
2018-09-26 12:12     ` [PATCH v2 7/7] arm64: uprobes - ARM32 instruction probing Maciej Slodczyk
2018-09-27 16:18       ` Julien Thierry
2018-09-27 17:01       ` Robin Murphy
2018-10-01 13:40         ` Maciej Slodczyk [this message]
2018-10-02 11:04           ` Robin Murphy

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='20181001134031eucas1p20355222b5692ca99bbeb915b9dbc6818~Zf8TZ4bLI3108031080eucas1p2e@eucas1p2.samsung.com' \
    --to=m.slodczyk2@partner.samsung.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=catalin.marinas@arm.com \
    --cc=jolsa@redhat.com \
    --cc=k.lewandowsk@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=m.szyprowski@samsung.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=robin.murphy@arm.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;
as well as URLs for NNTP newsgroup(s).