Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp7713881ybc; Thu, 28 Nov 2019 23:43:25 -0800 (PST) X-Google-Smtp-Source: APXvYqyCPraK143XO9s8waEow6q+4/4qH7GncyL82R0OOPB44+DzWJQ6exelyl9etmk5YE//pdZG X-Received: by 2002:a17:906:4e96:: with SMTP id v22mr32725447eju.219.1575013405468; Thu, 28 Nov 2019 23:43:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575013405; cv=none; d=google.com; s=arc-20160816; b=ZYUAxeSA3zmvtjZjnExJarqIaR+DKGDPlKG3x/95MkjmqCkKO+/gQeyo98rwJHVlQR ibzifGZ91HcWZm0aaVL+wXNULBOCQKv9kiFZBUXPwOG+pyeUlI+bKVGKVMislbk5gfbk 0ZVSJoCV+DqxBKHU62vY4CciXDv3n9rLFVoCavj+LB79SFJW1kqYivBf7AxzIuLqW5VI I+esweSclsrJ+5OMfgHQcbLBotpBIvkOf8KTNyp6LQARNkVm/MvWl6vRK+Ac0TbrpIaz Z49p/Esrg7M/xq9d7iMUrnU2N8Er2S2DCfC3Jua7kfT/9pp/UqPPKo6eLxpKaskQic2C tPSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:in-reply-to :content-disposition:mime-version:references:subject:cc:to:from:date; bh=gUmBTvn2ybtlnVEqrKB+f/9HooWYTt3B0YZ1limiw9Q=; b=RNHGggyyK0RAQKvnuow7oJ5jkDcDUq0mhNLwm+9X5VLY80qZL7jToO5fR6ICnAoSOb tw3AIYuj0bXAh1glAR3LubrZcqdlbKTLL3RZMNt0dfAKMgNuUd2KQEEcLHd4dmLW8Oiu H8rJwRP9OqWXyOaV84613cI1DH2gSYeD8wiHAmoCPT6D7TmhorIExNN2w0+gOhdRyYTQ z99sMnkxm8ka5PEhE1xCCu3yR+mQgPcRHYNRI26b9NkZ+f2IdayF4TRDZyRUoiTBcUsS x0Wz97LZ+QJuktsMdJu0qbVqX7pinvCI4a2XpTtzFVBWmtZdfmhrVfOiOAzJDcVjHB2b 8HPQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s38si14198749edd.351.2019.11.28.23.43.01; Thu, 28 Nov 2019 23:43:25 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726889AbfK2Hl7 (ORCPT + 99 others); Fri, 29 Nov 2019 02:41:59 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:27116 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726763AbfK2Hl7 (ORCPT ); Fri, 29 Nov 2019 02:41:59 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAT7fvpH115086 for ; Fri, 29 Nov 2019 02:41:57 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2wjttrq1vn-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 29 Nov 2019 02:41:57 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 29 Nov 2019 07:41:54 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 29 Nov 2019 07:41:51 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xAT7foan53280810 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Nov 2019 07:41:50 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2DD3F4203F; Fri, 29 Nov 2019 07:41:50 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8B1BF42041; Fri, 29 Nov 2019 07:41:49 +0000 (GMT) Received: from localhost (unknown [9.145.76.153]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 29 Nov 2019 07:41:49 +0000 (GMT) Date: Fri, 29 Nov 2019 08:41:48 +0100 From: Vasily Gorbik To: Miroslav Benes Cc: heiko.carstens@de.ibm.com, borntraeger@de.ibm.com, jpoimboe@redhat.com, joe.lawrence@redhat.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, jikos@kernel.org, pmladek@suse.com, nstange@suse.de, live-patching@vger.kernel.org Subject: [PATCH v4 1/2] s390/unwind: add stack pointer alignment sanity checks References: <20191106095601.29986-5-mbenes@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 x-cbid: 19112907-0008-0000-0000-00000339C37D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19112907-0009-0000-0000-00004A58D255 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-29_01:2019-11-29,2019-11-29 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=890 spamscore=0 lowpriorityscore=0 suspectscore=1 adultscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911290066 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miroslav Benes ABI requires SP to be aligned 8 bytes, report unwinding error otherwise. Signed-off-by: Vasily Gorbik --- arch/s390/kernel/dumpstack.c | 4 ++++ arch/s390/kernel/unwind_bc.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/arch/s390/kernel/dumpstack.c b/arch/s390/kernel/dumpstack.c index d74e21a23703..d306fe04489a 100644 --- a/arch/s390/kernel/dumpstack.c +++ b/arch/s390/kernel/dumpstack.c @@ -94,6 +94,10 @@ int get_stack_info(unsigned long sp, struct task_struct *task, if (!sp) goto unknown; + /* Sanity check: ABI requires SP to be aligned 8 bytes. */ + if (sp & 0x7) + goto unknown; + /* Check per-task stack */ if (in_task_stack(sp, task, info)) goto recursion_check; diff --git a/arch/s390/kernel/unwind_bc.c b/arch/s390/kernel/unwind_bc.c index ef42d5f77ce7..da2d4d4c5b0e 100644 --- a/arch/s390/kernel/unwind_bc.c +++ b/arch/s390/kernel/unwind_bc.c @@ -92,6 +92,10 @@ bool unwind_next_frame(struct unwind_state *state) } } + /* Sanity check: ABI requires SP to be aligned 8 bytes. */ + if (sp & 0x7) + goto out_err; + ip = ftrace_graph_ret_addr(state->task, &state->graph_idx, ip, (void *) sp); /* Update unwind state */ -- 2.21.0