Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1075334imm; Wed, 6 Jun 2018 10:03:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIn1Xc3ops1x9++P42BrOF/GJlEv1oDlC6b3SGRm+QQXJHT7ghNCesD/laANlN76R/Tgm6u X-Received: by 2002:aa7:8589:: with SMTP id w9-v6mr3259820pfn.119.1528304599841; Wed, 06 Jun 2018 10:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528304599; cv=none; d=google.com; s=arc-20160816; b=J9c0h4SXhrsJ5Noj2OC3v5dWNK9B2rk7hb06c3tsa2jW0sq7XtGcm5RW6BiKF0hhu/ fABtjEjWKYFTGq2ejVKi+mn4DLm8YVqNbBcZ2U0xwfKX0g/3R4R9MoUnH5LNHG/8FO23 6Syz31LIgSDavwHfmrKq1uOl8vl7gnzRJaT+rcakL5IA8a3z5ImWNhfydGxLFmFPYxza eh3UFanCEjNPGYKkB3gkwfhsKNmM6ejF/ciE6xHuLFsK+YL9lBCYMq0ym7fg6z5Dm8I/ AsrqgLATFIUPCTR/u5Emg/AS33a/OYMjm3Gn9S6BB+g+smzE72Q7YfSK0Ths7gkFtKVP BsMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=Y7bEa6F1Wj/GijmnP+3Lm0YfleAqGYxZuoMEFc/x25A=; b=qLCkyZRyFq3thZJw2y85yaxxGuMVWRBF2dZ/yuEaJ+JWag0NIbIk47JefYAsMfX24z kuOJxdWr7P6X2ZFhPJoirKmj5lDCU/6+nWOJnAkdjBqpcpli+OKYoGPaIMry+N+B1Luw X+y7jn3foGymrF3YBt+rDrd0jOobP8AZbSGG0plHlfjzo/VQGMPx5/h5El4uZItZUxCc 9xoVtsxLw+w0Yy2M/gbZREobDbbnQDk494gun620jbNtpawp7a2PTaroU1L6rk9mHcOA plpw0Ox70+e91TI5hVmYmOoHC45OBhVLZ3ykwCilYpadp4qukWVo6C/RkEPCpMmn3e2/ 7tRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oDEhsSaH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n4-v6si51862739pfk.277.2018.06.06.10.03.04; Wed, 06 Jun 2018 10:03:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oDEhsSaH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933783AbeFFRCT (ORCPT + 99 others); Wed, 6 Jun 2018 13:02:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:43654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933753AbeFFRCE (ORCPT ); Wed, 6 Jun 2018 13:02:04 -0400 Received: from mail-wr0-f174.google.com (mail-wr0-f174.google.com [209.85.128.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DE0C920870 for ; Wed, 6 Jun 2018 17:02:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528304524; bh=gAaUZeNzpxgGHwFz8ii7jB3Zdaf7dsJU5LyLY59iu2c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=oDEhsSaHTHJD9Bk/JGyBoC2Y1l8xtv5v9+ZCtUUU+OBGOkVOrB0ZGqL+UfPsxTC0e ELyNuQ7KXIMnpd7r3t241rAogchTmHuBhW8uDW7hiQegg+4FDjuP1ByXDDLxZYxME1 SMCsSQJdzJz0j23Y/5LQZVz/mDsXlKYv7jmB9dik= Received: by mail-wr0-f174.google.com with SMTP id h10-v6so7059718wrq.8 for ; Wed, 06 Jun 2018 10:02:03 -0700 (PDT) X-Gm-Message-State: APt69E0BPjdSU9fi6U5c1aAsxhXEAJgG5FYKxvKLfzcFgQ54ltalnhI1 uHGxFLwPJ1yKrZUqvNRO+fWEzbumZeUrVfrZlxXzHg== X-Received: by 2002:adf:85ec:: with SMTP id 41-v6mr3061717wru.120.1528304522393; Wed, 06 Jun 2018 10:02:02 -0700 (PDT) MIME-Version: 1.0 References: <5B1672FE.4050705@huawei.com> <5B1792C9.8010203@huawei.com> <5B17A6B6.70300@huawei.com> In-Reply-To: <5B17A6B6.70300@huawei.com> From: Andy Lutomirski Date: Wed, 6 Jun 2018 10:01:50 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Is this a kernel BUG? ///Re: [Question] Can we use SIGRTMIN when vdso disabled on X86? To: thunder.leizhen@huawei.com Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , X86 ML , Dominik Brodowski , Andrew Lutomirski , LKML , yaomin2@huawei.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 6, 2018 at 2:18 AM Leizhen (ThunderTown) wrote: > > I found that glibc has already dealt with this case. So this issue must have been met before, should it be maintained by libc/user? > > if (GLRO(dl_sysinfo_dso) == NULL) > { > kact.sa_flags |= SA_RESTORER; > > kact.sa_restorer = ((act->sa_flags & SA_SIGINFO) > ? &restore_rt : &restore); > } > > > On 2018/6/6 15:52, Leizhen (ThunderTown) wrote: > > > > > > On 2018/6/5 19:24, Leizhen (ThunderTown) wrote: > >> After I executed "echo 0 > /proc/sys/abi/vsyscall32" to disable vdso, the rt_sigaction01 test case from ltp_2015 failed. > >> The test case source code please refer to the attachment, and the output as blow: > >> > >> ----------------- > >> ./rt_sigaction01 > >> rt_sigaction01 0 TINFO : signal: 34 > >> rt_sigaction01 1 TPASS : rt_sigaction call succeeded: result = 0 > >> rt_sigaction01 0 TINFO : sa.sa_flags = SA_RESETHAND|SA_SIGINFO > >> rt_sigaction01 0 TINFO : Signal Handler Called with signal number 34 > >> > >> Segmentation fault > >> ------------------ > >> > >> > >> Is this the desired result? In function ia32_setup_rt_frame, I found below code: > >> > >> if (ksig->ka.sa.sa_flags & SA_RESTORER) > >> restorer = ksig->ka.sa.sa_restorer; > >> else > >> restorer = current->mm->context.vdso + > >> vdso_image_32.sym___kernel_rt_sigreturn; > >> put_user_ex(ptr_to_compat(restorer), &frame->pretcode); > >> > >> Because the vdso is disabled, so current->mm->context.vdso is NULL, which cause the result of frame->pretcode invalid. > >> > >> I'm not sure whether this is a kernel bug or just an error of test case itself. Can anyone help me? > >> > > > > I can't tell from your email what you're testing, what behavior you expect, and what you saw. A program that sets up a signal handler without supplying a restorer will not work if the vDSO is off, and this is by design. (FWIW, there is a very longstanding libc bug that causes this case to get severely screwed up if the user's SS is not the expected value, and that bug was just fixed very recently. But I doubt this is what you're seeing.) I suppose we could improve the kernel to at least push NULL instead of some random address a bit above 0, but it'll still crash.