mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Palmer Dabbelt <palmer@sifive.com>
Cc: atish.patra@wdc.com, linux-riscv@lists.infradead.org,
	linux-kernel@vger.kernel.org, albert@sifive.com
Subject: Re: [PATCH 3/3] riscv: fix __user annotation for __copy_user()
Date: Sat, 9 Jun 2018 23:42:12 +0200	[thread overview]
Message-ID: <20180609214211.u42vfrddl75ow7bb@ltop.local> (raw)
In-Reply-To: <mhng-34378b5f-fa64-4886-b454-a2cb319d6abb@palmer-si-x1c4>

On Sat, Jun 09, 2018 at 01:00:08PM -0700, Palmer Dabbelt wrote:
> On Fri, 08 Jun 2018 17:13:12 PDT (-0700), luc.vanoostenryck@gmail.com wrote:
> > I tried it and ... the preprocessed asm is as expected:
> > 	.globl __asm_copy_to_user ; .balign 4 ; __asm_copy_to_user:
> > 	.globl __asm_copy_from_user ; .balign 4 ; __asm_copy_from_user:
> > 
> > 
> > 	 li t6, 0x00040000
> > 	 csrs sstatus, t6
> > 	 ...
> > 
> > But the nm -S returns different sizes for them:
> > 	0000000000000004 000000000000006c T __asm_copy_from_user
> > 	0000000000000002 000000000000006e T __asm_copy_to_user
> > 
> > and the object code is:
> > 	0000000000000000 <__asm_copy_to_user-0x2>:
> > 	   0:   0001                    nop
> > 
> > 	0000000000000002 <__asm_copy_to_user>:
> > 	   2:   0001                    nop
> > 
> > 	0000000000000004 <__asm_copy_from_user>:
> > 	   4:   00040fb7                lui     t6,0x40
> > 	   8:   100fa073                csrs    sstatus,t6
> > 	   ...
> > 
> > Why these unnneded nops?
> > Is this a known problem of my toolchain (I use a plain gcc 7.3 +
> > binutils 2.29, both configured as riscv64-none-elf)?
> > 
> > If I remove the two ENTRY() and use instead:
> > 	.globl __asm_copy_to_user ; __asm_copy_to_user:
> > 	.globl __asm_copy_from_user ; __asm_copy_from_user:
> > (IOW, I drop the .balign) then I get the expected result.
> > But well, this seems unrelated to the double ENTRY.
> > 
> > I can't test it more for now because I've some link errors (which,
> > I understand are probably solved in the riscv tree of binutils).
> > 
> > I'll send you the patch anyway since, as far as I understand the changes
> > specific to this copy_to/from_user is OK.
> 
> I think it's probably a bug in binutils-2.29 that should be fixed by
> 2.30 -- IIRC we had some bugs that looked like this and they got
> fixed, though it might be just in master (so 2.31).

I've tried binutils-2.30 and riscv-binutils-gdb, both still have
the problem and master binutils-gdb doesn't compile for me.
OTOH, everything is fine if I disabled CONFIG_RISCV_ISA_C.

> Either way it looks innocuous WRT the patch.

Indeed.
With this, the RISC-V arch should be sparse clean.
I'll recheck after -rc1.

Cheers,
-- Luc

  reply	other threads:[~2018-06-09 21:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 15:21 [PATCH 0/3] riscv: fix sparse annotations Luc Van Oostenryck
2018-06-01 15:21 ` [PATCH 1/3] riscv: use NULL instead of a plain 0 Luc Van Oostenryck
2018-06-01 15:21 ` [PATCH 2/3] riscv: no __user for probe_kernel_address() Luc Van Oostenryck
2018-06-01 15:21 ` [PATCH 3/3] riscv: fix __user annotation for __copy_user() Luc Van Oostenryck
2018-06-04 18:46   ` Atish Patra
2018-06-04 19:09     ` Luc Van Oostenryck
2018-06-04 19:28       ` Atish Patra
2018-06-07 16:30         ` Palmer Dabbelt
2018-06-07 16:45           ` Atish Patra
2018-06-07 16:51           ` Luc Van Oostenryck
2018-06-08 22:33             ` Palmer Dabbelt
2018-06-09  0:13               ` Luc Van Oostenryck
2018-06-09 20:00                 ` Palmer Dabbelt
2018-06-09 21:42                   ` Luc Van Oostenryck [this message]
2018-06-11 19:01                     ` Palmer Dabbelt
2018-06-12  3:00                       ` Luc Van Oostenryck
2018-06-12 17:12                         ` Palmer Dabbelt
2018-06-12 18:19                           ` Luc Van Oostenryck
2018-06-12 19:38                             ` Palmer Dabbelt
2018-06-09  0:33               ` [PATCH] riscv: split the declaration of __copy_user Luc Van Oostenryck

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=20180609214211.u42vfrddl75ow7bb@ltop.local \
    --to=luc.vanoostenryck@gmail.com \
    --cc=albert@sifive.com \
    --cc=atish.patra@wdc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@sifive.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®