Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp283736pxu; Fri, 23 Oct 2020 00:00:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuQcoht28G7VigqZ3gC00WoIwye4CQcOogo6DbHHvACo0wqiKFhAfGyW9IUPomQqPxk6ym X-Received: by 2002:aa7:d5d7:: with SMTP id d23mr481215eds.207.1603436451913; Fri, 23 Oct 2020 00:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603436451; cv=none; d=google.com; s=arc-20160816; b=Gxjg3f1fQdeVi4uOJJ/wV0OBAA+AZiSznTs9EHSuEhlRm6lA5NIGeoHsq8alreqdIY FwJmYyBW3ZQJzzT6pIKmi6BhzyEFXJ24vXFLVLQQcXd0Ss/DgE29YZlcJozHZsSWlqcQ oP+a7TU0i8eHAFArfmHBwq3VRb4ZBdtaE+D+qc+IU5Kl1ErobUYl5n2IEeAAranPzsx3 VgPAAhDW2KbBoAZRuAg2zMqYnxsgnYK8/kx70Frx8CQVhi6TiifoLUfwgBB40fMwefbi scH7tskecTIwgKFyp7WtM8K4niVFqlz6XVlfZpIDJFUSqG69vT8WS+P1ws0+XHRWkTjU q7EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=XLY21JX5I5QFlC2bkVrjYFHPFnXicdIVDS29HVXeTok=; b=Cw9bcgHT2M9jqC9+jMYHyrWVjZPlapsXKCGhZv24RB8/xeQNiUXs55Squ6ty88Jth5 RlFf/+z4cxIxThnGb1CkQa43oVIPKsbVTnjnrrffRs5gABZYtWaI3vTEjfx5fCYFWU95 P+voOhNprHGxgb2u0D7w8oRu9HteA1KzMxREuOOBV9K36kgnJBS4E9L4IZ7PTPAS2h3j kmyocRpdk9is5YTFSBf8u3zcjnXTH0bNpGr55xjtOJ+MYPA9alOvrj4E5gLKjp/QiByq CwNoibo2YC3ygAS570X7CKIAo0s3g15FW0Cc/mOBvghItcJmuob09YMT4pjtixc6cC66 PBYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=ddTlNlNR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w17si296357ejk.629.2020.10.23.00.00.29; Fri, 23 Oct 2020 00:00:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=ddTlNlNR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S373719AbgJWAL3 (ORCPT + 99 others); Thu, 22 Oct 2020 20:11:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S373715AbgJWAL3 (ORCPT ); Thu, 22 Oct 2020 20:11:29 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3C2DC0613CF for ; Thu, 22 Oct 2020 17:11:28 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id 23so3858071ljv.7 for ; Thu, 22 Oct 2020 17:11:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XLY21JX5I5QFlC2bkVrjYFHPFnXicdIVDS29HVXeTok=; b=ddTlNlNRb6Gcq+pCD2VGDDviUyFdWgS4SI2rZqCTe7qisSD40rk3KGt9veIrursLjL d9JYYxPwhKyRBZiDDXgH7+i9ioZ8pfkB5+In9+v4mNHAG0/A90ekmx23hwMClIRCkpK1 XSJMBceXPy08U1FnD050q7PGqsmjLolxNxCak= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XLY21JX5I5QFlC2bkVrjYFHPFnXicdIVDS29HVXeTok=; b=PY1NlKrMhkeA2vOn5Kp9BhSA2P8d5RhQa1Y0rJ2paCRx1hok4lXfg+V7tcO2F5kZA/ 4zWhKjDorPKj/Rj4TVZgIpellkHng6vGmlX/m2QP+mauF37F9MNanfXlfeY+5JS+2RVR /JA1ROvS9gq3l8SsBC3ArXl5JNj5sZgP1Lu1WG08EBOMmkWnilvqKTEJPnO4YrLYbf5K JcLVxvAnZqfD5a3EYUym4AYra02k5thqFKFv3IAZ8eDzb6tIIdTN315z5iB/ijgvVkTk K8ncJUfl+e6zxv+qh96Ru6ITje/tlNzh1HmH+ecihbK/znVf6w4mUE3+L+wmlyny1Xfk 0JLA== X-Gm-Message-State: AOAM532+jc6FZq6PzGEkudg/ZEemePLUIz515FDG9lz+pk7TIrA4Y+3H 5PSdr9QlzsW1nd7iredOu3+YQM3Ofmzk2A== X-Received: by 2002:a05:651c:104a:: with SMTP id x10mr1779212ljm.113.1603411886333; Thu, 22 Oct 2020 17:11:26 -0700 (PDT) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com. [209.85.167.45]) by smtp.gmail.com with ESMTPSA id y24sm411074lfy.194.2020.10.22.17.11.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Oct 2020 17:11:25 -0700 (PDT) Received: by mail-lf1-f45.google.com with SMTP id h6so4448962lfj.3 for ; Thu, 22 Oct 2020 17:11:24 -0700 (PDT) X-Received: by 2002:a19:c703:: with SMTP id x3mr1503603lff.105.1603411884054; Thu, 22 Oct 2020 17:11:24 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Thu, 22 Oct 2020 17:11:08 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: mmstress[1309]: segfault at 7f3d71a36ee8 ip 00007f3d77132bdf sp 00007f3d71a36ee8 error 4 in libc-2.27.so[7f3d77058000+1aa000] To: Naresh Kamboju Cc: open list , linux-m68k , X86 ML , LTP List , lkft-triage@lists.linaro.org, Linux-Next Mailing List , linux-mm , kasan-dev , Christian Brauner , Ingo Molnar , Thomas Gleixner , "Matthew Wilcox (Oracle)" , "Peter Zijlstra (Intel)" , Al Viro , Geert Uytterhoeven , Viresh Kumar , zenglg.jy@cn.fujitsu.com, Stephen Rothwell , "Eric W. Biederman" , Dmitry Vyukov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 22, 2020 at 4:43 PM Linus Torvalds wrote: > > Thanks. Very funky, but thanks. I've been running that commit on my > machine for over half a year, and it still looks "trivially correct" > to me, but let me go look at it one more time. Can't argue with a > reliable bisect and revert.. Hmm. The fact that it only happens with KASAN makes me suspect it's some bad interaction with the inline asm syntax change (and explains why I've run with this for half a year without issues). In particular, I wonder if it's that KASAN causes some reload pattern, and the whole register __typeof__(*(ptr)) __val_pu asm("%"_ASM_AX); .. asm volatile(.. "r" (__val_pu) ..) thing causes problems. That's an ugly pattern, but it's written that way to get gcc to handle the 64-bit case properly (with the value in %rax:%rdx). It turns out that the decode of the user-mode SIGSEGV code is a variation of system calls, ie 0: b8 18 00 00 00 mov $0x18,%eax 5: 0f 05 syscall 7: 48 3d 01 f0 ff ff cmp $0xfffffffffffff001,%rax d: 73 01 jae 0x10 f:* c3 retq <-- trapping instruction or 0: 41 52 push %r10 2: 52 push %rdx 3: 4d 31 d2 xor %r10,%r10 6: ba 02 00 00 00 mov $0x2,%edx b: be 80 00 00 00 mov $0x80,%esi 10: 39 d0 cmp %edx,%eax 12: 75 07 jne 0x1b 14: b8 ca 00 00 00 mov $0xca,%eax 19: 0f 05 syscall 1b: 89 d0 mov %edx,%eax 1d: 87 07 xchg %eax,(%rdi) 1f: 85 c0 test %eax,%eax 21: 75 f1 jne 0x14 23:* 5a pop %rdx <-- trapping instruction 24: 41 5a pop %r10 26: c3 retq so in both cases it looks like 'syscall' returned with a bad stack pointer. Which is certainly a sign of some code generation issue. Very annoying, because it probably means that it's compiler-specific too. And that "syscall 018" looks very odd. I think that's sched_yield() on x86-64, which doesn't have any __put_user() cases at all.. Would you mind sending me the problematic vmlinux file in private (or, likely better - a pointer to some place I can download it, it's going to be huge). Linus