Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp604951lqb; Fri, 24 May 2024 07:58:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXIDowkN0gAbXVOzGlZaUF2COuwdUZMgIW9ZwuUvQmprhNvLe11rzbynIQufqAlwWX4kwqLoqQQKBUotBAYIjoPLaLLWLCl8OJYT57Tog== X-Google-Smtp-Source: AGHT+IH/xLz7uJQNTNkEADWcWBMKlcvO0gT/mbHAhCfoNDmo7KaVKcabvzM9bxHCd8HuE6Un4hQf X-Received: by 2002:a05:6a21:1f24:b0:1af:fd3e:bc85 with SMTP id adf61e73a8af0-1b212e20cb0mr2728158637.40.1716562737168; Fri, 24 May 2024 07:58:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716562737; cv=pass; d=google.com; s=arc-20160816; b=j4OvgGWqwtO6PRzel39YIonoKBeI3CTHHgHTWPNeha37sSFsvWN1OGgksg1tnsgNys B7HDE6DUQKOsyW0XlwxVnQcGsrIIMU3RGFj8cATwfIGKa4Y3JuVQ98Kcy00rvymF1S4f Ylzn/tzkc2AHQbxTWOvC7brUebWFhZHlDVqh+ZG1arSt/qMcG8YQnESQYg2fZRK0SVTJ 6Hn2pB1xSexHaKv/kIXeBwLTtob3sifEagPShuTtCNQIPJbs82m+JNvjO7wGFtqjUjas nnowCkERxyfkrbNlnA6ro2DY8BNYc+Lq0UrvTg5uv5QDekhxwEmYQnWaL1jLY6A7l2EW vRlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=rcMspqehBFuBupFDxybL8n0NBRn8g86OZY15bYliGX4=; fh=IQzeG2Q3dR1RUvJv2PkmYN/uE0mCPEYyt/x9rhv26C0=; b=Tfz8NfGQJDzNmXHj5Wv9LVr5Q33IAc6QsVl+4tTxmBPv/lsU41i1F+kqmcWcuz6Bx1 ToRRLKL6cNboFav8jGBWEeFAHtoiljvU1sqvRQ5uF3Dx5TsI1N1IdcO2Q8A3e+OpyHw4 bBGUtAymWbzZwZv6gVSP0yui/RcY6IZ7N8yevGh8kd4v9v2LhRKnB+yamJHL4rE3esfT /omj0+5OVCLL68n7XfIc28qjdsY5u57x48sEkPIEStf6SUW8Qv8FPTW5pGx6Xxv28aLg 89DS2Reb0CrqIdrUG06coyAW11piYsTrGHB3l7eDxuJOnLoHW2tGFZ5Powsxs2NaObC4 qAcA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Hcr2Mbsm; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-188820-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188820-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6822779bf6csi1418243a12.302.2024.05.24.07.58.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 07:58:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188820-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Hcr2Mbsm; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-188820-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188820-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9EB13282A28 for ; Fri, 24 May 2024 14:58:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D9F5A12C7F8; Fri, 24 May 2024 14:58:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="Hcr2Mbsm" Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFEA012C55D for ; Fri, 24 May 2024 14:58:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716562729; cv=none; b=dhA9EiYd6jRzqTtcIuUCSzCqMoQ5rUE4/2ptJKXPYNqd2YrgirrhBs1PioyiwrndJL0kzrgPKR+iVESK9tQP0r0Ulotr+zI8+NBdDAzGZMqpZ/rWgB7ipqdvfqhEg4tgL5dmW6SaMGL7hcbSPdqLTddETcmB//brGvzaQxvlv+s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716562729; c=relaxed/simple; bh=2PAF37j9F18Nf5iuq9vX6tcKGUy44bEVYVrsHN5w9GU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=eDoPImnioofUZ0lsLz8NFCqALn46DUvQ74TYgmw0aTj+6T17waHDTWqaKJbBOn1Nyy9bmplCVoLcDMvUUR84FDVTK7Yxg+HRiVGaVMWlIsvRyQmXhacFE8Gz9TLswPU3+zmcqg88f08TbAf2cuYVTHlnOsV3qO5IhUt3f8Lh3oQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=Hcr2Mbsm; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-578517c8b49so1280575a12.3 for ; Fri, 24 May 2024 07:58:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1716562725; x=1717167525; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=rcMspqehBFuBupFDxybL8n0NBRn8g86OZY15bYliGX4=; b=Hcr2MbsmZ+IdUPrT/Z53hUrQBPhqvBWWOdoMYHlgkoHNeGvbgnDrrYd/lIY2mVd270 xIGtlZz4+UJxFwocspcYGdco3JsgV97huG1f44nlBNE4f9pp4g+MZM3c4rL62f6Gup5G 3EPJL0niAJZ/izTWY+e/dhHLXhZFJnwK5wd5Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716562725; x=1717167525; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rcMspqehBFuBupFDxybL8n0NBRn8g86OZY15bYliGX4=; b=BYB18uAC06LkzngwvsnAz/4hg9NIwg/ty0SqCfwFlyegAi1rNGNjWk/5JqMkKGkueI s4xHqFyqN8ltwUwdxc8+rLexNKhFAPhnlDiohbUlWAa0/uUGmO3pPiykZ9LgFpUSAZMy Ngw97ATlife0GocDIGfGd9cmERisXZtgn+4Po1LqniOyfGtnGoxRa6LDtkLHSUpfAYQn BLwdpcyR4CqA33qJvSpyBQnoy9dr27akVvd+0II0a7GJBY2ca3lFo+mntHtHKuqz9z+x kPtJRxU0olGDdbH9u4dKcqpAR9ziD887rBdANIcuPylCugihOuFgl3ZJOqsn0Cw6hr5M VTIw== X-Forwarded-Encrypted: i=1; AJvYcCVtI4rF4tIWJZ3ok4NjkFXtRq69kj5+vD9dvVoG3IJXNaRtM32H49pqpTgZmSW7W1HjwFgyAutdUBSIxFBX9btG8m5L6NpSGcoZynw1 X-Gm-Message-State: AOJu0YwWaAHCt5zPdsilPTC5YBgsTZsuumu3skeNP7NsL7r2IzXmCE4F 1TDeynV9kF10ex4RCqVnIcEsjjImeWbKOLZgARkYLoY9Wo6XoqyXuhp5q1DBM6Q5NEkgIctAi0T Z3j9BrA== X-Received: by 2002:a50:aacd:0:b0:572:4702:2227 with SMTP id 4fb4d7f45d1cf-57851a98927mr1640024a12.35.1716562724992; Fri, 24 May 2024 07:58:44 -0700 (PDT) Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com. [209.85.218.50]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57852495dbasm1821249a12.78.2024.05.24.07.58.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 May 2024 07:58:44 -0700 (PDT) Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a6266fff501so123555166b.1 for ; Fri, 24 May 2024 07:58:44 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWkvRRtBK1KU5nOnO5/VX/qa4OkjJe4KF5xlFFT5E7juspR0UU46AoAqnZiPAB/gNRZQXBkRqltiNq8fWHEfUywR1SST+eQ+blODEX7 X-Received: by 2002:a17:906:2296:b0:a59:afba:d0a4 with SMTP id a640c23a62f3a-a62641de237mr167222666b.23.1716562723858; Fri, 24 May 2024 07:58:43 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Fri, 24 May 2024 07:58:26 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH workqueue/for-6.10-fixes] workqueue: Refactor worker ID formatting and make wq_worker_comm() use full ID string To: Yafang Shao Cc: bpf , Tejun Heo , Jan Engelhardt , Craig Small , linux-kernel@vger.kernel.org, Lai Jiangshan Content-Type: text/plain; charset="UTF-8" On Fri, 24 May 2024 at 00:43, Yafang Shao wrote: > > Actually, there are already helpers for this: get_task_comm() and > __get_task_comm(). We can simply replace the memcpy() with one of > these No. We should get rid of those horrendous helpers. > If the task_lock() in __get_task_comm() is a concern, we could > consider adding a new __get_current_comm(). The task_lock is indeed the problem - it generates locking problems and basically means that most places cannot use them. Certainly not things like tracing etc. The locking is also entirely pointless\, since absolutely nobody cares. If somebody is changing the name at the same time - which doesn't happen in practice - getting some halfway result is fine as long as you get a proper NUL terminated result. Even for non-current, they are largely useless. They were a mistake. So those functions should never be used for any normal thing. Instead of locking, the function should literally just do a "copy a couple of words and make sure the end result still has a NUL at the end". That's literally what selinuxfs.c wants, for example - it copies the thing to a local buffer not because it cares about some locking issue, but because it wants one stable value. But by using 'memcpy()' and that fixed size, it means that we can't sanely extend the source size because now it wouldn't be NUL-terminated. But selinux never wanted a lock, and never wanted any kind of *consistent* result, it just wanted a *stable* result. Since user space can randomly change their names anyway, using locking was always wrong for readers (for writers it probably does make sense to have some lock - although practically speaking nobody cares there either, but at least for a writer some kind of race could have long-term mixed results) Oh well. Linus