Received: by 10.213.65.68 with SMTP id h4csp1223238imn; Wed, 14 Mar 2018 13:23:51 -0700 (PDT) X-Google-Smtp-Source: AG47ELtL8Dho41/wQn6yxbLwlfgendaO9hQLAegoCsNrcVUqQbBiQhjHUvBhEudNBYPnVxqHQywX X-Received: by 10.99.108.2 with SMTP id h2mr488553pgc.396.1521059031083; Wed, 14 Mar 2018 13:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521059031; cv=none; d=google.com; s=arc-20160816; b=dKfdRQWz+W7h00XDUauiHhmENPD98bZh8WEb7C0hjJWiuFY5r+HJp98fN3BHtoHwrt jrfp6x2LPKNznOS8uEj1UeSf67AToV30RSvB8N5rjxUj/8VXoDVEw5mhHoDexgNGQd+S I9147aHdD4NNNhlgclfnp9Cgxyr3YxcEI717OJyHMnlGDhfTdjKi/vtkaVgdk3bmZz3D dJFYyOkapUMA4HGe5knSD4411yXiWRGITeOuX99fYsFd6jfL1Ea7sOKpi5q131VcrSvr xv0aq3QJTOGokRlyPjtnK79n4BBgp86VkCSbG3kPsafcOQFcdWUtGzfunYs/jtA1AA2s w0fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Koe9chdemrZp7euLE4tQX/ciROVT3Kp81oiprem327Y=; b=hVFQ0jE19lJeDMTlHMbKWmTvRipgXwGVNezqFZ90VuidZDbwdwhBity6ivwNflQl36 NIOAFf/1pPFjzPv9rwsjynLMiN7CweYRc3zlt6rkEOUQXpHMHa5Acap6T/gKmY8Dp92/ nWVAIZJ1VMZ6hjPn06sxoQ+wDNX+U5aR74ePpP8ew6ZHDA9eHLxK7V9mf9sEoINQCdRi JTYwneuJj7tyRlGAkV2mjT/5tf0WTTF+VLg0kyOg34SazKjA87/GQOvFcAR42DhYd9g6 dYPthrKhA3+qpjo4m7JozSJmBaExjTVjXNW/xIdg94rtgX/CnOC782B60qB6bnIvmHFG +q8w== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o65si2606788pfj.316.2018.03.14.13.23.35; Wed, 14 Mar 2018 13:23:51 -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; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751597AbeCNUWe (ORCPT + 99 others); Wed, 14 Mar 2018 16:22:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34032 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751289AbeCNUWc (ORCPT ); Wed, 14 Mar 2018 16:22:32 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 58D647B4C8; Wed, 14 Mar 2018 20:22:32 +0000 (UTC) Received: from treble (ovpn-122-218.rdu2.redhat.com [10.10.122.218]) by smtp.corp.redhat.com (Postfix) with SMTP id 98BDA94562; Wed, 14 Mar 2018 20:22:29 +0000 (UTC) Date: Wed, 14 Mar 2018 15:22:29 -0500 From: Josh Poimboeuf To: Joe Lawrence Cc: Petr Mladek , Jiri Kosina , Miroslav Benes , Jessica Yu , Nicolai Stange , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] livepatch: Initialize shadow variables by init function safely Message-ID: <20180314202229.eck3aszdmwgsldyb@treble> References: <20180313155448.1998-1-pmladek@suse.com> <20180313155448.1998-2-pmladek@suse.com> <20180314192857.yfdk2uwn4okuzlfh@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 14 Mar 2018 20:22:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 14 Mar 2018 20:22:32 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jpoimboe@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 14, 2018 at 03:43:01PM -0400, Joe Lawrence wrote: > >> @@ -150,6 +145,23 @@ static void *__klp_shadow_get_or_alloc(void *obj, unsigned long id, void *data, > >> goto exists; > >> } > >> > >> + new_shadow->obj = obj; > >> + new_shadow->id = id; > >> + > >> + if (init_func) { > >> + int err; > >> + > >> + err = init_func(obj, new_shadow->data, init_data); > > > > Am I hallucinating, or will new_shadow->data always be NULL? How did it > > even work before? > > > struct klp_shadow { > struct hlist_node node; > struct rcu_head rcu_head; > void *obj; > unsigned long id; > char data[]; << not a pointer > }; Ah. This code needs a nice comment above the kzalloc() call, so I won't get confused again next time. -- Josh