From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9609 invoked by alias); 6 Oct 2016 16:13:56 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 9595 invoked by uid 89); 6 Oct 2016 16:13:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-2.1 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=wi, wi=c4, Hx-languages-length:1151, happily?= X-HELO: mail-qt0-f180.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=JsKJbRd9u5kiU9VzTQO1te10u9nzVhWjWuI46xXGV3k=; b=gwiHZs+5q+4VkthC9wWKIgaGjeNR5f75pNxaIOj6LV0xLI2K3RzOelhAtlcBp2UGQh 0rvKtoZdzPAWwSdIiPZ7pyA8V6149Ln0wYEUzXlQioz34DHRe2OpO+OuGmPyactVgeCz JX2Atllz8H0py+hbsjsa1iE2BcRhsBjTQQk6hmzZpggOScZ6xBJAPIcvlTXEmd7Fvr8S Ke/Pa4MsD0P4h6wGp5wtJnKC3ELt77bT5p7QdAHFLcy+TBPyYVB1nH2/yfUzQGyWdX73 3Kr7hMkxZ2/VyPhPYa6fNQUG9Q7r677jBIAJw7VOfFIoQJjFb8s7eVUDm8JPXfwWGeZB ApWA== X-Gm-Message-State: AA6/9RniIVndu7UqJsedPpjCz2KX6JS8XevtRE9KAaNiqzwRKsGbHVETiqxLwm5VLz78oNw6RrmYewXUi7vAYg== X-Received: by 10.200.57.166 with SMTP id v35mr15746886qte.36.1475770421815; Thu, 06 Oct 2016 09:13:41 -0700 (PDT) MIME-Version: 1.0 From: =?UTF-8?B?Um9iZXJ0IMWad2nEmWNraQ==?= Date: Thu, 06 Oct 2016 16:13:00 -0000 Message-ID: Subject: Caching of PID/TID after fork To: libc-alpha@sourceware.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2016-10/txt/msg00136.txt.bz2 Hi, This has probably been debated a lot of times in the past, but... A lot of tool these days create Linux namespaces, using clone(). Using glibc's clone() is not the best option, because e.g. it requires stack pointer, (and fails with some error if it's NULL), while Linux kernel will happily reuse the current SP (no need to write additional code to deal with that). So, glibc's clone() adds imposed additional restrictions wrt kernel. And, after that getpid() will return old PID/TID. It seems that currently Linux supports getpid() via vsyscall (fast) on x86/64. Would you consider changing getpid() to be a wrapper to syscall(__NR_getpid)? One could say that if somebody uses syscall(__NR_clone) she/he should be using syscall(__NR_getpid) as well, but in case of software libraries, which might be preparing namespaces, the caller of the lib might know nothing about the exact method used to create a new process. Thefore I'd like to ask for one of the following solutions: 1. Don't cache PID/TID 2. Provide some kind of symbol, which would force for TID/PID to be reloaded in glibc. --=20 Robert =C5=9Awi=C4=99cki