linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: наб <nabijaczleweli@nabijaczleweli.xyz>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	Bagas Sanjaya <bagasdotme@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Federico Vaga <federico.vaga@vaga.pv.it>,
	Alex Shi <alexs@kernel.org>, Yanteng Si <siyanteng@loongson.cn>,
	Hu Haowen <src.res@email.cn>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc-tw-discuss@lists.sourceforge.net,
	Eric Biederman <ebiederm@xmission.com>,
	Kees Cook <keescook@chromium.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Linux MM <linux-mm@kvack.org>
Subject: Re: [PATCH v4 02/18] a.out: remove define-only CMAGIC, previously magic number
Date: Mon, 26 Sep 2022 17:15:54 +0200	[thread overview]
Message-ID: <20220926151554.7gxd6unp5727vw3c@tarta.nabijaczleweli.xyz> (raw)
In-Reply-To: <CAMuHMdWxf=+CnwXT61VvYhcHi093rz=0ftWQXKVviMunzE1HHw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3858 bytes --]

Hi!

On Mon, Sep 26, 2022 at 10:16:02AM +0200, Geert Uytterhoeven wrote:
> Thanks for your patch, which is now commit 53c2bd679017277f
> ("a.out: remove define-only CMAGIC, previously magic number") in
> driver-core/driver-core-next.
> 
> On Fri, Sep 16, 2022 at 12:40 AM наб <nabijaczleweli@nabijaczleweli.xyz> wrote:
> > The last user was removed in 5.1 in
> > commit 08300f4402ab ("a.out: remove core dumping support")
> > but this is part of the UAPI headers, so this may want to either wait
> > until a.out is removed entirely, or be removed from the magic number doc
> > and silently remain in the header
> 
> Indeed. This is part of uapi, and might break some unknown
> userspace, while the gain is limited.  Do we really want to reduce
> include/uapi/linux/a.out.h piecewise (e.g. N_BADMAG() seems to be
> unused, too), instead of keeping it until a.out support is removed
> completely?

Not really, but it looked like a magic number in the magic-number.rst
sense due to the field being "magic" and the unintuitive type naming:
I hadn't realised it's part of the on-disk format
re-examination shows that it very well may be (have been).

> Anyway, even at that point, it might be wise to keep the header file
> around, as people have expressed the desire to run a.out binaries
> through a userspace-compatibility wrapper.

Agreed. Scissor-patch that reverts the removal below.

> > A cursory glance on DCS didn't show any user code actually using this
> > value
> 
> What is DCS?

Debian Code Search; in this case my query was:
  https://codesearch.debian.net/search?q=%5CbCMAGIC%5Cb&literal=0

