Am 08.09.2023 um 15:53 schrieb Sascha Hauer:
> On Fri, Sep 08, 2023 at 12:16:46PM +0200, Gerald Loacker wrote:
>> The i2c bus gets disabled without sending a stop condition. This violates
>> i2c timing on the clock line. Fix this and include all related functions
>> (rk_i2c_send_start_bit,
Hi Ahmad,
On Mon, Sep 11, 2023 at 05:09:00PM +0200, Ahmad Fatoum wrote:
> Now that we have two mechanisms for detecting stack overflows, add a
> command to intentionally trigger stack frame and stack region overflow
> to verify their correct operation.
>
> Signed-off-by: Ahmad Fatoum
> ---
>
barebox now compiles an initially empty device tree that's combined with
the device tree passed by Qemu. That device tree can hold the FIT public
key or if CONFIG_EXTERNAL_DTS_FRAGMENTS is enabled, device tree nodes
passed at build time. If this device tree fragment adds an alias, it
won't be
Hi,
On 30.08.23 16:41, Ahmad Fatoum wrote:
> On 30.08.23 12:47, Alexander Shiyan wrote:
>> +
>> +len = (eeprom.sn[0] - '0');
>> +if ((len < 8) || (len > 64)) {
>> +pr_err("Unable to get product serial\n");
>> +return -EINVAL;
>> +}
>> +
>> +strncpy(str,
On 05.09.23 10:25, Ahmad Fatoum wrote:
> On 31.08.23 11:41, Alexander Shiyan wrote:
+struct id_eeprom {
+ u8 hrcw_primary[0x10];
+ u8 pn[64];
+ u8 sn[64];
+ u8 mac0[6];
+ u8 mac1[6];
+} __packed;
>>>
>>> You could describe this as nvmem-cells
From: Ahmad Fatoum
Especially during development, devices often lack a MAC address. While a
MAC address can be easily added to the environment:
nv dev.eth0.ethaddr="aa:bb:cc:dd:ee:ff"
It's easily lost when flashing complete new images, e.g. from CI.
Make the development experience neater by
libsystemd provides a sd_id128_get_machine_app_specific() function that
allows deriving an application specific UUID without directly leaking
the machine ID.
Let's provide an equivalent for barebox that will be used in a following
commit to generate a stable MAC instead of randomizing it.
Linux has a number of helpers to do arithmetic on Ethernet addresses,
which are useful for generating sequential MAC addresses. Import them.
Signed-off-by: Ahmad Fatoum
---
include/net.h | 71 +++
1 file changed, 71 insertions(+)
diff --git
lib: stackprotector: add prompt text to option
Kconfig rightfully complains about it:
lib/Kconfig.hardening:66:warning: choice value must have a prompt
So add it.
Signed-off-by: Ahmad Fatoum
---
lib/Kconfig.hardening | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
The current alignment of 4 bytes is too low. Access to 64-bit data via
ldrd/strd requires at least an eight byte alignment:
| Prior to ARMv6, if the memory address is not 64-bit aligned, the
| data read from memory is UNPREDICTABLE. Alignment checking (taking
| a data abort), and support
TLSF struct block_header_t doesn't describe a single block, but
instead its first member covers the previous block:
.~~~.
| prev_phys_block |
End of previous block --> |———| <-- Start of a free block
Have The expect_alloc_* functions currently only know whether the
pointer is NULL or not. Have them get the full pointer value and return
it instead.
No functional change.
Signed-off-by: Ahmad Fatoum
---
test/self/malloc.c | 82 +-
1 file changed, 59
TLSF currently uses only 4-byte alignment on 32-bit platforms, which isn't
enough for ldrd/strd on ARMv7. This series reworks TLSF a bit, so we always
have at least 8 byte alignment. dlmalloc already has 8 byte alignment
minimum, so nothing to do there.
This has the added benefit of giving TLSF
We used to have following alignments:
32-bit CPU 64-bit CPU
dummy8 bytes 8 bytes
dlmalloc 8 bytes 16 bytes
tlsf 4 bytes 8 bytes
With recent change to TLSF, we now always have at least 8 bytes as
alignment. To make this
The test shouldn't leak memory, even if it fails. Fix the leaks.
Signed-off-by: Ahmad Fatoum
---
test/self/malloc.c | 14 +++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/test/self/malloc.c b/test/self/malloc.c
index 6b3002ff0996..47c225ac6a10 100644
---
The struct control_t describing a pool is allocated at its very start
and then directly followed by the first block. To ensure the first block
is suitably aligned, align_up the size in tlsf_size(). So far, TLSF on
32-bit and 64-bit happened to be aligned, so this introduces no
functional change
static const is not a compiletime expression in C, unlike C++ and
treating them the same just means that we just restrict where we can
use the constants, e.g. they are not appropriate for static_assert.
Turn them into proper macros to fix this. To keep the code easier to
sync with other TLSF
In preparation for adding stack protector support, we need to start
marking functions run before the C environment is completely set up.
Introduce a __prereloc attribute for this use case and an even stronger
no noinstr (no instrumentation) attribute and start adding it at enough
places for
GCC's strong stack protector feature is increasingly used as default in
many distros, because of comparatively low overhead. This series adds
support in barebox to catch stack frame overflow as well as a guard
page feature to catch stack region overflow.
Ahmad Fatoum (5):
include: move PAGE_
GCC's "stack-protector" puts, at the beginning of functions, a canary value
on the stack just before the return address, and validates the value just
before actually returning. Stack based buffer overflows (that need to
overwrite this return address) now also overwrite the canary, which gets
While barebox stack is often quite generous, due to its default of 32K,
bugs can make it overflow and on ARM, this clobbers the page tables
leading to even harder to debug problems than usual.
Let's add a 4K buffer zone between the page tables and the stack and
configure the MMU to trap all
Now that we have two mechanisms for detecting stack overflows, add a
command to intentionally trigger stack frame and stack region overflow
to verify their correct operation.
Signed-off-by: Ahmad Fatoum
---
commands/Kconfig | 6 +
commands/Makefile | 1 +
commands/stacksmash.c |
is a fat header and we shouldn't need to include it just to
get a definition for PAGE_SIZE. In Linux PAGE_SIZE is defined per
architecture, but in barebox we only have 4K pages so far, so let's move
it into .
Signed-off-by: Ahmad Fatoum
---
include/common.h| 6 +-
Calling dump_stack() in response to failing assertions can be useful to
pinpoint where things started going awry. This is also done in TLSF
code, but dump_stack actually calls malloc, because it uses the logging
functions instead of printing directly to console.
To avoid circular dependencies and
Rule of thumb is to print interactive output to stdout and status
messages to stderr. A stack dump falls into the latter category and part
of the stack trace is already printed to stderr, because of use of the
logging functions, which always prints there.
Signed-off-by: Ahmad Fatoum
---
Part of KASan output, like the stack trace, is already printed to
stderr, while some others are printed to stdout. Let's print everything
to stderr as not to complicate debugging when stdout and stderr go to
different consoles.
Signed-off-by: Ahmad Fatoum
---
lib/kasan/report.c | 2 +-
1 file
I recently hunted down a heap memory corruption and this was somewhat
complicated by KASan and dump_stack() themselves allocating memory
off the heap. This series switches them to directly write to the
consoles associated with stderr, while skipping the log.
Ahmad Fatoum (4):
ARM: unwind: don't
The logging functions call the pr_* family of functions, which not only
add pretty-colored prefix, but also allocate memory appending to the
log.
While KASAN protects against recursion while printing the log, this can
falsify debugging results, so let's ensure, we only print to stderr and
nothing
On 23-09-11, Ahmad Fatoum wrote:
> fsl,tempmon-data is a deprecated property that has been replaced
> upstream by a NVMEM cell pointing at the calibration value and so
> made it into barebox breaking the driver.
>
> Switch to using the new property to fix the regression.
>
> We do not keep
fsl,tempmon-data is a deprecated property that has been replaced
upstream by a NVMEM cell pointing at the calibration value and so
made it into barebox breaking the driver.
Switch to using the new property to fix the regression.
We do not keep support for the old binding around as it would be
On 23-09-11, Ahmad Fatoum wrote:
> On 11.09.23 14:35, Marco Felsch wrote:
> > On 23-09-11, Ahmad Fatoum wrote:
> >> fsl,tempmon-data is a deprecated property that has been replaced
> >> upstream by a NVMEM cell pointing at the calibration value and so
> >> made it into barebox breaking the driver.
On 23-09-11, Ahmad Fatoum wrote:
> On 11.09.23 14:29, Marco Felsch wrote:
> > On 23-09-11, Ahmad Fatoum wrote:
> >> While we'll continue to support barebox,provide-mac-address, new boards
> >> should prefer using the upstream NVMEM binding for describing the MAC
> >> address.
> >>
> >> Add an
On 11.09.23 14:35, Marco Felsch wrote:
> On 23-09-11, Ahmad Fatoum wrote:
>> fsl,tempmon-data is a deprecated property that has been replaced
>> upstream by a NVMEM cell pointing at the calibration value and so
>> made it into barebox breaking the driver.
>>
>> Switch to using the new property to
On 11.09.23 14:29, Marco Felsch wrote:
> On 23-09-11, Ahmad Fatoum wrote:
>> While we'll continue to support barebox,provide-mac-address, new boards
>> should prefer using the upstream NVMEM binding for describing the MAC
>> address.
>>
>> Add an example to the documentation.
>>
>> Signed-off-by:
On 23-09-11, Ahmad Fatoum wrote:
> fsl,tempmon-data is a deprecated property that has been replaced
> upstream by a NVMEM cell pointing at the calibration value and so
> made it into barebox breaking the driver.
>
> Switch to using the new property to fix the regression.
The Linux driver code
On 23-09-11, Ahmad Fatoum wrote:
> While we'll continue to support barebox,provide-mac-address, new boards
> should prefer using the upstream NVMEM binding for describing the MAC address.
>
> Add an example to the documentation.
>
> Signed-off-by: Ahmad Fatoum
> ---
>
GCC complains about ino not being defined in some cases, which appears
to be a false positive. Nevertheless, initialize it to the same fallback
value used in ext4fs_get_ino, which is called below.
Signed-off-by: Ahmad Fatoum
---
fs/ext4/ext_barebox.c | 2 +-
1 file changed, 1 insertion(+), 1
While we'll continue to support barebox,provide-mac-address, new boards
should prefer using the upstream NVMEM binding for describing the MAC address.
Add an example to the documentation.
Signed-off-by: Ahmad Fatoum
---
.../bindings/misc/fsl,imx-ocotp.rst | 25 ---
1
fsl,tempmon-data is a deprecated property that has been replaced
upstream by a NVMEM cell pointing at the calibration value and so
made it into barebox breaking the driver.
Switch to using the new property to fix the regression.
Fixes: abef60363d8e ("dts: update to v5.8-rc1")
Signed-off-by:
struct hwrng defined in the file embeds a struct device, so inclusion
of the header defining it is in order.
Signed-off-by: Ahmad Fatoum
---
include/linux/hw_random.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index
It can be sometimes useful to add manual poisoning with KASAN to track
down errant accesses. This is complicated a bit, because some files are
build for both PBL and barebox proper. To make such debugging easier,
let's allow to be included from PBL code.
Signed-off-by: Ahmad Fatoum
---
At the end of sdhci_transfer_data_dma, sdhci_set_sdma_addr is called to
set the next DMA address. Recently, the computation of the next DMA
address was changed and instead of storing the next SDMA address into a
dedicated local variable as before, it was stored into the existing `dma'
variable.
Given that we are not using the feature, there's no reason to compute
the boundary when polling for DMA completion. Therefore let's assume
the initial default of 512K remains unchanged. The sdhci::sdma_boundary
member is still left in place as the i.MX eSDHC driver sets it to zero
to affect what
Recent changes to teach SDHCI 64-bit support inadvertently changed
the address used for cache maintenance away from the DMA buffer address
with the result that unrelated cache lines were dropped and memory
corruption. This series fixes this. I must admit I don't understand
how the SDMA boundary
Am 08.09.2023 um 15:11 schrieb Sascha Hauer:
> On mdio busses the attached phys check for link status in a poller.
> Add a slice dependency from the mdio bus to the I2C/SPI controller
> so that we do not end up doing bus accesses while we are in a
> I2C/SPI access on the same bus already.
>
>
Am 08.09.2023 um 15:11 schrieb Sascha Hauer:
> Add a slice for SPI controllers so that devices using SPI in the background
> can check if a SPI bus is busy.
>
> Signed-off-by: Sascha Hauer
Tested-by: Gerald Loacker
> ---
>
> Notes:
> Changes since v1:
> - Add forgotten
Am 08.09.2023 um 15:11 schrieb Sascha Hauer:
> Add a slice for I2C adapters so that devices using I2C in the background
> can check if a I2C bus is busy.
>
> Signed-off-by: Sascha Hauer
Tested-by: Gerald Loacker
> ---
>
> Notes:
> Changes since v1:
> - Add forgotten slice_init()
>
Hi Sascha,
Am 08.09.2023 um 15:13 schrieb Sascha Hauer:
> On Fri, Sep 08, 2023 at 01:55:40PM +0200, Sascha Hauer wrote:
>> On Fri, Sep 08, 2023 at 01:51:32PM +0200, Sascha Hauer wrote:
>>> On Fri, Sep 08, 2023 at 12:16:47PM +0200, Gerald Loacker wrote:
It may happen that an i2c transfer is
On 23-09-11, Ahmad Fatoum wrote:
> In usual configurations, TF-A already prints its version on startup, so
> printing it in barebox again is unnecessary and less informational than
> the TF-A print and complicates running barebox without TF-A.
> Thus just drop it.
>
> Signed-off-by: Ahmad Fatoum
Pointer casts to integers are a common cause of 64-bit incompatibilities.
Import PTR_ALIGN_DOWN/PTR_IS_ALIGNED macros from Linux to hide the cast.
Signed-off-by: Ahmad Fatoum
---
include/linux/kernel.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/kernel.h
In usual configurations, TF-A already prints its version on startup, so
printing it in barebox again is unnecessary and less informational than
the TF-A print and complicates running barebox without TF-A.
Thus just drop it.
Signed-off-by: Ahmad Fatoum
---
arch/arm/mach-imx/imx8m.c | 11
51 matches
Mail list logo