Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp20133pxk; Mon, 5 Oct 2020 16:17:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxc3WBd07MCWr10J7U1aaXxpVzbvUb6OuJEA4xO0WaQ/1eWAOjA1z/Zjx4AZSfHWKU84m74 X-Received: by 2002:aa7:d7d2:: with SMTP id e18mr2320192eds.120.1601939877017; Mon, 05 Oct 2020 16:17:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601939877; cv=none; d=google.com; s=arc-20160816; b=A82IWLNiXxmEfWBR5lFyPLcOpaueJD7rauI34VOyvKcELPRBmnpTkjcb1HWGglbZXW 9vKHbQn0lfJUgXKMuwJr+kTMtsr1KVUvwR+0W8XU3mYTu6ovXJtXG13jNAInTaj5iCjF 9QVSEybaRhJpjDnBqKvKpuc1okqmDb952tVB9bBRZmmvTlBnpvIUCxt2gwcM8rehyxRL k9dZ8QJ85K3jTHsANIznOBicsDsMuTrJM7ruc5l4V2ouXNpZbMYKTw341HHnESC+nbTw VEtZXDfhQvC0nvInVoiIb8uOEnog+IahT2PTnbw7RtA5IgXX0Wzac5XNYCSGVwBTSU66 rhbQ== 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=hyrdjCdnHrdnldaqzFTSI9iGwYW5D1gYzC8h8Hdh80E=; b=xgHeabtcMAwoNAUlAJ9iJK8jPmvujPGLuuI2lnReo3uaf3lNCVERODFmkC0RNEEZXI MkDfO1LFiCzG6Fi++R/HksUe9Rr8DPEsvC6oYYEne5lANKaa+9+NxckyS4twgE233s/P 8DwDk3qpxJqPpCwxoJi9ZyyiWoMLhVO3lsqse5KWCgQqOw2NncXyDf+D9wrCImYwC+tP D5lBAItWtZMY/3I53VWXtXp7vILPoNuQajMQNJImMI9nJE+hgnpKZ4M6iT//5nGI2svN sRMISvbSzI+lNA8gDEHSob0qgz19HaBGRHtRZyI6u8ODquOm1O36LsYAtTztSPnTUlj0 ooEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hFgY9RJ2; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v25si702256ejf.560.2020.10.05.16.17.34; Mon, 05 Oct 2020 16:17:57 -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=@gmail.com header.s=20161025 header.b=hFgY9RJ2; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729768AbgJEVRp (ORCPT + 99 others); Mon, 5 Oct 2020 17:17:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725795AbgJEVRo (ORCPT ); Mon, 5 Oct 2020 17:17:44 -0400 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C250C0613CE; Mon, 5 Oct 2020 14:17:43 -0700 (PDT) Received: by mail-ot1-x343.google.com with SMTP id m11so4503492otk.13; Mon, 05 Oct 2020 14:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hyrdjCdnHrdnldaqzFTSI9iGwYW5D1gYzC8h8Hdh80E=; b=hFgY9RJ2qsAss5wIW2AxUadyOfAnf6CQjsgCVefWPsCZqqELm7merCDWGa1rybmzr6 8w/zsCZT2umo8TaaFDLvQJELkr6QJQO8W/QpUSXjtQiI2LdLFz6qOD21uPf1FAWIhvyu IsiMJRbHlKpm2YrTfdHLzBa4NGXolkXO7iA4cGG5dSUnxV9KEusz2DjMbPW/+Y4HGuLH 0m6D059Odxk7jRY8v+1edojV4DH1kVJO5vuV5FSQle4DK0/szSJ5Euq4ZJ4BYD8Wny7s 5KZ90jwQ/4IbVzEhHegzBagh8JdzK3hH09kJjNV0LREIe2P8XSOeuPX+oLvzipE0rUaY 4W2Q== 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=hyrdjCdnHrdnldaqzFTSI9iGwYW5D1gYzC8h8Hdh80E=; b=lz+Hz/2GjVao67DboC/ZGFiGO55cyUlQOD/dr72Ws2AxwYz0mI5nwJWukDHoLghvQQ 2KqiKiDav2ZwFybXj9JVp1V1ceD/cxyJPT1ulENgBQ45Nh2AEt1axeHtwgjBzI6rKavp OoL5zyDVDGHukM5Qcf8NH4EzsetsMAzFd+jbLQHG/466x+ucfHDAHm597+bXQH010uDb pzWAl8VTluTFT6i8i8TCAkoYzKebUYy/bw6KTSgX7liICvKvjPKS9lVewFaWLc4anhrr WyURgkmMREaDIhZlwVCcxkTyWFi9ormrWwNDZ6ZPzlCTI994+4M1G9e5tfWfIgi6rQKs UBHA== X-Gm-Message-State: AOAM530yxDqWT1C7Umy4K5HkTogRYHsiRdHbJxNzfMkvsY3mTRRMpcSO sQN5G2/cpqAHsuEIdIwsAPuz4zI6o/9QU8abqhU= X-Received: by 2002:a9d:5545:: with SMTP id h5mr807618oti.269.1601932662759; Mon, 05 Oct 2020 14:17:42 -0700 (PDT) MIME-Version: 1.0 References: <20200929205746.6763-1-chang.seok.bae@intel.com> <20201005134534.GT6642@arm.com> In-Reply-To: <20201005134534.GT6642@arm.com> From: "H.J. Lu" Date: Mon, 5 Oct 2020 14:17:06 -0700 Message-ID: Subject: Re: [RFC PATCH 0/4] x86: Improve Minimum Alternate Stack Size To: Dave Martin Cc: "Chang S. Bae" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Andy Lutomirski , "the arch/x86 maintainers" , Len Brown , Dave Hansen , Michael Ellerman , Tony Luck , "Ravi V. Shankar" , GNU C Library , linux-arch , Linux API , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 5, 2020 at 6:45 AM Dave Martin wrote: > > On Tue, Sep 29, 2020 at 01:57:42PM -0700, Chang S. Bae wrote: > > During signal entry, the kernel pushes data onto the normal userspace > > stack. On x86, the data pushed onto the user stack includes XSAVE state, > > which has grown over time as new features and larger registers have been > > added to the architecture. > > > > MINSIGSTKSZ is a constant provided in the kernel signal.h headers and > > typically distributed in lib-dev(el) packages, e.g. [1]. Its value is > > compiled into programs and is part of the user/kernel ABI. The MINSIGSTKSZ > > constant indicates to userspace how much data the kernel expects to push on > > the user stack, [2][3]. > > > > However, this constant is much too small and does not reflect recent > > additions to the architecture. For instance, when AVX-512 states are in > > use, the signal frame size can be 3.5KB while MINSIGSTKSZ remains 2KB. > > > > The bug report [4] explains this as an ABI issue. The small MINSIGSTKSZ can > > cause user stack overflow when delivering a signal. > > > > In this series, we suggest a couple of things: > > 1. Provide a variable minimum stack size to userspace, as a similar > > approach to [5] > > 2. Avoid using a too-small alternate stack > > I can't comment on the x86 specifics, but the approach followed in this > series does seem consistent with the way arm64 populates > AT_MINSIGSTKSZ. > > I need to dig up my glibc hacks for providing a sysconf interface to > this... Here is my proposal for glibc: https://sourceware.org/pipermail/libc-alpha/2020-September/118098.html 1. Define SIGSTKSZ and MINSIGSTKSZ to 64KB. 2. Add _SC_RSVD_SIG_STACK_SIZE for signal stack size reserved by the kernel. 3. Deprecate SIGSTKSZ and MINSIGSTKSZ if _SC_RSVD_SIG_STACK_SIZE is in use. -- H.J.