There's a few false positives here but all results that are using CMAGIC
to mean this CMAGIC (and aren't hurd code copied from linux)
just re-define it.

> >  Documentation/process/magic-number.rst                    | 1 -
> >  Documentation/translations/it_IT/process/magic-number.rst | 1 -
> >  Documentation/translations/zh_CN/process/magic-number.rst | 1 -
> >  Documentation/translations/zh_TW/process/magic-number.rst | 1 -
> >  include/uapi/linux/a.out.h                                | 3 ---
> >  5 files changed, 7 deletions(-)
> > 
> > diff --git a/include/uapi/linux/a.out.h b/include/uapi/linux/a.out.h
> > index 5fafde3798e5..bb15da96df2a 100644
> > --- a/include/uapi/linux/a.out.h
> > +++ b/include/uapi/linux/a.out.h
> > @@ -70,9 +70,6 @@ enum machine_type {
> >     The first page is unmapped to help trap NULL pointer references */
> >  #define QMAGIC 0314
> >
> > -/* Code indicating core file.  */
> > -#define CMAGIC 0421
> > -
> >  #if !defined (N_BADMAG)
> >  #define N_BADMAG(x)      (N_MAGIC(x) != OMAGIC         \
> >                         && N_MAGIC(x) != NMAGIC         \
> 
> Gr{oetje,eeting}s,
>                         Geert

Best,
наб

-- >8 --
Subject: [PATCH] a.out: restore CMAGIC

Part of UAPI and the on-disk format:
this means that it's not a magic number per magic-number.rst,
and it's best to leave it untouched to avoid breaking userspace
and suffer the same fate as a.out in general

Fixes: commit 53c2bd679017 ("a.out: remove define-only CMAGIC,
 previously magic number")
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
 include/uapi/linux/a.out.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/a.out.h b/include/uapi/linux/a.out.h
index bb15da96df2a..5fafde3798e5 100644
--- a/include/uapi/linux/a.out.h
+++ b/include/uapi/linux/a.out.h
@@ -70,6 +70,9 @@ enum machine_type {
    The first page is unmapped to help trap NULL pointer references */
 #define QMAGIC 0314
 
+/* Code indicating core file.  */
+#define CMAGIC 0421
+
 #if !defined (N_BADMAG)
 #define N_BADMAG(x)	  (N_MAGIC(x) != OMAGIC		\
 			&& N_MAGIC(x) != NMAGIC		\
-- 
2.30.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-09-26 17:35 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06  0:38 [PATCH] Documentation/process/magic-number.rst: kill наб
2022-09-07  3:50 ` Bagas Sanjaya
2022-09-07 23:11   ` [PATCH v2] Documentation: remove magic number doc наб
2022-09-14  2:22     ` Bagas Sanjaya
2022-09-14 23:32       ` [PATCH v3] " наб
2022-09-15 13:16         ` Greg KH
2022-09-15 22:38           ` [PATCH v4 01/18] Documentation: remove nonexistent magic numbers наб
2022-09-15 22:38           ` [PATCH v4 02/18] a.out: remove define-only CMAGIC, previously magic number наб
2022-09-26  8:16             ` Geert Uytterhoeven
2022-09-26 15:15               ` наб [this message]
2022-09-26 16:47                 ` Greg KH
2022-09-15 22:39           ` [PATCH v4 03/18] Bluetooth: RFCOMM: remove define-only RFCOMM_TTY_MAGIC ex-magic-number наб
2022-09-15 22:39           ` [PATCH v4 04/18] MIPS: remove define-only GDA_MAGIC, previously magic number наб
2022-09-15 22:39           ` [PATCH v4 05/18] Documentation: HFS is not a user of magic numbers наб
2022-09-15 22:39           ` [PATCH v4 06/18] Documentation: sndmagic.h doesn't exist наб
2022-09-15 22:39           ` [PATCH v4 07/18] Documentation: zh: remove references to IrDA наб
2022-09-15 22:39           ` [PATCH v4 08/18] Documentation: zh: remove stale magic numbers наб
2022-09-15 22:39           ` [PATCH v4 09/18] Documentation: CG_MAGIC isn't a magic number наб
2022-09-15 22:39           ` [PATCH v4 10/18] Documentation: FULL_DUPLEX_MAGIC " наб
2022-09-15 22:39           ` [PATCH v4 11/18] Documentation: RIEBL_MAGIC " наб
2022-09-15 22:39           ` [PATCH v4 12/18] Documentation: SAVEKMSG_MAGIC[12] aren't magic numbers наб
2022-09-15 22:39           ` [PATCH v4 13/18] Documentation: COW_MAGIC isn't a magic number наб
2022-09-15 22:40           ` [PATCH v4 14/18] Documentation: EEPROM_MAGIC_VALUE " наб
2022-09-15 22:40           ` [PATCH v4 15/18] Documentation: FW_HEADER_MAGIC " наб
2022-09-15 22:40           ` [PATCH v4 16/18] nbd: remove define-only NBD_MAGIC, previously " наб
2022-09-15 22:40           ` [PATCH v4 17/18] Documentation: NBD_REPLY_MAGIC isn't a " наб
2022-09-15 22:40           ` [PATCH v4 18/18] Documentation: ENI155_MAGIC " наб

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220926151554.7gxd6unp5727vw3c@tarta.nabijaczleweli.xyz \
    --to=nabijaczleweli@nabijaczleweli.xyz \
    --cc=alexs@kernel.org \
    --cc=bagasdotme@gmail.com \
    --cc=corbet@lwn.net \
    --cc=ebiederm@xmission.com \
    --cc=federico.vaga@vaga.pv.it \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-doc-tw-discuss@lists.sourceforge.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=siyanteng@loongson.cn \
    --cc=src.res@email.cn \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).