From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C6AE1A00C2; Fri, 14 Oct 2022 01:39:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60B154014F; Fri, 14 Oct 2022 01:39:34 +0200 (CEST) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by mails.dpdk.org (Postfix) with ESMTP id 92EAF400D4 for ; Fri, 14 Oct 2022 01:39:32 +0200 (CEST) Received: by mail-pj1-f46.google.com with SMTP id 70so3366867pjo.4 for ; Thu, 13 Oct 2022 16:39:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:subject:cc:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=dvqFTA6i6XAPaGrgFJP89YKImO16NWPPY+AqQUezPTA=; b=fYZxN7EY52+bTZ6VuyHegABcBH84cRwnOpAI0tRwwWJLe9tIiG8ZVFXXzMyMUkdm01 dCG3iT5gE8GI2Bbjmm86J/IVDT737wIGCBJjHbUIsrB7Z5yuLYppeYucpGFbObe9bUEE Gam4VNwbbhElwpE5Mb9saTdLWt6DoYUre948AkHQC3yZeuyijFU8azwBs67yG5bFWcKR P+XudbfZpRqaneFiR4nik05dXNvvAAoRrL2JLPAPAW1lpRau3GEAGnsjFZ5BEeuPsasi 2FimtrQ9JhEhQlK5Kuj8+2//orkoXcdHjCKVGjXTYigyL7L+t4xCzNiojqE8Kaj6Vvq2 7gSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:subject:cc:to :from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dvqFTA6i6XAPaGrgFJP89YKImO16NWPPY+AqQUezPTA=; b=CnpjvJF7fNpHLsa42MPspFv2DqEqHk231WIEoB8tq8v8K4+C5KgJLf3Jq6o7LItZJh Hs/fGx/A6x0Zn+OWuUVUvSSalWWFU9hg1qBXQbYgkb307plKdter57/lSXgKzoY68Tv5 6qk7hqyFID1P/gmPqq9TY8P31z5Q+Bxz/B7JQUB9TXzoz+4aDlTNPefvNZvDKqYfBu5i e3LQYOoh2W1i+q0lWzmweG40VBsJmk88mJNnKzqFKAZi7a2CbFg/jPUL9hI5o9js6rh7 oD0IVMGVURh55Kz2AKwpSD9UmlUyCV43cqAuou6xLvL6yMRV/D2jqiiXca2KA52W+Zl8 VXLA== X-Gm-Message-State: ACrzQf0isCNarVZqJQRUuPhz0wkhchglGMqsdsiV3iMGikKfrEIqemkW Hwf31XTV1n7/X1bnBGLD6FBMZA== X-Google-Smtp-Source: AMsMyM4tK6LSe55RrguHS4rPLWtXarge/ZXvSHS0AzFdqOLHnSz51Qk3KqnOQVlacXqEYMj4xgmlhA== X-Received: by 2002:a17:90a:e7ca:b0:20a:966e:8480 with SMTP id kb10-20020a17090ae7ca00b0020a966e8480mr13757398pjb.100.1665704371501; Thu, 13 Oct 2022 16:39:31 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id b15-20020a170902650f00b0017f59ebafe7sm359031plk.212.2022.10.13.16.39.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 16:39:31 -0700 (PDT) Date: Thu, 13 Oct 2022 16:39:28 -0700 From: Stephen Hemminger To: ": Ruifeng Wang" , Honnappa Nagarahalli Cc: dev@dpdk.org Subject: Unsafe memory access in testpmd Message-ID: <20221013163928.49930348@hermes.local> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Noticed that test-pmd is using a signal handler to exit. And that signal handle clears a flag "f_quit". But that variable is updated without atomic and is not volatile. Simple fix to use atomic, would fix that part. But the signal_handler is calling a bunch of functions that are not safe in a signal handler. The signal handler in testpmd should only be doing atomic update of f_quit. All the cleanup logic needs to be moved to a place where thread is an safe state, like after exiting the forwarding loop in main thread. The problem is that testpmd has grown in complexity and not sure if this won't break other things.