From: Rob Herring <firstname.lastname@example.org> To: Linus Torvalds <email@example.com> Cc: Guenter Roeck <firstname.lastname@example.org>, Linux Kernel Mailing List <email@example.com>, Frank Rowand <firstname.lastname@example.org> Subject: Re: Linux 5.12-rc5 Date: Mon, 29 Mar 2021 13:41:42 -0500 [thread overview] Message-ID: <CAL_JsqKxLy3Gc8d1Q23AQaWTKLmc_a28tokZZ08rHnV2qU0iew@mail.gmail.com> (raw) In-Reply-To: <CAHk-=wiMoP9PifpuUnQ3xmAM_LmGARr+fxFuOSX1rvh2mz35Mw@mail.gmail.com> n Mon, Mar 29, 2021 at 1:05 PM Linus Torvalds <email@example.com> wrote: > > On Sun, Mar 28, 2021 at 7:07 PM Guenter Roeck <firstname.lastname@example.org> wrote: > > > > This is not really a new problem. I enabled devicetree unit tests > > in the openrisc kernel and was rewarded with a crash. > > https://email@example.com/ > > has all the glorious details. > > Hmm. > > I'm not sure I love that patch. > > I don't think the patch is _wrong_ per se, but if that "require 8 byte > alignment" is a problem, then this seems to be papering over the issue > rather than fixing it. > > So your patch protects from a NULL pointer dereference, but the > underlying issue seems to be a regression, and the fix sounds like the > kernel shouldn't be so strict about alignment requirements. In the interest of the DT unittests not panicking and halting boot, I think we should handle NULL pointer. > I guess we could make ARCH_SLAB_MINALIGN be at least 8 (perhaps only > if the allocations is >= 8) but honestly, I don't think libfdt merits > making such a big change. Small allocations are actually not uncommon > in the kernel, and on 32-bit architectures I think 4-byte allocations > are normal. > > So I'd be inclined to just remove the new > > /* The device tree must be at an 8-byte aligned address */ > if ((uintptr_t)fdt & 7) > return -FDT_ERR_ALIGNMENT; > > check in scripts/dtc/libfdt/fdt.c which I assume is the source of the > problem. Rob? That is the source, but I'd rather not remove it as we try to avoid any modifications from upstream. And we've found a couple of cases of not following documented alignment requirements. > Your patch to then avoid the NULL pointer dereference seems to be then > an additional safety, but not fixing the actual regression. I think the right fix is not using kmemdup which copies the unittest dtb. Rob
next prev parent reply other threads:[~2021-03-29 18:43 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-28 23:05 Linus Torvalds 2021-03-29 2:07 ` Guenter Roeck 2021-03-29 18:05 ` Linus Torvalds 2021-03-29 18:41 ` Rob Herring [this message] 2021-03-29 19:04 ` Frank Rowand 2021-03-29 19:42 ` Guenter Roeck
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=CAL_JsqKxLy3Gc8d1Q23AQaWTKLmc_a28tokZZ08rHnV2qU0iew@mail.gmail.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: Linux 5.12-rc5' \ /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
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).