Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6980031imm; Tue, 28 Aug 2018 04:35:01 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYWhhg9UVV6fxcHyg+X+bw7hiZKH4Lu3U8ugib5Wai+8dXU64Ih1mlPaMpX+6ZbW2We9ikI X-Received: by 2002:a17:902:c6b:: with SMTP id 98-v6mr1153317pls.233.1535456101453; Tue, 28 Aug 2018 04:35:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535456101; cv=none; d=google.com; s=arc-20160816; b=p1743ko3ulv+6V8dYIZHMFo+57lxzRNFos5C3WtVWFmcmYr3dnHrAOquNC1dX3JPpb ZxQLt3x/iraecdo1CYTLUGeZz4ZMV1v0ZWl8Q5+lA2deOxM3FVcitESspYK8Lx2BPAhQ mCaFYkKSmzeUI5YjSgmKxHdACE1+ar9cldtsxpS4m4eU51IzgUFhDNOk1KpgzURswynz tIK38qcnzWD/7eH+1G3nw4mHNOSRzyL2VGa8JQkKyZU5gbtrawB1Nqd7Ys+cygQ+xoFQ Mis+XybqG3kuZXaO0XfIh/DAhVGibK/BZB1iKRtIQAqZCGNq+hby77aplzCtVBsmLdNs L+uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=u/fAxAGNq01ZPU5/FYyTMDZU5zUIJ+ukT0nZhaCSKrw=; b=TdBBg5M/4UoR0/h40RPv9xXMIwFLNMugKGz933osjt3vP+wzPdilQ5DCmxxZY8pdbd r6enWjvzdH9L9y+IXJPpFSGsYOak1LDsUlUQr/3Vqla2bad3/hUp8/JnE6Kyq/UhueTw BgQ6n0jnv5OTeCiB/pP24IouDW8i/ClR8VyZUfHXFx4CMpUhBfu5rufTDzbN0sX1P2V6 o/V/oaz/gzfIM0wut3ePFE0u6wRylqY+Q6bVyEAgmTro5/LozaNpyWJv6yAP5ak7DgHX /lXwnDdYFUQ6E94JV/sO4nnNZWPDVY3u4qduJKetUT1NZlVi3RLJmIlMuXQLtqYkG+XI lFwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=bBC1AA4O; 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=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 89-v6si855050pla.310.2018.08.28.04.34.46; Tue, 28 Aug 2018 04:35:01 -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=@virtuozzo.com header.s=selector1 header.b=bBC1AA4O; 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=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727215AbeH1PYz (ORCPT + 99 others); Tue, 28 Aug 2018 11:24:55 -0400 Received: from mail-eopbgr60132.outbound.protection.outlook.com ([40.107.6.132]:62679 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727067AbeH1PYz (ORCPT ); Tue, 28 Aug 2018 11:24:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u/fAxAGNq01ZPU5/FYyTMDZU5zUIJ+ukT0nZhaCSKrw=; b=bBC1AA4OAPWI6rB2HM4NheTqPVxd2+W4uLjpxI8A6w9tlNIccIEK01ENQhkZTZfvoPgIh/NAKDFuLFZAT6Q478Ywk1JPYJ9qbr2leMea3/HH0U0oENajCT2NT8vLvgkNQnFwDDkVSp0juokEA4ok7jHQxiQwfml5TKul+cib2TA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aryabinin@virtuozzo.com; Received: from [172.16.25.12] (185.231.240.5) by VI1PR08MB3264.eurprd08.prod.outlook.com (2603:10a6:803:3d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.15; Tue, 28 Aug 2018 11:33:36 +0000 Subject: Re: [PATCH] x86/entry/64: wipe KASAN stack shadow in rewind_stack_do_exit() To: Jann Horn Cc: Andy Lutomirski , the arch/x86 maintainers , kernel list , Dmitry Vyukov , kasan-dev@googlegroups.com, Alexander Potapenko , Kees Cook References: <20180824235826.62741-1-jannh@google.com> <0897d173-6a30-09df-f16a-76322384fe0d@virtuozzo.com> From: Andrey Ryabinin Message-ID: Date: Tue, 28 Aug 2018 14:33:48 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: DB6P18901CA0022.EURP189.PROD.OUTLOOK.COM (2603:10a6:4:16::32) To VI1PR08MB3264.eurprd08.prod.outlook.com (2603:10a6:803:3d::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5a2ec422-4149-421f-5881-08d60cda18e8 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR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8AfyNIomjm1qcjNr5cYaL/HUk0qZMgHW2rRRBiecFEvvpfsnX2QbMPR5ccZsM5TLfVxFK7/0nxLT2HEWN6KWGRcmnkh64niDeHP3jLwB88CQm+cufM8Q6toTYJf5WM5+WeyPcGoC17SLAzrweoDeac9PtC0UBk06x12dgzB9D30ym+xvYjbcOmfamnmGS0XUZzpM1Qj811e62y8OhnSVLcDUCVtgWpw3g8VnkbwcRm7rC99cmqe/MxLtP/iNauze0E3nU72g/28Cgtwpk6735LEo73r1OodII0BaKNs/8TAdNRS0xuA/8jtFQbhf7T4PvlYSAHJ1FBS5obhleZrSsw03XhDWPfBIOZJ4pDOJ06cjxiL+wBIZv3U9IJ+U9fD1tQDNrja+musL/;4:MMoApP7jOq0cb26vcPdrVl7Gx1rt3HurpHqS5wfVU6N8w4K/+SWieUe5K0ZAj/MaJ1YzYnpva3TD1eAcZAToETgkruxonii2pqbzQ9B/Zcp1axmxRqxsgErqrXB8+RDAAAFitnWzJJQf2vOHDU/fQsmsBB1t2nn3vqPvlfJXI1x2Xq6F8lTk9mWDv+7jPl7G5t9vxYL9zPtnF1P1VVEeZtenw79BuTdc8sVaUJqOEY+JBxHwK+WsWqS0hMzItElR5QAC4IYD0kTARPUzczzJ/g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3002001)(3231311)(944501410)(52105095)(10201501046)(93006095)(93001095)(149027)(150027)(6041310)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016);SRVR:VI1PR08MB3264;BCL:0;PCL:0;RULEID:;SRVR:VI1PR08MB3264; X-Forefront-PRVS: 077884B8B5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6049001)(376002)(39850400004)(136003)(366004)(396003)(346002)(199004)(189003)(76176011)(52116002)(26005)(3846002)(31696002)(50466002)(229853002)(23676004)(4326008)(25786009)(478600001)(77096007)(52146003)(2486003)(64126003)(97736004)(2906002)(956004)(476003)(230700001)(6246003)(14444005)(31686004)(8676002)(305945005)(2616005)(65826007)(6916009)(6666003)(5660300001)(47776003)(65956001)(65806001)(7736002)(486006)(81156014)(105586002)(81166006)(446003)(106356001)(11346002)(36756003)(86362001)(186003)(16526019)(6486002)(68736007)(53546011)(6116002)(386003)(316002)(53936002)(66066001)(16576012)(54906003)(8936002)(58126008);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR08MB3264;H:[172.16.25.12];FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtWSTFQUjA4TUIzMjY0OzIzOndMa2hEejVBeHZZODFkUDRGM1c2dnZISHRk?= =?utf-8?B?bEJFWTEyOWhuemU2SHM1MWdKRWhUYlliZWNhRk1jU1FienZkMW91SjJiT0c0?= =?utf-8?B?dkYrZzk5TXJHOUFub01UMUdIa0Rka0dFWFBhQXp1eUtHV21JTTEwSW1FSkF2?= =?utf-8?B?Z2NtMmJHRHRJTHh3d3Z6cHFiWmUybkNGQVY3dHZRQnliNkZJUTNVelNWNlBS?= =?utf-8?B?Nkk3eGw2THNTTXpSRGE2cE5ibkE2VTlRcVplYkRuQWxHQlhFN3RXS2U1RFY4?= =?utf-8?B?UWh4R3l6SHVMZ1VqeGY5VW5YOFdPSFVWMVRFLzVxV2hwbm5JOTk4MGxJOVZQ?= =?utf-8?B?c2hDaFdac09qUnVlQUt2UVlVWUpUNmt4Z2srT3lZOU0xWnkzc3grY2VwOHR3?= =?utf-8?B?RkJuMm5TelNnV1Z3MjM5K2NjTFIyTkdmdG8xeFErZmx1STJ1NC9nSVA0cjdZ?= =?utf-8?B?RWF0VFdibkNQMnRmT0JoYlV6Mkc1cktHSX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JCVyyTl2BhoRJ55U1NzEYQsp3geXnsWv9sGB/Cvbd84KODEItOVp76xKlNFTyAPiLbAUCL0bFic7DuqPUkkX+ZzBxI= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2018 11:33:36.1335 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5a2ec422-4149-421f-5881-08d60cda18e8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3264 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/28/2018 01:38 PM, Jann Horn wrote: >> >> >> Why this has to be done in the rewind_stack_do_exit()? >> Are there any problems with calling the kasan_unpoison_task_stack(current) from oops_end(), before the rewind_stack_do_exit()? > > Ooh, good point! I didn't see that KASAN instrumentation is disabled > for dumpstack.c. It doesn't really matter. This would work with instrumented oops_end() as well. kasan_unpoison_task_stack() will unpoison everything including oops_end's stack. It would be also ok if kasan_unpoison_task_stack() instrumented, or calling any number of instrumented functions in between kasan_unpoison_task_stack() and rewind_stack_do_exit(). As long as we return from these functions before the rewind_stack_do_exit(), the stack will be unpoisoned on return.