Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1300251imm; Fri, 29 Jun 2018 15:30:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLokGZCRhvOqZ7TAKc2ZyqPKiLEWWsT2wR50QK1Ae5QhckS4Jt1RVYGSLMFaWLtJJk97klB X-Received: by 2002:a17:902:7e08:: with SMTP id b8-v6mr16633508plm.230.1530311420346; Fri, 29 Jun 2018 15:30:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530311420; cv=none; d=google.com; s=arc-20160816; b=uC9vWIuCjkFfy0hwF+6NUcjrzHnfsytKC3qqJOTYG+yOxwbS+0zzwGzwnMZlOAqnhc 9J+dxSjdYeF2bNOZ/IVtAnedw3z92QlYuLi3dgQunsAGsU4lUOdawuWthxDiO9TgIw7A ABr3D48NBqDJ6zwd1mRNWVm9He4mpTbEEAoRRMYFOOGJIBA3XytmzQVpA5YmJcG0h5FT WL4l3AoxwzIkBT9S/D/i/w9ypULMdXLq34RQXS6NDfrtT2729o2eLSJHFDfEKy/Gzvh8 JUQglZOI+tsQ2ZOdWaJS1yO4h/vOv6xImZpWVwmEDjNsBpeNE6eFKeZH7r617Nt0CtQc GFOQ== 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 :references:in-reply-to:mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=08W4Er3KTxTEDsPjgC10WUzT9gIZpoBVzHabWOyjnwM=; b=rwgMtg0FOQ9dBORbUD46G98/aptFy9MGTX2RIfVHJif7zfBRil2XpfDXJQdn1eA+p8 Fw33pPL6AUYXnj1tn2DoZKwLQRz4yQQjr3STLZbXsTF+sm9X+Ik6gMjHvwKDayKoi69m i6Rj9dQpwihhUWPYaIqL1v+9LvJkSNKNGwlvM9Sgl0L5rRgMbu2wPwTXjJPiY0B4Q8Br 49j4xOF6ErO7Klrt5237m3nEWD6j7dmtXu9n7HHmegReR6RVmadGxTrTkfCIi0tkCNdU Msof1bNn80h0MJHgBeDDSe6+9/s7nAlM/R5+VXiRrJzLc4m1kYTu/GM6i0s9nkK42+DQ jlfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=P9eIgMh7; dkim=fail header.i=@chromium.org header.s=google header.b=Myr622NJ; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o23-v6si1222451pgv.518.2018.06.29.15.30.06; Fri, 29 Jun 2018 15:30:20 -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=fail header.i=@google.com header.s=20161025 header.b=P9eIgMh7; dkim=fail header.i=@chromium.org header.s=google header.b=Myr622NJ; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937328AbeF2UZX (ORCPT + 99 others); Fri, 29 Jun 2018 16:25:23 -0400 Received: from mail-yw0-f196.google.com ([209.85.161.196]:46685 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932375AbeF2UZV (ORCPT ); Fri, 29 Jun 2018 16:25:21 -0400 Received: by mail-yw0-f196.google.com with SMTP id g123-v6so4067535ywf.13 for ; Fri, 29 Jun 2018 13:25:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=08W4Er3KTxTEDsPjgC10WUzT9gIZpoBVzHabWOyjnwM=; b=P9eIgMh7Pd6+GEApuFlu8FmB5MEVorcKYLG+vcZmyBV4BIocqdxJzBDfE01d7cS7R/ Ut9P9esUUQ9InM6uFpqY2MyPLAIBkarP3S1QTOYgljwBfoab+PkIdnB4UNbsFkgW7W9F 35yJl+Pp8sqxHCmZvq+zfJ2MznxrSKeZtPJrh7wFg5n6cIthPLm9oNGAsQY6oIMeEiiw AAboZWLkHNrjZTf9BwyYS+8ZS1SAMiQM/1mXKcP7HOouWfZ1qtsWkEjhl5JlmTdXmQFL vQagOqBmmVbRLZforgrevE+93REaBglV9N6fTWYa7Y8bRHPMTLlgYxs7fPOJz1FMdUC8 HL1Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=08W4Er3KTxTEDsPjgC10WUzT9gIZpoBVzHabWOyjnwM=; b=Myr622NJzznOsLXw2Pzmvlki86Mryab2lX/2B7WDltnIrKsU1E6K1Sd9ZnSQqobqWa xHydHizlSDzb5GbdGB6TUpfmJBuBF/vpk8qGJO424yJoXTTyBmoAZ/CNfdK3l+Us9P6H A5zw5uA4xPhj3UBG6FarF0EvK0z82y6xAAibk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=08W4Er3KTxTEDsPjgC10WUzT9gIZpoBVzHabWOyjnwM=; b=AmU3jhIfQeUVwNb56n5BlUXXgAag4rruAgAt041L3cQ4ed7oktSLe7aATzQeye/CAh cmswoI3AKLB4l6vx7tWbO45m76vqSeJYUvvKkrsK2FL36RmWBXTiZO7H2k7DybfSAD7m 3FdVbetgykN5hVFlGIf3hxJWOo8hF6cAv0cqp6mI1oo53GftkkV/VAg/KXZbD0itj18E yUbAdv1YmzviHM0in9ke77734gCOKaD2MQyTaKvyPUfJjcCuXi1I0WdJVVpFlVb4+PTM hov+Z5cYvJzymwRdnWOihxZTrvzvkRTsOwZ5+nzWn9+5iOny/gfMCCaKg/fSSdN2hZeF D/0A== X-Gm-Message-State: APt69E2UcbFplzTRvb/jS/21lUwRg53N8exh6QC2O/2i9qBxtAfL0XgV kzfPksENePUq3PL7jJBbZx5Di3cxzC0gbo4eLnsO4g== X-Received: by 2002:a25:b219:: with SMTP id i25-v6mr8838438ybj.112.1530303921031; Fri, 29 Jun 2018 13:25:21 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:5f51:0:0:0:0:0 with HTTP; Fri, 29 Jun 2018 13:25:20 -0700 (PDT) In-Reply-To: <706dc06b-0157-89cb-33a6-d0b9d811dcf0@redhat.com> References: <20180629190553.7282-1-labbott@redhat.com> <706dc06b-0157-89cb-33a6-d0b9d811dcf0@redhat.com> From: Kees Cook Date: Fri, 29 Jun 2018 13:25:20 -0700 X-Google-Sender-Auth: C08lqLONZV64XYrwFS9Nin6NcxY Message-ID: Subject: Re: [PATCH] arm64: Clear the stack To: Laura Abbott Cc: Alexander Popov , Mark Rutland , Ard Biesheuvel , Kernel Hardening , linux-arm-kernel , LKML 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 Fri, Jun 29, 2018 at 1:22 PM, Laura Abbott wrote: > On 06/29/2018 01:19 PM, Kees Cook wrote: >> >> On Fri, Jun 29, 2018 at 12:05 PM, Laura Abbott wrote: >>> >>> Implementation of stackleak based heavily on the x86 version >>> >>> Signed-off-by: Laura Abbott >>> [...] >>> +#define current_top_of_stack() (task_stack_page(current) + THREAD_SIZE) >>> +#define on_thread_stack() (on_task_stack(current, >>> current_stack_pointer)) >> >> >> nit on types here. I get some warnings: >> >> kernel/stackleak.c:55:12: warning: assignment makes integer from >> pointer without a cast [-Wint-conversion] >> boundary = current_top_of_stack(); >> ^ >> kernel/stackleak.c:65:24: warning: assignment makes integer from >> pointer without a cast [-Wint-conversion] >> current->lowest_stack = current_top_of_stack() - THREAD_SIZE / 64; >> ^ >> >> So I think this needs to be: >> >> +#define current_top_of_stack() ((unsigned long)task_stack_page(current) + >> \ >> + THREAD_SIZE) >> > > Argh, missed that in an amend, can fix for next version if there > are no other objections to this approach. No worries! I've made the change locally and will push this out to -next unless there are objections? -Kees -- Kees Cook Pixel Security