Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp387429ybt; Fri, 10 Jul 2020 02:23:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9tQchs/MjghL4ThOXUdJPZI0HwczL051jaF1mi3YmUhDR12AqTO9xLKI2ySC4pR0agYWb X-Received: by 2002:a17:906:c209:: with SMTP id d9mr36495680ejz.449.1594373002255; Fri, 10 Jul 2020 02:23:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594373002; cv=none; d=google.com; s=arc-20160816; b=Zrxna3SJHWHDZptKYb5/2UjzS2mdfqJrWZR/01z969hvRHPl76gqRS1rU+LP4ks5QX 4iWF7QKukw1Xc3c+s9bFm4PIPNNjVdpcQgFX3HBL1Ua/L3nQosq9/w5jihL6a+zWocJO AAWnQWaqVNxY7kYrqKCtueIl3QOFARR5Vew9M7K4rvkK4893anZkrWdLXlNdMej31U38 fvERhmBj5qRrpERZdgE/tJ7oUOWXV1Ojmep7Y9q9j6Ec8BHn3vNChDLchCREhHxnOzx7 Ks49CQoI28TtDEel2G9VIccy0GvX6H/rcZ/oOKq6n09I+gfwpULwRIv4Rz1OQil/FlXk zXVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=k3Fg5uwWi3YIL1ND93G+AfS7yVUtKWD1/rSB1uSDlrw=; b=L7iTi1wFYpbzOInJ8+i5eEtjsWuBkqRuCic6iERD9bkDhIEGOlq/WBV5TjELT1DPOn +UV6n4dAILcA9PgtW9qJCtG1rjYqFLLZ1PzG2yqmbh+Okq8Fm8+ouTsLOh3rDSiWiT6G 2A/chp4FK+8fhb1N82zmgy1g2VJOSzpJ+BNFSXYT3Jr1OzGJKnJ5mDI0pTlDDcEUB33l xeKJ8VH5TAG3vBS/7mRqDLS1qREFZiJ/N9mS+i/3KQwlgY7pBBInQ8xL14xp0wAT1R6Q PMhmA4UVXhcLAUmBXAqjKcs2dlganmjvAqb/80wrVyeA5K38N2/m9AvnwAar7FDdmO5+ T9WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V2AkEhpM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id k6si4130157edv.190.2020.07.10.02.22.59; Fri, 10 Jul 2020 02:23:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V2AkEhpM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726880AbgGJJUr (ORCPT + 99 others); Fri, 10 Jul 2020 05:20:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726288AbgGJJUq (ORCPT ); Fri, 10 Jul 2020 05:20:46 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6128C08C5CE; Fri, 10 Jul 2020 02:20:46 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id gc15so4344618pjb.0; Fri, 10 Jul 2020 02:20:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=k3Fg5uwWi3YIL1ND93G+AfS7yVUtKWD1/rSB1uSDlrw=; b=V2AkEhpMUH+KvSbxIjWFzekdSoByVCjiHrqM6j0Af5aT1HNGdfs/S13m1HgEk8L8uH /N+ZRBJbte83Mbv+EqjVgM/73jc2jrMwIV8u//7tMQkcsk7L9YOWqF9En11idEEYHNUo CoFyial+U9c+L8f3mh2CK0T76qzCiwTTrSwOqeJdmzbdvMlHPpCISev+77I/QmPj/KLk vfMLTuVDyLw+HrB5h9VhB3i3+k7CHItB+1q4s9QvbMAma+BU/qBRnXzpfolepnmrB7tY SLvZJGLljmjxie1ca/3PxOPcHsiBnIFdfWkfrd7fnmW3/SkvKfmwJcWpZrj77T5+5aAq I7mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=k3Fg5uwWi3YIL1ND93G+AfS7yVUtKWD1/rSB1uSDlrw=; b=PyDxvRIQITpInFu2a5HprzWpFB+lbuN4KFYZIGDUD/SepqwL9EYDHWCi6I46uEJ1n1 YqPG7wvrP8eDW1sJDV8K6ys+0f9mtX4oBDi5T5/+RJj94cdzlIZPojukGeo/XMyBKYqe Y9CEPuNN5abo9OrGxxHB7Gc9IaN2ngj86V8a2j07SRda8Mzy3bkgxQqn8snKCzxdWo+H Cu9ybHeWUlvqeI3Ti52+FGNGXRuc0iF+eMqt+Nk1VqBHWKRRWpZT/24SdVf7R5Ai/7eT pDphIztqAbBljebQO72U+73MIVHAvcqUkAxi8UEXnSwv0JM/A9eT6hP6nc+yYVuZQs8f acxA== X-Gm-Message-State: AOAM5319VXECIGJxIupDPTiWebWkLCmCI98wDS0cP7u1Z2pCq0kHE/DN a3xPSKxeHMkj/3uYUNAOLniDDqgygsxHzsj8 X-Received: by 2002:a17:90a:2a4d:: with SMTP id d13mr4505138pjg.195.1594372846367; Fri, 10 Jul 2020 02:20:46 -0700 (PDT) Received: from ubuntu-18.04-x8664 ([119.28.181.184]) by smtp.gmail.com with ESMTPSA id i23sm5580924pfq.206.2020.07.10.02.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:20:46 -0700 (PDT) From: Wenbo Zhang To: ast@kernel.org, daniel@iogearbox.net Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, ethercflow@gmail.com Subject: [PATCH] bpf: fix fds_example SIGSEGV error Date: Fri, 10 Jul 2020 05:20:35 -0400 Message-Id: <20200710092035.28919-1-ethercflow@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The `BPF_LOG_BUF_SIZE`'s value is `UINT32_MAX >> 8`, so define an array with it on stack caused an overflow. Signed-off-by: Wenbo Zhang --- samples/bpf/fds_example.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/bpf/fds_example.c b/samples/bpf/fds_example.c index d5992f787232..59f45fef5110 100644 --- a/samples/bpf/fds_example.c +++ b/samples/bpf/fds_example.c @@ -30,6 +30,8 @@ #define BPF_M_MAP 1 #define BPF_M_PROG 2 +char bpf_log_buf[BPF_LOG_BUF_SIZE]; + static void usage(void) { printf("Usage: fds_example [...]\n"); @@ -57,7 +59,6 @@ static int bpf_prog_create(const char *object) BPF_EXIT_INSN(), }; size_t insns_cnt = sizeof(insns) / sizeof(struct bpf_insn); - char bpf_log_buf[BPF_LOG_BUF_SIZE]; struct bpf_object *obj; int prog_fd; -- 2.17.1