Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1727764
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/3] locking/rwsem/x86: Add stack frame dependency for __downgrade_write() |
| Date | Wed, 06 Sep 2017 23:40:03 +0200 |
| Message-ID | <umQdd-7qi-35@gated-at.bofh.it> (permalink) |
| References | <umB4t-5b7-3@gated-at.bofh.it> <umB4t-5b7-1@gated-at.bofh.it> |
| X-Original-To | Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> |
| Dmarc-Filter | OpenDMARC Filter v1.3.2 mx1.redhat.com 9EC3CC047B69 |
| Authentication-Results | ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com |
| Authentication-Results | ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jpoimboe@redhat.com |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Disposition | inline |
| User-Agent | Mutt/1.6.0.1 (2016-04-01) |
| X-Scanned-By | MIMEDefang 2.79 on 10.5.11.13 |
| X-Greylist | Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 06 Sep 2017 21:33:03 +0000 (UTC) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 50 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Thomas Gleixner <tglx@linutronix.de>, "H . Peter Anvin" <hpa@zytor.com>, linux-kernel@vger.kernel.org, x86@kernel.org |
| X-Original-Date | Wed, 6 Sep 2017 16:33:02 -0500 |
| X-Original-Message-ID | <20170906213302.s6st6ch32hixhwmg@treble> |
| X-Original-References | <20170906052613.30058-1-miguel.bernal.marin@linux.intel.com> <20170906052613.30058-4-miguel.bernal.marin@linux.intel.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1727764 |
Show key headers only | View raw
On Wed, Sep 06, 2017 at 12:26:13AM -0500, Miguel Bernal Marin wrote:
> kernel/locking/rwsem.o: warning: objtool: downgrade_write()+0x22: call without frame pointer save/setup
>
> The warning means gcc 7.2.0 placed the __downgrade_write() inline asm (and
> its call instruction) before the frame pointer setup in downgrade_write(),
> which breaks frame pointer convention and can result in incorrect
> stack traces.
>
> Force a stack frame to be created before the call instruction by listing
> the stack pointer as an output operand in the inline asm statement.
>
> Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
> ---
> arch/x86/include/asm/rwsem.h | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h
> index d26b6916b935..a749dc6a3103 100644
> --- a/arch/x86/include/asm/rwsem.h
> +++ b/arch/x86/include/asm/rwsem.h
> @@ -205,8 +205,10 @@ static inline void __up_write(struct rw_semaphore *sem)
> */
> static inline void __downgrade_write(struct rw_semaphore *sem)
> {
> + register void *__sp asm(_ASM_SP);
> +
> asm volatile("# beginning __downgrade_write\n\t"
> - LOCK_PREFIX _ASM_ADD "%2,(%1)\n\t"
> + LOCK_PREFIX _ASM_ADD "%2,(%2)\n\t"
The '%2' should be changed to '%3'
LOCK_PREFIX _ASM_ADD "%3,(%2)\n\t"
because both inputs' indices are shifted by the new output constraint.
> /*
> * transitions 0xZZZZ0001 -> 0xYYYY0001 (i386)
> * 0xZZZZZZZZ00000001 -> 0xYYYYYYYY00000001 (x86_64)
> @@ -215,7 +217,7 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
> " call call_rwsem_downgrade_wake\n"
> "1:\n\t"
> "# ending __downgrade_write\n"
> - : "+m" (sem->count)
> + : "+m" (sem->count), "+r" (__sp)
> : "a" (sem), "er" (-RWSEM_WAITING_BIAS)
> : "memory", "cc");
--
Josh
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 3/3] locking/rwsem/x86: Add stack frame dependency for __downgrade_write() Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> - 2017-09-06 07:30 +0200
Re: [PATCH 3/3] locking/rwsem/x86: Add stack frame dependency for __downgrade_write() Josh Poimboeuf <jpoimboe@redhat.com> - 2017-09-06 23:40 +0200
Re: [PATCH 3/3] locking/rwsem/x86: Add stack frame dependency for __downgrade_write() Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> - 2017-09-07 00:20 +0200
Re: [PATCH 3/3] locking/rwsem/x86: Add stack frame dependency for __downgrade_write() Peter Zijlstra <peterz@infradead.org> - 2017-09-07 09:10 +0200
csiph-web