Subject: Re: linux-next: build warnings after merge of the block tree

From: Jens Axboe <[email-masked]>
Date: Tue, 11 Apr 2023 16:39:39 -0600

On 4/11/23 3:55?PM, Josh Poimboeuf wrote:
> On Wed, Apr 12, 2023 at 07:34:16AM +1000, Stephen Rothwell wrote:
>> Hi all,
>>
>> On Tue, 28 Mar 2023 10:47:19 +1100 Stephen Rothwell <[email-masked]> wrote:
>>>
>>> On Mon, 27 Mar 2023 09:26:30 -0700 Josh Poimboeuf <[email-masked]> wrote:
>>>>
>>>> On Mon, Mar 27, 2023 at 12:00:17PM +1100, Stephen Rothwell wrote:  
>>>>>
>>>>> After merging the block tree, today's linux-next build (x86_64
>>>>> allnoconfig) produced these warnings:
>>>>>
>>>>> lib/iov_iter.o: warning: objtool: .altinstr_replacement+0x0: redundant UACCESS d
>>>>> isable
>>>>> lib/iov_iter.o: warning: objtool: iovec_from_user.part.0+0xc7: call to copy_comp
>>>>> at_iovec_from_user.part.0() with UACCESS enabled
>>>>> lib/iov_iter.o: warning: objtool: __import_iovec+0x21d: call to copy_compat_iovec_from_user.part.0() with UACCESS enabled
>>>>>
>>>>> Presumably introduced by commit
>>>>>
>>>>>   6376ce56feb6 ("iov_iter: import single vector iovecs as ITER_UBUF")    
>>>>
>>>> I'm not able to recreate.  What's your compiler version?  
>>>
>>> $ x86_64-linux-gnu-gcc --version
>>> x86_64-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0
>>
>> Any progress?
> 
> I still wasn't able to recreate with gcc version 12.2.1 20221121 (Red
> Hat 12.2.1-4) (GCC) .
> 
> Is it a cross-compile?
> 
> Can you share the .o file?

Here's mine, native compile:

axboe@12900k ~/gi/linux-block (test)> gcc --version
gcc (Debian 12.2.0-14) 12.2.0

lib/iov_iter.o attached, gzip'ed. NOTE: if you disable either of the
copy_compat_iovec_from_user() as per diff below (commented out), then
it doesn't complain. Is there some bug where it thinks we'll hit both?
That should not be possible.

diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 783ae46b13b9..1bff8f9282b2 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1327,6 +1327,7 @@ struct iovec *iovec_from_user(const struct iovec __user *uvec,
 			return ERR_PTR(-ENOMEM);
 	}
 
+	/* if (0 && compat) */
 	if (compat)
 		ret = copy_compat_iovec_from_user(iov, uvec, nr_segs);
 	else
@@ -1350,6 +1351,7 @@ static ssize_t __import_iovec_ubuf(int type, const struct iovec __user *uvec,
 	struct iovec *iov = *iovp;
 	ssize_t ret;
 
+	/* if (0 && compat) */
 	if (compat)
 		ret = copy_compat_iovec_from_user(iov, uvec, 1);
 	else

-- 
Jens Axboe