Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2302155imj; Sun, 10 Feb 2019 23:57:40 -0800 (PST) X-Google-Smtp-Source: AHgI3IYvDI6+jPYfsM07KqUOv5aX7HxHycx6OkPjZs8mAvDAD08F4+rJWGzspRiDFbGjonSmuzBK X-Received: by 2002:a63:2905:: with SMTP id p5mr32569257pgp.178.1549871860627; Sun, 10 Feb 2019 23:57:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549871860; cv=none; d=google.com; s=arc-20160816; b=xO9gCaIYhqy9wdfCywakkuSnklK9KKvvhTdHsr6248EYZ+8/fnj61espTRwvpR6xtm 8JdFO0gVRJi2BVpblY55jA/WUvf/76w32Xd86hrrXy9an6nob0WLT2TtXIDjHyFUZdZT cF/pkb6SdMsUstr1WlXpgSv34hpKt4o0Cq7Pj7s0FX9QU7p3DJqoTbAhVuCGj/3gMxrr AYcxQqRn61+Od1YIOY0B8fzIrrHUW3RhKNO2+yW1gzerh3TG8gFcOyX6D4s1onU+pXaR 4O+AjdT+7C39bsB3fksPJwL3SyethJ9aaZWSaWDEteOOyCe9045j8MynqJqQPAxNTecO o7kA== 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:dkim-signature; bh=ygAEYs2cUK0TFmtHBpTd5q1OXKnqXfmKH4w1qi/rkyE=; b=yWcZ+Dg2I6cXPu9B3TaYgj6a15Ia9DuESaRvOZ0SydQdoGbqeRYKP22tvAM2pbbnhT wRdfs2ncDufXIauLgl+haVp39iobeeW2RwtV8yRbc1wRUINBCh1pdV5R+2hEIWSfPUAY HL8iFzu2Kr9hGH8oaONeHU1UXovw9t9uj9hSm2GmQPbzpj/E8RcQO+L9hQ6710Y30PCx f9rk9IuZKw8wL1W/B0Mxlvwe8hLu+wKu6nOVitwxjtsSePG7vBTXBYGDyx2c0OFi3FhF 6l63rSmjLf/I4XjFv/RzSdoulbPqmlBL+0vjBCiMxz+LU6vaWwm2ZCYimftNhefgl1e9 7Ldg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N2G2u39h; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m188si9931841pfb.266.2019.02.10.23.57.24; Sun, 10 Feb 2019 23:57:40 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N2G2u39h; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726814AbfBKHz3 (ORCPT + 99 others); Mon, 11 Feb 2019 02:55:29 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:41450 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725931AbfBKHz3 (ORCPT ); Mon, 11 Feb 2019 02:55:29 -0500 Received: by mail-pf1-f193.google.com with SMTP id b7so4885837pfi.8; Sun, 10 Feb 2019 23:55:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ygAEYs2cUK0TFmtHBpTd5q1OXKnqXfmKH4w1qi/rkyE=; b=N2G2u39hE7742HJ34qPv5zld3vE71j66atBmbESmuD7la48FpTSssaywppnOm5KUu4 Ylr+laAskz9xKmLsh3EPfmVfjTP7kOdiA7r+01vRcxQGNWZPXMXmWqOLtRd4SEa0H0V2 bOMTxVNwj/Qai5hZNZvVmdhu6Vgdz7xJ1ay3qKzuONaDiSUfkAWufnv3Sw+GGiYB7SHJ kSSBUgGO18OTpuHilZp1I5/+aDCHVTb1lX+gy07NjAsZb9OfRgi9s5GNPPYbZTaP5sYI OZtRGePYFQF+Ry/87MyrWPjMHWkdRv8AyoLQwFQge/RTYsdfFXQRQ39ThUjDvEm9PjgM 0y3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ygAEYs2cUK0TFmtHBpTd5q1OXKnqXfmKH4w1qi/rkyE=; b=AtdB3r+q7vDsALi/5Lyb+vqID9l2amNEfCxe1F7VWNH0Y2g8dlEYNbBYoP4quW4ekd SIirJmNHYuzwtEl+z4jKxkvATuM9wb4dD/Tq535coqG3OmHodSBaDoClQKZuFnblDzVl ecCAhT10JFfyDdIPVJYlBlE95YDedqIX6ies523LTWzqKVHd85jEwi2zaCoPViCCQ3/K PlEI615ELrLBL4GVorVWO71rxS14extocCY2y3YcCnL86nu6dlTfVXvvGQqqgeRLFGLv fshQFWhdH1Ax74jiN6Uj+kIy6d0vQXSPpi4GM2f0UfwvC1O1bjWiYNhXzrUW0YB66vn3 nU8w== X-Gm-Message-State: AHQUAuYH8E09fVwRcZEy+QYbcZzlyuu+Qf+6C+vGB5jLhYU6i0kvqy6z 1sbBEmOv7afd8EsJiBHP5HA= X-Received: by 2002:a63:da18:: with SMTP id c24mr16494423pgh.318.1549871728594; Sun, 10 Feb 2019 23:55:28 -0800 (PST) Received: from localhost ([175.223.48.87]) by smtp.gmail.com with ESMTPSA id y72sm14624151pfa.98.2019.02.10.23.55.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 10 Feb 2019 23:55:27 -0800 (PST) Date: Mon, 11 Feb 2019 16:55:24 +0900 From: Sergey Senozhatsky To: Steven Rostedt Cc: Michael Ellerman , linuxppc-dev@ozlabs.org, akpm@linux-foundation.org, tj@kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, dyoung@redhat.com, sergey.senozhatsky@gmail.com, pmladek@suse.com Subject: Re: [PATCH v3 1/7] dump_stack: Support adding to the dump stack arch description Message-ID: <20190211075524.GA26690@jagdpanzerIV> References: <20190207124635.3885-1-mpe@ellerman.id.au> <20190208185515.r6vkrezbd3odhpxt@home.goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190208185515.r6vkrezbd3odhpxt@home.goodmis.org> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (02/08/19 13:55), Steven Rostedt wrote: [..] > > + if (len) { > > + /* > > + * Order the stores above in vsnprintf() vs the store of the > > + * space below which joins the two strings. Note this doesn't > > + * make the code truly race free because there is no barrier on > > + * the read side. ie. Another CPU might load the uninitialised > > + * tail of the buffer first and then the space below (rather > > + * than the NULL that was there previously), and so print the > > + * uninitialised tail. But the whole string lives in BSS so in > > + * practice it should just see NULLs. > > + */ > > + smp_wmb(); > > This shows me that this can be called at a time when more than one CPU is > active. What happens if we have two CPUs calling dump_stack_add_arch_desc() at > the same time? Can't that corrupt the dump_stack_arch_desc_str? Can overwrite part of it, I guess (but it seems that Michael is OK with this). The string is still NULL terminated. The worst case scenario I can think of is not the one when two CPUs call dump_stack_add_arch_desc(), but when CPUA calls dump_stack_add_arch_desc() to append some data and at the same time CPUB calls dump_stack_set_arch_desc() and simply overwrites dump_stack_arch_desc_str. Not sure if this is critical (or possible). -ss