git: 6251027c4252 - main - nfscl: Do not use nfso_own for delayed nfsrpc_doclose()

2024-04-25 Thread Rick Macklem
The branch main has been updated by rmacklem:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6251027c4252edb3b8f8fc359a40e610349e9af3

commit 6251027c4252edb3b8f8fc359a40e610349e9af3
Author: Rick Macklem 
AuthorDate: 2024-04-26 03:58:21 +
Commit: Rick Macklem 
CommitDate: 2024-04-26 03:58:21 +

nfscl: Do not use nfso_own for delayed nfsrpc_doclose()

When an initial attempt to close an NFSv4 lock returns NFSERR_DELAY,
the open structure is put on a list for delayed closing.  When this
is done, the nfso_own field is set to NULL, so it cannot be used by
nfsrpc_doclose().

Without this patch, the NFSv4 client can crash when a NFSv4 server
replies NFSERR_DELAY to a Close operation.  Fortunately, most extant
NFSv4 servers do not do this.  This patch avoids the crash for any
that do return NFSERR_DELAY for Close.

Found during a IETF bakeathon testing event this week.

MFC after:  5 days
---
 sys/fs/nfsclient/nfs_clrpcops.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index 75bb5236cb65..8c5532268287 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -826,6 +826,7 @@ nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, 
NFSPROC_T *p,
u_int64_t off = 0, len = 0;
u_int32_t type = NFSV4LOCKT_READ;
int error, do_unlock, trycnt;
+   bool own_not_null;
 
tcred = newnfs_getcred();
newnfs_copycred(>nfso_cred, tcred);
@@ -892,22 +893,29 @@ nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen 
*op, NFSPROC_T *p,
 * There could be other Opens for different files on the same
 * OpenOwner, so locking is required.
 */
-   NFSLOCKCLSTATE();
-   nfscl_lockexcl(>nfso_own->nfsow_rwlock, NFSCLSTATEMUTEXPTR);
-   NFSUNLOCKCLSTATE();
+   own_not_null = false;
+   if (op->nfso_own != NULL) {
+   own_not_null = true;
+   NFSLOCKCLSTATE();
+   nfscl_lockexcl(>nfso_own->nfsow_rwlock, NFSCLSTATEMUTEXPTR);
+   NFSUNLOCKCLSTATE();
+   }
do {
error = nfscl_tryclose(op, tcred, nmp, p, loop_on_delayed);
if (error == NFSERR_GRACE)
(void) nfs_catnap(PZERO, error, "nfs_close");
} while (error == NFSERR_GRACE);
-   NFSLOCKCLSTATE();
-   nfscl_lockunlock(>nfso_own->nfsow_rwlock);
+   if (own_not_null) {
+   NFSLOCKCLSTATE();
+   nfscl_lockunlock(>nfso_own->nfsow_rwlock);
+   }
 
LIST_FOREACH_SAFE(lp, >nfso_lock, nfsl_list, nlp)
nfscl_freelockowner(lp, 0);
if (freeop && error != NFSERR_DELAY)
nfscl_freeopen(op, 0, true);
-   NFSUNLOCKCLSTATE();
+   if (own_not_null)
+   NFSUNLOCKCLSTATE();
NFSFREECRED(tcred);
return (error);
 }



git: f0e59ecff85d - main - CTL: READ(6) should be allowed on CD devices

2024-04-25 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=f0e59ecff85d4b9e875464199e065a269c9c2530

commit f0e59ecff85d4b9e875464199e065a269c9c2530
Author: HP van Braam 
AuthorDate: 2024-04-26 02:31:12 +
Commit: Warner Losh 
CommitDate: 2024-04-26 02:31:14 +

CTL: READ(6) should be allowed on CD devices

DOS ASPI drivers use this, with this change applied it is possible to
load a DOS ASPI CDROM driver and run the Windows 98 installer.

Signed-off-by: HP van Braam 
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1202
---
 sys/cam/ctl/ctl_cmd_table.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/cam/ctl/ctl_cmd_table.c b/sys/cam/ctl/ctl_cmd_table.c
index 8b81ea7e56b3..a62c5e8c1e81 100644
--- a/sys/cam/ctl/ctl_cmd_table.c
+++ b/sys/cam/ctl/ctl_cmd_table.c
@@ -944,6 +944,7 @@ const struct ctl_cmd_entry ctl_cmd_table[256] =
 /* 08 READ(6) */
 {ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_DIRECT |
  CTL_FLAG_DATA_IN |
+ CTL_CMD_FLAG_OK_ON_CDROM |
  CTL_CMD_FLAG_ALLOW_ON_PR_WRESV,
  CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, 6, {0x1f, 0xff, 0xff, 0xff, 0x07}},
 



git: ce3b53ffcc3e - main - nvmecontrol: Flesh out nvmecontrol format information

2024-04-25 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ce3b53ffcc3ecc00fa6283542c60ff1fe697d853

commit ce3b53ffcc3ecc00fa6283542c60ff1fe697d853
Author: Warner Losh 
AuthorDate: 2024-04-25 23:47:18 +
Commit: Warner Losh 
CommitDate: 2024-04-25 23:47:18 +

nvmecontrol: Flesh out nvmecontrol format information

The format command takes a number of different parameters. Include a
brief summary of what the values mean, though since the driver's support
for metadata is at best weak, 0's are almost always used for values
other than -f format. Add an example that ties it all together.

Sponsored by:   Netflix
Reviewed by:paua...@gundo.com, chuck
Differential Revision:  https://reviews.freebsd.org/D44958
---
 sbin/nvmecontrol/nvmecontrol.8 | 81 --
 1 file changed, 70 insertions(+), 11 deletions(-)

diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8
index b812149b5c7d..b5a85b1ab9f5 100644
--- a/sbin/nvmecontrol/nvmecontrol.8
+++ b/sbin/nvmecontrol/nvmecontrol.8
@@ -442,24 +442,62 @@ Use Extended Data Structure.
 .Ss format
 Format either specified namespace, or all namespaces of specified controller,
 using specified parameters:
+.Bl -tag -width 8n
+.It Fl f Ar fmt
+The index
 .Ar fmt
-LBA Format,
+of the parameters to use.
+LBA Format #, as specified in the identification of the namespace using
+.Dq nvmecontrol identify
+command with a namespace specified maps this index into these parameters.
+.It Fl m Ar mset
+Metadata Setting.
 .Ar mset
-Metadata Settings,
-.Ar pi
-Protection Information,
-.Ar pil
+.Bl -tag -compact -width 6n
+.It Dv 0
+do not transfer metadata with LBA information
+.It Dv 1
+Transfer the metadata as part of the extended LBA information.
+.El
+.It Fl p Ar pi
+Protection Information.
+.Bl -tag -compact -width 6n
+.It Dv 0
+Protection Information not enabled.
+.It Dv 1
+Type 1 information protection enabled.
+.It Dv 2
+Type 2 information protection enabled.
+.It Dv 3
+Type 3 information protection enabled.
+.El
+.It Fl l Ar pil
 Protection Information Location.
+.Bl -tag -compact -width 6n
+.It Dv 0
+Transfer the protection metadata as the last N bytes of the transfer.
+.It Dv 1
+Transfer the protection metadata as the first N bytes of the transfer.
+.El
+.It Fl E
+Enables User Data Erase during format.
+All users data is erased and subsequent reads are indeterminate.
+The drive may implement this as a cryptographic erase or it may
+physically erase the underlying media.
+.It Fl C
+Enables Cryptographic Erase during format.
+All user data is erased  cryptographically by deleting the encryption key,
+rendering it unintelligible.
+.El
+.Pp
 When formatting specific namespace, existing values are used as defaults.
 When formatting all namespaces, all parameters should be specified.
 Some controllers may not support formatting or erasing specific or all
 namespaces.
-Option
-.Fl E
-enables User Data Erase during format.
-Option
-.Fl C
-enables Cryptographic Erase during format.
+The
+.Xr nvme 4
+driver does not currently support metadata and protection information
+transfers.
 .Ss sanitize
 Sanitize NVM subsystem of specified controller,
 using specified parameters:
@@ -763,6 +801,27 @@ device.
 The corresponding
 .Pa nvmeXnsY
 device is used automatically.
+.Pp
+.Dl nvmecontrol format -f 2 -m 0 -p 0 -l 0 -C nvme2
+.Pp
+Format all the name spaces on nvme2 using parameters from
+.Dq LBA Format #2
+with no metadata or protection data using cryptographic erase.
+If the
+.Dq nvmecontrol identify -n 1 nvme2
+command ended with
+.Pp
+.Bl -verbatim
+LBA Format #00: Data Size:   512  Metadata Size: 0  Performance: Good
+LBA Format #01: Data Size:   512  Metadata Size: 8  Performance: Good
+LBA Format #02: Data Size:  4096  Metadata Size: 0  Performance: Good
+LBA Format #03: Data Size:  4096  Metadata Size: 8  Performance: Good
+LBA Format #04: Data Size:  4096  Metadata Size:64  Performance: Good
+.El
+.Pp
+then this would give a 4k data format for at least namespace 1, with no
+metadata.
+.Pp
 .Sh DYNAMIC LOADING
 The directories
 .Pa /lib/nvmecontrol



Re: git: 1bd4f769caf8 - main - add dtb support for RPI CM4, CM4s, CM4_ioBoard

2024-04-25 Thread Kyle Evans

On 4/25/24 17:19, Klaus Küchemann wrote:




Am 26.04.2024 um 00:09 schrieb Kyle Evans :

On 4/25/24 16:44, Klaus Küchemann wrote:

Am 25.04.2024 um 22:01 schrieb Kyle Evans :

On 4/25/24 14:43, Colin Percival wrote:

On 4/25/24 12:24, Warner Losh wrote:
On Thu, Apr 25, 2024, 12:57 PM Colin Percival 
mailto:cperc...@tarsnap.com>> wrote:

On 4/19/24 16:11, Warner Losh wrote:
>      add dtb support for RPI CM4, CM4s, CM4_ioBoard
>
>      Signed-off-by: Klaus Küchemann mailto:macipho...@googlemail.com>>
>      Reviewed by: imp
>      Pull Request: https://github.com/freebsd/freebsd-src/pull/1182

> ---
> --- a/release/arm64/RPI.conf
> +++ b/release/arm64/RPI.conf
> -DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb 
bcm2710-rpi-3-b-plus.dtb

bcm2710-rpi-cm3.dtb bcm2711-rpi-4-b.dtb"
> +DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb 
bcm2710-rpi-3-b-plus.dtb

bcm2710-rpi-cm3.dtb \
> +     bcm2711-rpi-4-b.dtb bcm2711-rpi-cm4-io.dtb bcm2711-rpi-cm4.dtb
bcm2711-rpi-cm4s.dtb"

This broke the RPI release build, since bcm2711-rpi-cm4s.dtb 
doesn't exist.

Is it provided by a port which we should add to the RPI build?

I thought it was in tree. I'll look into this and report back.

Entirely possible.  The release-building code is trying to copy it from
/usr/local/share/rpi-firmware/bcm2711-rpi-cm4s.dtb
so if it's somewhere else we need to adjust that code.


The rpi-firmware port is supposed to provide all .dtb used here, but 
we've never installed that one.  It really shouldn't have been 
included in the list to begin with, but I guess if there's demand we 
should fix the port to include it.


Thanks,

Kyle Evans
we only have tested/fixed the CM4-model,  not forceably need the 
cm4s.dtb , so no objections to remove cm4s.dtb from the dtb-list at 
least temporarily.
But please hold cm4.dtb and the cm4_io_.dtb, which will then 
hopefully not break the rpi-release anymore.


I'm going to go ahead and remove just the rpi-cm4s.dtb, feel free to 
update the port (sysutils/rpi-firmware) to grab it then try again once 
new packages are available with it so that we don't break the snapshot 
again from the same file.


Thanks,

Kyle Evans


Yes, better at the moment , because
Updating the port would require to test every rpi-model again because 
the provided dtb-files

  can sometimes be very „sensitive“ or critical in behavior  .



You are over-complicating this... you don't need to actually update the 
port to a different version of the rpi-firmware repository. 055e044 is 
what's currently used, and the .dtb is there; it just needs to be added 
to the pkg-plist[0] so that it gets sucked into the package.  We 
apparently stage all of boot/* into $DATADIR already (kind of ugly, but 
whatever floats the port's goat, man) so it shouldn't need anything else 
and won't invalidate any of the other blobs we package.


[0] https://cgit.freebsd.org/ports/tree/sysutils/rpi-firmware/pkg-plist#n22




Re: git: 1bd4f769caf8 - main - add dtb support for RPI CM4, CM4s, CM4_ioBoard

2024-04-25 Thread Klaus Küchemann


> Am 26.04.2024 um 00:09 schrieb Kyle Evans :
> 
> On 4/25/24 16:44, Klaus Küchemann wrote:
>>> Am 25.04.2024 um 22:01 schrieb Kyle Evans :
>>> 
>>> On 4/25/24 14:43, Colin Percival wrote:
 On 4/25/24 12:24, Warner Losh wrote:
> On Thu, Apr 25, 2024, 12:57 PM Colin Percival  > wrote:
> On 4/19/24 16:11, Warner Losh wrote:
>  >  add dtb support for RPI CM4, CM4s, CM4_ioBoard
>  >
>  >  Signed-off-by: Klaus Küchemann  >
>  >  Reviewed by: imp
>  >  Pull Request: https://github.com/freebsd/freebsd-src/pull/1182
> 
>  > ---
>  > --- a/release/arm64/RPI.conf
>  > +++ b/release/arm64/RPI.conf
>  > -DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb 
> bcm2710-rpi-3-b-plus.dtb
> bcm2710-rpi-cm3.dtb bcm2711-rpi-4-b.dtb"
>  > +DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb 
> bcm2710-rpi-3-b-plus.dtb
> bcm2710-rpi-cm3.dtb \
>  > + bcm2711-rpi-4-b.dtb bcm2711-rpi-cm4-io.dtb 
> bcm2711-rpi-cm4.dtb
> bcm2711-rpi-cm4s.dtb"
> 
> This broke the RPI release build, since bcm2711-rpi-cm4s.dtb doesn't 
> exist.
> Is it provided by a port which we should add to the RPI build?
> 
> I thought it was in tree. I'll look into this and report back.
 Entirely possible.  The release-building code is trying to copy it from
 /usr/local/share/rpi-firmware/bcm2711-rpi-cm4s.dtb
 so if it's somewhere else we need to adjust that code.
>>> 
>>> The rpi-firmware port is supposed to provide all .dtb used here, but we've 
>>> never installed that one.  It really shouldn't have been included in the 
>>> list to begin with, but I guess if there's demand we should fix the port to 
>>> include it.
>>> 
>>> Thanks,
>>> 
>>> Kyle Evans
>> we only have tested/fixed the CM4-model,  not forceably need the cm4s.dtb , 
>> so no objections to remove cm4s.dtb from the dtb-list at least temporarily.
>> But please hold cm4.dtb and the cm4_io_.dtb, which will then hopefully not 
>> break the rpi-release anymore.
> 
> I'm going to go ahead and remove just the rpi-cm4s.dtb, feel free to update 
> the port (sysutils/rpi-firmware) to grab it then try again once new packages 
> are available with it so that we don't break the snapshot again from the same 
> file.
> 
> Thanks,
> 
> Kyle Evans

Yes, better at the moment , because
Updating the port would require to test every rpi-model again because the 
provided dtb-files
 can sometimes be very „sensitive“ or critical in behavior  . 

 thank you and sorry for the breakage.
Klaus



git: 9245ced9c835 - main - release: remove the RPI CM4s .dtb

2024-04-25 Thread Kyle Evans
The branch main has been updated by kevans:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9245ced9c8357d876141975a6431ce34143d2753

commit 9245ced9c8357d876141975a6431ce34143d2753
Author: Kyle Evans 
AuthorDate: 2024-04-25 22:10:32 +
Commit: Kyle Evans 
CommitDate: 2024-04-25 22:10:32 +

release: remove the RPI CM4s .dtb

This isn't actually packaged by the sysutils/rpi-firmware port, so we
cannot include it in the image.  Fix the RPI release build until an
interested party adds it to the port and packages are available.

Reported by:cperciva
---
 release/arm64/RPI.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/release/arm64/RPI.conf b/release/arm64/RPI.conf
index a38385a24e80..b973687c535d 100644
--- a/release/arm64/RPI.conf
+++ b/release/arm64/RPI.conf
@@ -4,7 +4,7 @@
 
 DTB_DIR="/usr/local/share/rpi-firmware"
 DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb 
bcm2710-rpi-cm3.dtb \
-   bcm2711-rpi-4-b.dtb bcm2711-rpi-cm4-io.dtb bcm2711-rpi-cm4.dtb 
bcm2711-rpi-cm4s.dtb"
+   bcm2711-rpi-4-b.dtb bcm2711-rpi-cm4-io.dtb bcm2711-rpi-cm4.dtb"
 EMBEDDED_TARGET_ARCH="aarch64"
 EMBEDDED_TARGET="arm64"
 EMBEDDEDBUILD=1



Re: git: 1bd4f769caf8 - main - add dtb support for RPI CM4, CM4s, CM4_ioBoard

2024-04-25 Thread Warner Losh
On Thu, Apr 25, 2024, 4:09 PM Kyle Evans  wrote:

> On 4/25/24 16:44, Klaus Küchemann wrote:
> >
> >
> >> Am 25.04.2024 um 22:01 schrieb Kyle Evans :
> >>
> >> On 4/25/24 14:43, Colin Percival wrote:
> >>> On 4/25/24 12:24, Warner Losh wrote:
>  On Thu, Apr 25, 2024, 12:57 PM Colin Percival   > wrote:
>  On 4/19/24 16:11, Warner Losh wrote:
>   >  add dtb support for RPI CM4, CM4s, CM4_ioBoard
>   >
>   >  Signed-off-by: Klaus Küchemann   >
>   >  Reviewed by: imp
>   >  Pull Request:
>  https://github.com/freebsd/freebsd-src/pull/1182
>  
>   > ---
>   > --- a/release/arm64/RPI.conf
>   > +++ b/release/arm64/RPI.conf
>   > -DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb
>  bcm2710-rpi-3-b-plus.dtb
>  bcm2710-rpi-cm3.dtb bcm2711-rpi-4-b.dtb"
>   > +DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb
>  bcm2710-rpi-3-b-plus.dtb
>  bcm2710-rpi-cm3.dtb \
>   > + bcm2711-rpi-4-b.dtb bcm2711-rpi-cm4-io.dtb
>  bcm2711-rpi-cm4.dtb
>  bcm2711-rpi-cm4s.dtb"
> 
>  This broke the RPI release build, since bcm2711-rpi-cm4s.dtb
>  doesn't exist.
>  Is it provided by a port which we should add to the RPI build?
> 
>  I thought it was in tree. I'll look into this and report back.
> >>> Entirely possible.  The release-building code is trying to copy it from
> >>> /usr/local/share/rpi-firmware/bcm2711-rpi-cm4s.dtb
> >>> so if it's somewhere else we need to adjust that code.
> >>
> >> The rpi-firmware port is supposed to provide all .dtb used here, but
> >> we've never installed that one.  It really shouldn't have been
> >> included in the list to begin with, but I guess if there's demand we
> >> should fix the port to include it.
> >>
> >> Thanks,
> >>
> >> Kyle Evans
> >
> > we only have tested/fixed the CM4-model,  not forceably need the
> > cm4s.dtb , so no objections to remove cm4s.dtb from the dtb-list at
> > least temporarily.
> >
> > But please hold cm4.dtb and the cm4_io_.dtb, which will then hopefully
> > not break the rpi-release anymore.
> >
>
> I'm going to go ahead and remove just the rpi-cm4s.dtb, feel free to
> update the port (sysutils/rpi-firmware) to grab it then try again once
> new packages are available with it so that we don't break the snapshot
> again from the same file.
>

Thanks.

Warner

Thanks,
>
> Kyle Evans
>


Re: git: 1bd4f769caf8 - main - add dtb support for RPI CM4, CM4s, CM4_ioBoard

2024-04-25 Thread Kyle Evans

On 4/25/24 16:44, Klaus Küchemann wrote:




Am 25.04.2024 um 22:01 schrieb Kyle Evans :

On 4/25/24 14:43, Colin Percival wrote:

On 4/25/24 12:24, Warner Losh wrote:
On Thu, Apr 25, 2024, 12:57 PM Colin Percival > wrote:

    On 4/19/24 16:11, Warner Losh wrote:
 >      add dtb support for RPI CM4, CM4s, CM4_ioBoard
 >
 >      Signed-off-by: Klaus Küchemann mailto:macipho...@googlemail.com>>
 >      Reviewed by: imp
 >      Pull Request: 
https://github.com/freebsd/freebsd-src/pull/1182

    
 > ---
 > --- a/release/arm64/RPI.conf
 > +++ b/release/arm64/RPI.conf
 > -DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb 
bcm2710-rpi-3-b-plus.dtb

    bcm2710-rpi-cm3.dtb bcm2711-rpi-4-b.dtb"
 > +DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb 
bcm2710-rpi-3-b-plus.dtb

    bcm2710-rpi-cm3.dtb \
 > +     bcm2711-rpi-4-b.dtb bcm2711-rpi-cm4-io.dtb 
bcm2711-rpi-cm4.dtb

    bcm2711-rpi-cm4s.dtb"

    This broke the RPI release build, since bcm2711-rpi-cm4s.dtb 
doesn't exist.

    Is it provided by a port which we should add to the RPI build?

I thought it was in tree. I'll look into this and report back.

Entirely possible.  The release-building code is trying to copy it from
/usr/local/share/rpi-firmware/bcm2711-rpi-cm4s.dtb
so if it's somewhere else we need to adjust that code.


The rpi-firmware port is supposed to provide all .dtb used here, but 
we've never installed that one.  It really shouldn't have been 
included in the list to begin with, but I guess if there's demand we 
should fix the port to include it.


Thanks,

Kyle Evans


we only have tested/fixed the CM4-model,  not forceably need the 
cm4s.dtb , so no objections to remove cm4s.dtb from the dtb-list at 
least temporarily.


But please hold cm4.dtb and the cm4_io_.dtb, which will then hopefully 
not break the rpi-release anymore.




I'm going to go ahead and remove just the rpi-cm4s.dtb, feel free to 
update the port (sysutils/rpi-firmware) to grab it then try again once 
new packages are available with it so that we don't break the snapshot 
again from the same file.


Thanks,

Kyle Evans



Re: git: 1bd4f769caf8 - main - add dtb support for RPI CM4, CM4s, CM4_ioBoard

2024-04-25 Thread Klaus Küchemann


> Am 25.04.2024 um 22:01 schrieb Kyle Evans :
> 
> On 4/25/24 14:43, Colin Percival wrote:
>> On 4/25/24 12:24, Warner Losh wrote:
>>> On Thu, Apr 25, 2024, 12:57 PM Colin Percival >> > wrote:
>>> On 4/19/24 16:11, Warner Losh wrote:
>>>  >  add dtb support for RPI CM4, CM4s, CM4_ioBoard
>>>  >
>>>  >  Signed-off-by: Klaus Küchemann >> >
>>>  >  Reviewed by: imp
>>>  >  Pull Request: https://github.com/freebsd/freebsd-src/pull/1182
>>> 
>>>  > ---
>>>  > --- a/release/arm64/RPI.conf
>>>  > +++ b/release/arm64/RPI.conf
>>>  > -DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb 
>>> bcm2710-rpi-3-b-plus.dtb
>>> bcm2710-rpi-cm3.dtb bcm2711-rpi-4-b.dtb"
>>>  > +DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb 
>>> bcm2710-rpi-3-b-plus.dtb
>>> bcm2710-rpi-cm3.dtb \
>>>  > + bcm2711-rpi-4-b.dtb bcm2711-rpi-cm4-io.dtb bcm2711-rpi-cm4.dtb
>>> bcm2711-rpi-cm4s.dtb"
>>> 
>>> This broke the RPI release build, since bcm2711-rpi-cm4s.dtb doesn't 
>>> exist.
>>> Is it provided by a port which we should add to the RPI build?
>>> 
>>> I thought it was in tree. I'll look into this and report back.
>> Entirely possible.  The release-building code is trying to copy it from
>> /usr/local/share/rpi-firmware/bcm2711-rpi-cm4s.dtb
>> so if it's somewhere else we need to adjust that code.
> 
> The rpi-firmware port is supposed to provide all .dtb used here, but we've 
> never installed that one.  It really shouldn't have been included in the list 
> to begin with, but I guess if there's demand we should fix the port to 
> include it.
> 
> Thanks,
> 
> Kyle Evans

we only have tested/fixed the CM4-model,  not forceably need the cm4s.dtb , so 
no objections to remove cm4s.dtb from the dtb-list at least temporarily.  
But please hold cm4.dtb and the cm4_io_.dtb, which will then hopefully not 
break the rpi-release anymore. 
Of course would be better to upgrade the port.
thank you
Regards
Klaus



git: 68cbb072fd1c - main - Revert "config.mk: Add MK_VIMAGE knob"

2024-04-25 Thread Brooks Davis
The branch main has been updated by brooks:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=68cbb072fd1c7f0928efbb466f278e6c2e0a2024

commit 68cbb072fd1c7f0928efbb466f278e6c2e0a2024
Author: Brooks Davis 
AuthorDate: 2024-04-25 21:38:15 +
Commit: Brooks Davis 
CommitDate: 2024-04-25 21:43:36 +

Revert "config.mk: Add MK_VIMAGE knob"

This commit broke "make makeman" checks in github CI due to a lack of
option description files.  The split between VIMAGE and VIMAGE_SUPPORT
is not clearly justified and the code is broken because there is no
opt_vimage.h (it's in opt_global.h).

This reverts commit 22ca6db50f4e6bd75a141f57cf953d8de6531a06.
---
 share/mk/src.opts.mk  | 2 --
 sys/conf/config.mk| 2 --
 sys/conf/kern.opts.mk | 4 +---
 3 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index b7196b6fe824..00405e3f934f 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -183,7 +183,6 @@ __DEFAULT_YES_OPTIONS = \
 USB \
 UTMPX \
 VI \
-VIMAGE \
 VT \
 WIRELESS \
 WPA_SUPPLICANT_EAPOL \
@@ -248,7 +247,6 @@ __LIBC_MALLOC_DEFAULT=  jemalloc
 NETGRAPH \
 PAM \
 TESTS \
-VIMAGE \
 WIRELESS
 __DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
 .endfor
diff --git a/sys/conf/config.mk b/sys/conf/config.mk
index 6e26ee0d5e66..729111b4ef3a 100644
--- a/sys/conf/config.mk
+++ b/sys/conf/config.mk
@@ -11,9 +11,7 @@ opt_global.h:
touch ${.TARGET}
@echo "#define SMP 1" >> ${.TARGET}
@echo "#define MAC 1" >> ${.TARGET}
-.if ${MK_VIMAGE_SUPPORT} != "no"
@echo "#define VIMAGE 1" >> ${.TARGET}
-.endif
 # Note: Define 'options' in DEFAULTS to 1. For simplicity, no check if the
 # option is in opt_global.h. Nearly all the options in DEFAUlTS today are in
 # opt_global.h with GEOM_* being the main exceptions. Move any options from
diff --git a/sys/conf/kern.opts.mk b/sys/conf/kern.opts.mk
index 8b1151f3d624..d9d96a133250 100644
--- a/sys/conf/kern.opts.mk
+++ b/sys/conf/kern.opts.mk
@@ -52,7 +52,6 @@ __DEFAULT_YES_OPTIONS = \
 SPLIT_KERNEL_DEBUG \
 TESTS \
 USB_GADGET_EXAMPLES \
-VIMAGE \
 ZFS
 
 __DEFAULT_NO_OPTIONS = \
@@ -183,8 +182,7 @@ OPT_${opt}:=${rep}
 #
 .for var in \
 INET \
-INET6 \
-VIMAGE
+INET6
 .if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
 MK_${var}_SUPPORT:= no
 .else



Re: git: 1bd4f769caf8 - main - add dtb support for RPI CM4, CM4s, CM4_ioBoard

2024-04-25 Thread Mark Millard
Warner Losh  wrote on
Date: Thu, 25 Apr 2024 19:24:07 UTC :

> On Thu, Apr 25, 2024, 12:57 PM Colin Percival  wrote:
> 
> > On 4/19/24 16:11, Warner Losh wrote:
> > > add dtb support for RPI CM4, CM4s, CM4_ioBoard
> > >
> > > Signed-off-by: Klaus Küchemann 
> > > Reviewed by: imp
> > > Pull Request: https://github.com/freebsd/freebsd-src/pull/1182
> > > ---
> > > --- a/release/arm64/RPI.conf
> > > +++ b/release/arm64/RPI.conf
> > > -DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb
> > bcm2710-rpi-cm3.dtb bcm2711-rpi-4-b.dtb"
> > > +DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb
> > bcm2710-rpi-cm3.dtb \
> > > + bcm2711-rpi-4-b.dtb bcm2711-rpi-cm4-io.dtb bcm2711-rpi-cm4.dtb
> > bcm2711-rpi-cm4s.dtb"
> >
> > This broke the RPI release build, since bcm2711-rpi-cm4s.dtb doesn't exist.
> > Is it provided by a port which we should add to the RPI build?
> >
> 
> I thought it was in tree. I'll look into this and report back.

The upstream RPi* distributions do not use the linux mainstream *.dts*
files but build their own *.dts* files and distribute the resultant
*.dtb's directly.

For RPi*'s, FreeBSD uses the *.dtb files from some RPI* distribution
(via the rpi-firmware port). FreeBSD does not use the linux mainstream
*.dts* files for RPi*'s: RPi*'s have a a different compatibility
criteria applied compared to most of the Small Arm Boards.

So: not in tree.

===
Mark Millard
marklmi at yahoo.com




Re: git: 1bd4f769caf8 - main - add dtb support for RPI CM4, CM4s, CM4_ioBoard

2024-04-25 Thread Kyle Evans

On 4/25/24 14:43, Colin Percival wrote:

On 4/25/24 12:24, Warner Losh wrote:
On Thu, Apr 25, 2024, 12:57 PM Colin Percival > wrote:

    On 4/19/24 16:11, Warner Losh wrote:
 >      add dtb support for RPI CM4, CM4s, CM4_ioBoard
 >
 >      Signed-off-by: Klaus Küchemann mailto:macipho...@googlemail.com>>
 >      Reviewed by: imp
 >      Pull Request: 
https://github.com/freebsd/freebsd-src/pull/1182

    
 > ---
 > --- a/release/arm64/RPI.conf
 > +++ b/release/arm64/RPI.conf
 > -DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb 
bcm2710-rpi-3-b-plus.dtb

    bcm2710-rpi-cm3.dtb bcm2711-rpi-4-b.dtb"
 > +DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb 
bcm2710-rpi-3-b-plus.dtb

    bcm2710-rpi-cm3.dtb \
 > +     bcm2711-rpi-4-b.dtb bcm2711-rpi-cm4-io.dtb 
bcm2711-rpi-cm4.dtb

    bcm2711-rpi-cm4s.dtb"

    This broke the RPI release build, since bcm2711-rpi-cm4s.dtb 
doesn't exist.

    Is it provided by a port which we should add to the RPI build?

I thought it was in tree. I'll look into this and report back.


Entirely possible.  The release-building code is trying to copy it from
/usr/local/share/rpi-firmware/bcm2711-rpi-cm4s.dtb
so if it's somewhere else we need to adjust that code.



The rpi-firmware port is supposed to provide all .dtb used here, but 
we've never installed that one.  It really shouldn't have been included 
in the list to begin with, but I guess if there's demand we should fix 
the port to include it.


Thanks,

Kyle Evans



Re: git: 1bd4f769caf8 - main - add dtb support for RPI CM4, CM4s, CM4_ioBoard

2024-04-25 Thread Colin Percival

On 4/25/24 12:24, Warner Losh wrote:
On Thu, Apr 25, 2024, 12:57 PM Colin Percival > wrote:

On 4/19/24 16:11, Warner Losh wrote:
 >      add dtb support for RPI CM4, CM4s, CM4_ioBoard
 >
 >      Signed-off-by: Klaus Küchemann mailto:macipho...@googlemail.com>>
 >      Reviewed by: imp
 >      Pull Request: https://github.com/freebsd/freebsd-src/pull/1182

 > ---
 > --- a/release/arm64/RPI.conf
 > +++ b/release/arm64/RPI.conf
 > -DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb
bcm2710-rpi-cm3.dtb bcm2711-rpi-4-b.dtb"
 > +DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb
bcm2710-rpi-cm3.dtb \
 > +     bcm2711-rpi-4-b.dtb bcm2711-rpi-cm4-io.dtb bcm2711-rpi-cm4.dtb
bcm2711-rpi-cm4s.dtb"

This broke the RPI release build, since bcm2711-rpi-cm4s.dtb doesn't exist.
Is it provided by a port which we should add to the RPI build?

I thought it was in tree. I'll look into this and report back.


Entirely possible.  The release-building code is trying to copy it from
/usr/local/share/rpi-firmware/bcm2711-rpi-cm4s.dtb
so if it's somewhere else we need to adjust that code.

--
Colin Percival
FreeBSD Release Engineering Lead & EC2 platform maintainer
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid



git: 8efba70d7914 - main - nfscl: Revert part of commit 196787f79e67

2024-04-25 Thread Rick Macklem
The branch main has been updated by rmacklem:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8efba70d7914324890b1f8fe3079036eb2b5c3db

commit 8efba70d7914324890b1f8fe3079036eb2b5c3db
Author: Rick Macklem 
AuthorDate: 2024-04-25 19:32:02 +
Commit: Rick Macklem 
CommitDate: 2024-04-25 19:32:02 +

nfscl: Revert part of commit 196787f79e67

Commit 196787f79e67 erroneously assumed that the client code for
Open/Claim_deleg_cur_FH was broken, but it was not.
It was actually wireshark that was broken and indicated
that the correct XDR was bogus.

This reverts the part of 196787f79e67 that changed the arguments for
Open/Claim_deleg_cur_FH.

Found during the IETF bakeathon testing event this week.

MFC after:  3 days
---
 sys/fs/nfsclient/nfs_clrpcops.c | 33 ++---
 sys/fs/nfsclient/nfs_clstate.c  | 23 +--
 sys/fs/nfsclient/nfsmount.h |  1 -
 3 files changed, 11 insertions(+), 46 deletions(-)

diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index 09660730d485..75bb5236cb65 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -561,34 +561,21 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int8_t 
*nfhp, int fhlen,
*tl = txdr_unsigned(delegtype);
} else {
if (dp != NULL) {
-   if (NFSHASNFSV4N(nmp)) {
+   if (NFSHASNFSV4N(nmp))
*tl = txdr_unsigned(
NFSV4OPEN_CLAIMDELEGATECURFH);
-   NFSLOCKMNT(nmp);
-   if ((nmp->nm_privflag & NFSMNTP_BUGGYFBSDSRV) !=
-   0) {
-   NFSUNLOCKMNT(nmp);
-   /*
-* Add a stateID argument to make old
-* broken FreeBSD NFSv4.1/4.2 servers
-* happy.
-*/
-   NFSM_BUILD(tl, uint32_t *,NFSX_STATEID);
-   *tl++ = 0;
-   *tl++ = dp->nfsdl_stateid.other[0];
-   *tl++ = dp->nfsdl_stateid.other[1];
-   *tl = dp->nfsdl_stateid.other[2];
-   } else
-   NFSUNLOCKMNT(nmp);
-   } else {
+   else
*tl = txdr_unsigned(NFSV4OPEN_CLAIMDELEGATECUR);
-   NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
+   NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
+   if (NFSHASNFSV4N(nmp))
+   *tl++ = 0;
+   else
*tl++ = dp->nfsdl_stateid.seqid;
-   *tl++ = dp->nfsdl_stateid.other[0];
-   *tl++ = dp->nfsdl_stateid.other[1];
-   *tl = dp->nfsdl_stateid.other[2];
+   *tl++ = dp->nfsdl_stateid.other[0];
+   *tl++ = dp->nfsdl_stateid.other[1];
+   *tl = dp->nfsdl_stateid.other[2];
+   if (!NFSHASNFSV4N(nmp))
(void)nfsm_strtom(nd, name, namelen);
-   }
} else if (NFSHASNFSV4N(nmp)) {
*tl = txdr_unsigned(NFSV4OPEN_CLAIMFH);
} else {
diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index ebc11efea637..9fbaa6e63a56 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -4512,7 +4512,6 @@ nfscl_tryopen(struct nfsmount *nmp, vnode_t vp, u_int8_t 
*fhp, int fhlen,
 {
int error;
struct nfscldeleg *dp;
-   bool try_busted_xdr;
 
dp = *ndpp;
do {
@@ -4520,29 +4519,9 @@ nfscl_tryopen(struct nfsmount *nmp, vnode_t vp, u_int8_t 
*fhp, int fhlen,
error = nfsrpc_openrpc(nmp, vp, fhp, fhlen, newfhp, newfhlen,
mode, op, name, namelen, ndpp, reclaim, delegtype, cred, p,
0, 0);
-   try_busted_xdr = false;
if (error == NFSERR_DELAY)
(void) nfs_catnap(PZERO, error, "nfstryop");
-   else if (error == NFSERR_EXPIRED && NFSHASNFSV4N(nmp) &&
-   reclaim == 0 && dp != NULL) {
-   /* This case is a Claim_Deleg_Cur_FH Open. */
-   NFSLOCKMNT(nmp);
-   if ((nmp->nm_privflag & NFSMNTP_BUGGYFBSDSRV) == 0) {
-   /*
-* Old FreeBSD NFSv4.1/4.2 servers 

Re: git: 1bd4f769caf8 - main - add dtb support for RPI CM4, CM4s, CM4_ioBoard

2024-04-25 Thread Warner Losh
On Thu, Apr 25, 2024, 12:57 PM Colin Percival  wrote:

> On 4/19/24 16:11, Warner Losh wrote:
> >  add dtb support for RPI CM4, CM4s, CM4_ioBoard
> >
> >  Signed-off-by: Klaus Küchemann 
> >  Reviewed by: imp
> >  Pull Request: https://github.com/freebsd/freebsd-src/pull/1182
> > ---
> > --- a/release/arm64/RPI.conf
> > +++ b/release/arm64/RPI.conf
> > -DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb
> bcm2710-rpi-cm3.dtb bcm2711-rpi-4-b.dtb"
> > +DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb
> bcm2710-rpi-cm3.dtb \
> > + bcm2711-rpi-4-b.dtb bcm2711-rpi-cm4-io.dtb bcm2711-rpi-cm4.dtb
> bcm2711-rpi-cm4s.dtb"
>
> This broke the RPI release build, since bcm2711-rpi-cm4s.dtb doesn't exist.
> Is it provided by a port which we should add to the RPI build?
>

I thought it was in tree. I'll look into this and report back.

Warner

-- 
> Colin Percival
> FreeBSD Release Engineering Lead & EC2 platform maintainer
> Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
>


Re: git: 1bd4f769caf8 - main - add dtb support for RPI CM4, CM4s, CM4_ioBoard

2024-04-25 Thread Colin Percival

On 4/19/24 16:11, Warner Losh wrote:

 add dtb support for RPI CM4, CM4s, CM4_ioBoard
 
 Signed-off-by: Klaus Küchemann 

 Reviewed by: imp
 Pull Request: https://github.com/freebsd/freebsd-src/pull/1182
---
--- a/release/arm64/RPI.conf
+++ b/release/arm64/RPI.conf
-DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb 
bcm2710-rpi-cm3.dtb bcm2711-rpi-4-b.dtb"
+DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb 
bcm2710-rpi-cm3.dtb \
+   bcm2711-rpi-4-b.dtb bcm2711-rpi-cm4-io.dtb bcm2711-rpi-cm4.dtb 
bcm2711-rpi-cm4s.dtb"


This broke the RPI release build, since bcm2711-rpi-cm4s.dtb doesn't exist.
Is it provided by a port which we should add to the RPI build?

--
Colin Percival
FreeBSD Release Engineering Lead & EC2 platform maintainer
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid



git: 9f231af307b8 - main - tftpd: Immediately reject any request shorter than 4 bytes.

2024-04-25 Thread Dag-Erling Smørgrav
The branch main has been updated by des:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9f231af307b80eb222d9761bbd81fa4e130bb3d7

commit 9f231af307b80eb222d9761bbd81fa4e130bb3d7
Author: Dag-Erling Smørgrav 
AuthorDate: 2024-04-25 18:35:28 +
Commit: Dag-Erling Smørgrav 
CommitDate: 2024-04-25 18:36:13 +

tftpd: Immediately reject any request shorter than 4 bytes.

MFC after:  1 week
Sponsored by:   Klara, Inc.
Reviewed by:kevans
Differential Revision:  https://reviews.freebsd.org/D44957
---
 libexec/tftpd/tests/functional.c | 19 +++
 libexec/tftpd/tftpd.c|  5 +
 2 files changed, 24 insertions(+)

diff --git a/libexec/tftpd/tests/functional.c b/libexec/tftpd/tests/functional.c
index 3b70962854ba..d3d2f46ffdee 100644
--- a/libexec/tftpd/tests/functional.c
+++ b/libexec/tftpd/tests/functional.c
@@ -1219,6 +1219,22 @@ TFTPD_TC_DEFINE(wrq_window_rfc7440,)
require_bufeq(contents, sizeof(contents), buffer, (size_t)r);
 }
 
+/*
+ * Send less than four bytes
+ */
+TFTPD_TC_DEFINE(short_packet1, /* no head */, exitcode = 1)
+{
+   SEND_STR("\1");
+}
+TFTPD_TC_DEFINE(short_packet2, /* no head */, exitcode = 1)
+{
+   SEND_STR("\1\2");
+}
+TFTPD_TC_DEFINE(short_packet3, /* no head */, exitcode = 1)
+{
+   SEND_STR("\1\2\3");
+}
+
 
 /*
  * Main
@@ -1256,6 +1272,9 @@ ATF_TP_ADD_TCS(tp)
TFTPD_TC_ADD(tp, wrq_small);
TFTPD_TC_ADD(tp, wrq_truncate);
TFTPD_TC_ADD(tp, wrq_window_rfc7440);
+   TFTPD_TC_ADD(tp, short_packet1);
+   TFTPD_TC_ADD(tp, short_packet2);
+   TFTPD_TC_ADD(tp, short_packet3);
 
return (atf_no_error());
 }
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c
index 45e7344c86ed..13f53024b147 100644
--- a/libexec/tftpd/tftpd.c
+++ b/libexec/tftpd/tftpd.c
@@ -228,6 +228,11 @@ main(int argc, char *argv[])
}
getnameinfo((struct sockaddr *)_sock, peer_sock.ss_len,
peername, sizeof(peername), NULL, 0, NI_NUMERICHOST);
+   if ((size_t)n < 4 /* tftphdr */) {
+   tftp_log(LOG_ERR, "Rejecting %zd-byte request from %s",
+   n, peername);
+   exit(1);
+   }
 
/*
 * Now that we have read the message out of the UDP



git: 83a6e984ac01 - main - tftpd: Check the server status after each test.

2024-04-25 Thread Dag-Erling Smørgrav
The branch main has been updated by des:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=83a6e984ac01657819418746f722163367ec30db

commit 83a6e984ac01657819418746f722163367ec30db
Author: Dag-Erling Smørgrav 
AuthorDate: 2024-04-25 18:35:24 +
Commit: Dag-Erling Smørgrav 
CommitDate: 2024-04-25 18:36:13 +

tftpd: Check the server status after each test.

* In the setup phase, wait for the server to start (or fail to start)
  before proceeding with the test.  This makes it possible to write test
  cases that don't expect a response from the server without ending up
  in a race over the server PID file.
* After running each test, wait up to 30 seconds for the server to exit
  and check that the exit status matches what the test case says to
  expect (usually 0).
* We still kill and collect the server in the cleanup phase, in case the
  test ended early.

MFC after:  1 week
Sponsored by:   Klara, Inc.
Reviewed by:kevans
Differential Revision:  https://reviews.freebsd.org/D44956
---
 libexec/tftpd/tests/functional.c | 44 ++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/libexec/tftpd/tests/functional.c b/libexec/tftpd/tests/functional.c
index bbe4f3782192..3b70962854ba 100644
--- a/libexec/tftpd/tests/functional.c
+++ b/libexec/tftpd/tests/functional.c
@@ -208,11 +208,14 @@ ATF_TC_HEAD(name ## _v4, tc)  
\
 }  \
 ATF_TC_BODY(name ## _v4, tc)   \
 {  \
+   int exitcode = 0;   \
__VA_ARGS__;\
protocol = AF_INET; \
s = setup(, __COUNTER__);  \
name ## _body();\
close(s);   \
+   if (exitcode >= 0)  \
+   check_server(exitcode); \
 }  \
 ATF_TC_CLEANUP(name ## _v4, tc)
\
 {  \
@@ -225,11 +228,14 @@ ATF_TC_HEAD(name ## _v6, tc)  
\
 }  \
 ATF_TC_BODY(name ## _v6, tc)   \
 {  \
+   int exitcode = 0;   \
__VA_ARGS__;\
protocol = AF_INET6;\
s = setup(, __COUNTER__);  \
name ## _body();\
close(s);   \
+   if (exitcode >= 0)  \
+   check_server(exitcode); \
 }  \
 ATF_TC_CLEANUP(name ## _v6, tc)
\
 {  \
@@ -244,6 +250,33 @@ name ## _body(void)
ATF_TP_ADD_TC(tp, name ## _v6); \
 } while (0)
 
+static void
+sigalrm(int signo __unused)
+{
+}
+
+/* Check that server exits with specific exit code */
+static void
+check_server(int exitcode)
+{
+   struct sigaction sa = { .sa_handler = sigalrm };
+   struct itimerval it = { .it_value = { .tv_sec = 30 } };
+   FILE *f;
+   pid_t pid;
+   int wstatus;
+
+   f = fopen(pidfile, "r");
+   ATF_REQUIRE(f != NULL);
+   ATF_REQUIRE_INTEQ(1, fscanf(f, "%d", ));
+   ATF_CHECK_INTEQ(0, fclose(f));
+   ATF_REQUIRE_INTEQ(0, sigaction(SIGALRM, , NULL));
+   ATF_REQUIRE_EQ(0, setitimer(ITIMER_REAL, , NULL));
+   ATF_REQUIRE_EQ(pid, waitpid(pid, , 0));
+   ATF_CHECK(WIFEXITED(wstatus));
+   ATF_CHECK_INTEQ(exitcode, WEXITSTATUS(wstatus));
+   unlink(pidfile);
+}
+
 /* Standard cleanup used by all testcases */
 static void
 cleanup(void)
@@ -254,12 +287,12 @@ cleanup(void)
f = fopen(pidfile, "r");
if (f == NULL)
return;
+   unlink(pidfile);
if (fscanf(f, "%d", ) == 1) {
kill(pid, SIGTERM);
waitpid(pid, NULL, 0);
}
fclose(f);
-   unlink(pidfile);
 }
 
 /* Assert that two 

git: 7ab7ecfcfe77 - main - tftpd: Clean up the tests.

2024-04-25 Thread Dag-Erling Smørgrav
The branch main has been updated by des:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=7ab7ecfcfe777f7816e3e01df5f277060b2b609a

commit 7ab7ecfcfe777f7816e3e01df5f277060b2b609a
Author: Dag-Erling Smørgrav 
AuthorDate: 2024-04-25 18:35:20 +
Commit: Dag-Erling Smørgrav 
CommitDate: 2024-04-25 18:36:13 +

tftpd: Clean up the tests.

MFC after:  1 week
Sponsored by:   Klara, Inc.
Reviewed by:kevans
Differential Revision:  https://reviews.freebsd.org/D44955
---
 libexec/tftpd/tests/functional.c | 253 ---
 1 file changed, 128 insertions(+), 125 deletions(-)

diff --git a/libexec/tftpd/tests/functional.c b/libexec/tftpd/tests/functional.c
index bf7b5c77c898..bbe4f3782192 100644
--- a/libexec/tftpd/tests/functional.c
+++ b/libexec/tftpd/tests/functional.c
@@ -60,24 +60,24 @@ static void require_bufeq(const char *expected, size_t 
expected_len,
  * @param  contentsThe reply's expected contents, as a char array
  * @param  contents_lenLength of contents
  */
-#define RECV(hdr, contents, contents_len) do { \
-   char buffer[1024]; \
-   struct sockaddr_storage from; \
-   socklen_t fromlen = sizeof(from); \
-   ssize_t r = recvfrom(s, buffer, sizeof(buffer), 0, \
-   (struct sockaddr*), ); \
-   ATF_REQUIRE(r > 0); \
-   require_bufeq((hdr), sizeof(hdr), buffer, \
-   MIN((size_t)r, sizeof(hdr)));   \
-   require_bufeq((const char*) (contents), (contents_len), \
-   [sizeof(hdr)], r - sizeof(hdr)); \
-   if (protocol == PF_INET) { \
-   ((struct sockaddr_in*))->sin_port = \
-   ((struct sockaddr_in*))->sin_port; \
-   } else { \
-   ((struct sockaddr_in6*))->sin6_port = \
-   ((struct sockaddr_in6*))->sin6_port; \
-   } \
+#define RECV(hdr, contents, contents_len) do { \
+   char buffer[1024];  \
+   struct sockaddr_storage from;   \
+   socklen_t fromlen = sizeof(from);   \
+   ssize_t r = recvfrom(s, buffer, sizeof(buffer), 0,  \
+   (struct sockaddr *), );\
+   ATF_REQUIRE(r > 0); \
+   require_bufeq((hdr), sizeof(hdr), buffer,   \
+   MIN((size_t)r, sizeof(hdr)));   \
+   require_bufeq((const char *) (contents), (contents_len),\
+   [sizeof(hdr)], r - sizeof(hdr)); \
+   if (protocol == PF_INET) {  \
+   ((struct sockaddr_in *))->sin_port =   \
+   ((struct sockaddr_in *))->sin_port;\
+   } else {\
+   ((struct sockaddr_in6 *))->sin6_port = \
+   ((struct sockaddr_in6 *))->sin6_port;  \
+   }   \
 } while(0)
 
 static void
@@ -101,15 +101,15 @@ recv_oack(const char *options, size_t options_len)
  * @param  contents_lenLength of contents expected to receive
  */
 static void
-recv_data(uint16_t blocknum, const char* contents, size_t contents_len)
+recv_data(uint16_t blocknum, const char *contents, size_t contents_len)
 {
char hdr[] = {0, 3, blocknum >> 8, blocknum & 0xFF};
RECV(hdr, contents, contents_len);
 }
 
-#define RECV_ERROR(code, msg) do { \
-   char hdr[] = {0, 5, code >> 8, code & 0xFF}; \
-   RECV(hdr, msg, sizeof(msg)); \
+#define RECV_ERROR(code, msg) do { \
+   char hdr[] = {0, 5, code >> 8, code & 0xFF};\
+   RECV(hdr, msg, sizeof(msg));\
 } while (0)
 
 /* 
@@ -121,13 +121,13 @@ send_bytes(const void *cmd, size_t len)
 {
ssize_t r;
 
-   r = sendto(s, cmd, len, 0, (struct sockaddr*)(), addr.ss_len);
+   r = sendto(s, cmd, len, 0, (struct sockaddr *)(), addr.ss_len);
ATF_REQUIRE(r >= 0);
ATF_REQUIRE_EQ(len, (size_t)r);
 }
 
 static void
-send_data(uint16_t blocknum, const char* contents, size_t contents_len)
+send_data(uint16_t blocknum, const char *contents, size_t contents_len)
 {
char buffer[1024];
 
@@ -144,10 +144,10 @@ send_data(uint16_t blocknum, const char* contents, size_t 
contents_len)
  * @param  cmd Command to send, as a const string
  * (terminating NUL will be ignored)
  */
-#define SEND_STR(cmd) ATF_REQUIRE_EQ( \
-   sendto(s, (cmd), sizeof(cmd) - 1, 0, (struct sockaddr*)(), \
-   addr.ss_len), \
-   sizeof(cmd) - 1)
+#define SEND_STR(cmd)  \
+   ATF_REQUIRE_EQ(sizeof(cmd) - 1,   

git: 1ed44fcc44b2 - main - tftpd: Use `size_t` where appropriate.

2024-04-25 Thread Dag-Erling Smørgrav
The branch main has been updated by des:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1ed44fcc44b2c04db330663589541608135402f4

commit 1ed44fcc44b2c04db330663589541608135402f4
Author: Dag-Erling Smørgrav 
AuthorDate: 2024-04-25 18:35:15 +
Commit: Dag-Erling Smørgrav 
CommitDate: 2024-04-25 18:36:12 +

tftpd: Use `size_t` where appropriate.

* Limit the use of `ssize_t` to only where it's needed.
* Correct one case of `int` being used for a length.

MFC after:  1 week
Sponsored by:   Klara, Inc.
Reviewed by:kevans
Differential Revision:  https://reviews.freebsd.org/D44954
---
 libexec/tftpd/tests/functional.c | 52 
 libexec/tftpd/tftp-utils.c   |  4 ++--
 libexec/tftpd/tftp-utils.h   |  2 +-
 libexec/tftpd/tftpd.c| 16 ++---
 4 files changed, 42 insertions(+), 32 deletions(-)

diff --git a/libexec/tftpd/tests/functional.c b/libexec/tftpd/tests/functional.c
index 0bdbcfe559ed..bf7b5c77c898 100644
--- a/libexec/tftpd/tests/functional.c
+++ b/libexec/tftpd/tests/functional.c
@@ -51,8 +51,8 @@ static bool s_flag = false;   /* Pass -s to tftpd */
 static bool w_flag = false;/* Pass -w to tftpd */
 
 /* Helper functions*/
-static void require_bufeq(const char *expected, ssize_t expected_len,
-const char *actual, ssize_t len);
+static void require_bufeq(const char *expected, size_t expected_len,
+const char *actual, size_t len);
 
 /*
  * Receive a response from tftpd
@@ -68,7 +68,7 @@ static void require_bufeq(const char *expected, ssize_t 
expected_len,
(struct sockaddr*), ); \
ATF_REQUIRE(r > 0); \
require_bufeq((hdr), sizeof(hdr), buffer, \
-   MIN(r, (ssize_t)sizeof(hdr))); \
+   MIN((size_t)r, sizeof(hdr)));   \
require_bufeq((const char*) (contents), (contents_len), \
[sizeof(hdr)], r - sizeof(hdr)); \
if (protocol == PF_INET) { \
@@ -117,12 +117,13 @@ recv_data(uint16_t blocknum, const char* contents, size_t 
contents_len)
  * @param  cmd Command to send, as a char array
  */
 static void
-send_bytes(const void* cmd, ssize_t len)
+send_bytes(const void *cmd, size_t len)
 {
ssize_t r;
 
r = sendto(s, cmd, len, 0, (struct sockaddr*)(), addr.ss_len);
-   ATF_REQUIRE_EQ(r, len);
+   ATF_REQUIRE(r >= 0);
+   ATF_REQUIRE_EQ(len, (size_t)r);
 }
 
 static void
@@ -261,16 +262,16 @@ cleanup(void)
 
 /* Assert that two binary buffers are identical */
 static void
-require_bufeq(const char *expected, ssize_t expected_len, const char *actual,
-ssize_t len)
+require_bufeq(const char *expected, size_t expected_len, const char *actual,
+size_t len)
 {
-   ssize_t i;
+   size_t i;
 
ATF_REQUIRE_EQ_MSG(expected_len, len,
-   "Expected %zd bytes but got %zd", expected_len, len);
+   "Expected %zu bytes but got %zu", expected_len, len);
for (i = 0; i < len; i++) {
ATF_REQUIRE_EQ_MSG(actual[i], expected[i],
-   "Expected %#hhx at position %zd; got %hhx instead",
+   "Expected %#hhx at position %zu; got %hhx instead",
expected[i], i, actual[i]);
}
 }
@@ -391,8 +392,8 @@ write_all(int fd, const void *buf, size_t nbytes)
while (nbytes > 0) {
r = write(fd, buf, nbytes);
ATF_REQUIRE(r > 0);
-   nbytes -= r;
-   buf = (const char*)buf + r;
+   nbytes -= (size_t)r;
+   buf = (const char*)buf + (size_t)r;
}
 }
 
@@ -804,8 +805,9 @@ TFTPD_TC_DEFINE(w_flag,, w_flag = 1;)
fd = open("small.txt", O_RDONLY);
ATF_REQUIRE(fd >= 0);
r = read(fd, buffer, sizeof(buffer));
+   ATF_REQUIRE(r > 0);
close(fd);
-   require_bufeq(contents, contents_len, buffer, r);
+   require_bufeq(contents, contents_len, buffer, (size_t)r);
 }
 
 /*
@@ -841,8 +843,9 @@ TFTPD_TC_DEFINE(wrq_dropped_ack,)
fd = open("medium.txt", O_RDONLY);
ATF_REQUIRE(fd >= 0);
r = read(fd, buffer, sizeof(buffer));
+   ATF_REQUIRE(r > 0);
close(fd);
-   require_bufeq((const char*)contents, 768, buffer, r);
+   require_bufeq((const char*)contents, 768, buffer, (size_t)r);
 }
 
 /*
@@ -874,8 +877,9 @@ TFTPD_TC_DEFINE(wrq_dropped_data,)
fd = open("small.txt", O_RDONLY);
ATF_REQUIRE(fd >= 0);
r = read(fd, buffer, sizeof(buffer));
+   ATF_REQUIRE(r > 0);
close(fd);
-   require_bufeq(contents, contents_len, buffer, r);
+   require_bufeq(contents, contents_len, buffer, (size_t)r);
 }
 
 /*
@@ -908,8 +912,9 @@ TFTPD_TC_DEFINE(wrq_duped_data,)
fd = open("medium.txt", O_RDONLY);
ATF_REQUIRE(fd >= 0);
r = read(fd, buffer, sizeof(buffer));
+   ATF_REQUIRE(r > 0);
close(fd);
-   require_bufeq((const char*)contents, 768, buffer, r);
+   

git: 73585176ffd8 - main - if_bridge: Minor style fixes

2024-04-25 Thread Zhenlei Huang
The branch main has been updated by zlei:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=73585176ffd84c13d68cad67c2ca81643f09075c

commit 73585176ffd84c13d68cad67c2ca81643f09075c
Author: Zhenlei Huang 
AuthorDate: 2024-04-25 18:19:11 +
Commit: Zhenlei Huang 
CommitDate: 2024-04-25 18:19:11 +

if_bridge: Minor style fixes

And more comments on the #ifdef INET blocks to improve readability.

While here, revert the order of two prototypes to produce minimal diff
compared to stable branches.

MFC with:   65767e6126a7
---
 sys/net/if_bridge.c | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 7b44d85d1fe8..1e6f9b578ee3 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -403,19 +403,16 @@ static intbridge_ioctl_sproto(struct bridge_softc 
*, void *);
 static int bridge_ioctl_stxhc(struct bridge_softc *, void *);
 static int bridge_pfil(struct mbuf **, struct ifnet *, struct ifnet *,
int);
-static voidbridge_linkstate(struct ifnet *ifp);
-static voidbridge_linkcheck(struct bridge_softc *sc);
-
 #ifdef INET
 static int bridge_ip_checkbasic(struct mbuf **mp);
 static int bridge_fragment(struct ifnet *, struct mbuf **mp,
struct ether_header *, int, struct llc *);
 #endif /* INET */
-
 #ifdef INET6
 static int bridge_ip6_checkbasic(struct mbuf **mp);
 #endif /* INET6 */
-
+static voidbridge_linkstate(struct ifnet *ifp);
+static voidbridge_linkcheck(struct bridge_softc *sc);
 
 /*
  * Use the "null" value from IEEE 802.1Q-2014 Table 9-2
@@ -3459,7 +3456,7 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, struct 
ifnet *ifp, int dir)
if (V_pfil_ipfw_arp == 0)
return (0); /* Automatically pass */
 
-   /*FALLTHROUGH*/
+   /* FALLTHROUGH */
case ETHERTYPE_IP:
 #endif
 #ifdef INET6
@@ -3587,8 +3584,7 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, struct 
ifnet *ifp, int dir)
ip->ip_sum = in_cksum(*mp, hlen);
 
break;
-#endif
-
+#endif /* INET */
 #ifdef INET6
case ETHERTYPE_IPV6:
if (V_pfil_bridge && dir == PFIL_OUT && bifp != NULL && (rv =
@@ -3747,7 +3743,7 @@ bad:
*mp = m;
return (-1);
 }
-#endif
+#endif /* INET */
 
 #ifdef INET6
 /*
@@ -3880,7 +3876,7 @@ dropit:
}
return (error);
 }
-#endif
+#endif /* INET */
 
 static void
 bridge_linkstate(struct ifnet *ifp)



git: ad31d4764255 - main - bsdinstall: update comment related to pkg

2024-04-25 Thread Bjoern A. Zeeb
The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ad31d4764255c0848f1f0fa10760d16b5a2922aa

commit ad31d4764255c0848f1f0fa10760d16b5a2922aa
Author: Bjoern A. Zeeb 
AuthorDate: 2024-04-25 14:47:30 +
Commit: Bjoern A. Zeeb 
CommitDate: 2024-04-25 17:44:18 +

bsdinstall: update comment related to pkg

pkg_add has been gone since 2013(?).  Refer to pkg(8) instead.

Sponsored by:   The FreeBSD Foundation
MFC after:  3 days
Reviewed by:jrtc27
Differential Revision: https://reviews.freebsd.org/D44946
---
 usr.sbin/bsdinstall/scripts/docsinstall | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/bsdinstall/scripts/docsinstall 
b/usr.sbin/bsdinstall/scripts/docsinstall
index 8d22fdaa07b6..68a5798b0493 100755
--- a/usr.sbin/bsdinstall/scripts/docsinstall
+++ b/usr.sbin/bsdinstall/scripts/docsinstall
@@ -148,7 +148,7 @@ f_mustberoot_init
 dialog_menu_main || f_die
 f_dialog_menutag_fetch selected
 
-# Let pkg_add be able to use name servers
+# Let pkg(8) be able to use name servers
 f_quietly cp -f $BSDINSTALL_TMPETC/resolv.conf $BSDINSTALL_CHROOT/etc/
 
 #



git: f08bf5a3acf1 - main - Merge commit 0f329e0246d1 from llvm-project (by Dimitry Andric):

2024-04-25 Thread Dimitry Andric
The branch main has been updated by dim:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=f08bf5a3acf146b17794fbde41279645ddbaa086

commit f08bf5a3acf146b17794fbde41279645ddbaa086
Author: Dimitry Andric 
AuthorDate: 2024-04-25 16:47:31 +
Commit: Dimitry Andric 
CommitDate: 2024-04-25 16:47:47 +

Merge commit 0f329e0246d1 from llvm-project (by Dimitry Andric):

  [sanitizer_symbolizer] Cast arguments for format strings in markup 
(#89815)

  When compiling the common sanitizer libraries, there are many warnings
  about format specifiers, similar to:

  
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp:31:32: 
warning: format specifies type 'void *' but the argument has type 'uptr' (aka 
'unsigned long') [-Wformat]
 31 |   buffer->AppendF(kFormatData, DI->start);
|   ~~~  ^
  
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h:33:46: 
note: format string is defined here
 33 | constexpr const char *kFormatData = "{{{data:%p}}}";
|  ^~
|  %lu
  
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp:46:43: 
warning: format specifies type 'void *' but the argument has type 'uptr' (aka 
'unsigned long') [-Wformat]
 46 |   buffer->AppendF(kFormatFrame, frame_no, address);
|   ^~~
  
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h:36:48: 
note: format string is defined here
 36 | constexpr const char *kFormatFrame = "{{{bt:%u:%p}}}";
|^~
|%lu
  ...

  This is because `uptr` is dependent on the platform, and can be either
  `unsigned long long`, `unsigned long`, or `unsigned int`.

  To fix the warnings, cast the arguments to the expected type of the
  format strings.

PR: 276104
Reported by:pstef
MFC after:  3 days
---
 .../lib/sanitizer_common/sanitizer_symbolizer_markup.cpp   | 10 ++
 .../sanitizer_common/sanitizer_symbolizer_markup_constants.h   |  6 +++---
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git 
a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp
 
b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp
index b2a1069a9a61..31d91ef3c739 100644
--- 
a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp
+++ 
b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp
@@ -28,7 +28,7 @@ void MarkupStackTracePrinter::RenderData(InternalScopedString 
*buffer,
  const char *format, const DataInfo 
*DI,
  const char *strip_path_prefix) {
   RenderContext(buffer);
-  buffer->AppendF(kFormatData, DI->start);
+  buffer->AppendF(kFormatData, reinterpret_cast(DI->start));
 }
 
 bool MarkupStackTracePrinter::RenderNeedsSymbolization(const char *format) {
@@ -43,12 +43,13 @@ void 
MarkupStackTracePrinter::RenderFrame(InternalScopedString *buffer,
   const char *strip_path_prefix) {
   CHECK(!RenderNeedsSymbolization(format));
   RenderContext(buffer);
-  buffer->AppendF(kFormatFrame, frame_no, address);
+  buffer->AppendF(kFormatFrame, frame_no, reinterpret_cast(address));
 }
 
 bool MarkupSymbolizerTool::SymbolizePC(uptr addr, SymbolizedStack *stack) {
   char buffer[kFormatFunctionMax];
-  internal_snprintf(buffer, sizeof(buffer), kFormatFunction, addr);
+  internal_snprintf(buffer, sizeof(buffer), kFormatFunction,
+reinterpret_cast(addr));
   stack->info.function = internal_strdup(buffer);
   return true;
 }
@@ -118,7 +119,8 @@ static void RenderMmaps(InternalScopedString *buffer,
 // module.base_address == dlpi_addr
 // range.beg == dlpi_addr + p_vaddr
 // relative address == p_vaddr == range.beg - module.base_address
-buffer->AppendF(kFormatMmap, range.beg, range.end - range.beg, moduleId,
+buffer->AppendF(kFormatMmap, reinterpret_cast(range.beg),
+range.end - range.beg, static_cast(moduleId),
 accessBuffer.data(), range.beg - module.base_address());
 
 buffer->Append("\n");
diff --git 
a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h
 
b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h
index 83643504e128..a43661eaecf2 100644
--- 
a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h
+++ 

git: 54c3aa02e926 - main - Revert "nfsd: Fix NFSv4.1/4.2 Claim_Deleg_Cur_FH"

2024-04-25 Thread Rick Macklem
The branch main has been updated by rmacklem:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=54c3aa02e926268ba5551cd7d28fddf38b3589a2

commit 54c3aa02e926268ba5551cd7d28fddf38b3589a2
Author: Rick Macklem 
AuthorDate: 2024-04-25 16:41:23 +
Commit: Rick Macklem 
CommitDate: 2024-04-25 16:41:23 +

Revert "nfsd: Fix NFSv4.1/4.2 Claim_Deleg_Cur_FH"

This reverts commit f300335d9aebf2e99862bf783978bd44ede23550.

It turns out that the old code was correct and it was wireshark
that was broken and indicated that the RPC's XDR was bogus.
Found during IETF bakeathon testing this week.
---
 sys/fs/nfsserver/nfs_nfsdserv.c  | 10 ++
 sys/fs/nfsserver/nfs_nfsdstate.c | 16 
 2 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c
index 899e88508b60..8141ee6cbdb6 100644
--- a/sys/fs/nfsserver/nfs_nfsdserv.c
+++ b/sys/fs/nfsserver/nfs_nfsdserv.c
@@ -3003,18 +3003,12 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int 
isdgram,
 */
NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
claim = fxdr_unsigned(int, *tl);
-   if (claim == NFSV4OPEN_CLAIMDELEGATECUR) {
+   if (claim == NFSV4OPEN_CLAIMDELEGATECUR || claim ==
+   NFSV4OPEN_CLAIMDELEGATECURFH) {
NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID);
stateid.seqid = fxdr_unsigned(u_int32_t, *tl++);
NFSBCOPY((caddr_t)tl,(caddr_t)stateid.other,NFSX_STATEIDOTHER);
stp->ls_flags |= NFSLCK_DELEGCUR;
-   } else if (claim == NFSV4OPEN_CLAIMDELEGATECURFH) {
-   /* Fill in most of the stateid from the clientid. */
-   stateid.seqid = 0;
-   stateid.other[0] = clientid.lval[0];
-   stateid.other[1] = clientid.lval[1];
-   stateid.other[2] = 0;
-   stp->ls_flags |= NFSLCK_DELEGCUR;
} else if (claim == NFSV4OPEN_CLAIMDELEGATEPREV || claim ==
NFSV4OPEN_CLAIMDELEGATEPREVFH) {
stp->ls_flags |= NFSLCK_DELEGPREV;
diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c
index da57ebde7a52..c73840277022 100644
--- a/sys/fs/nfsserver/nfs_nfsdstate.c
+++ b/sys/fs/nfsserver/nfs_nfsdstate.c
@@ -2568,10 +2568,6 @@ tryagain:
/*
 * For Delegate_Cur, search for the matching Delegation,
 * which indicates no conflict.
-* For NFSv4.1/4.2 Claim_Deleg_Cur_FH only provides
-* the clientid, which is the first two "other" elements
-* for the stateid.  This should be sufficient, since there
-* is only one delegation per client and file.
 * An old delegation should have been recovered by the
 * client doing a Claim_DELEGATE_Prev, so I won't let
 * it match and return NFSERR_EXPIRED. Should I let it
@@ -2582,8 +2578,8 @@ tryagain:
(((nd->nd_flag & ND_NFSV41) != 0 &&
stateidp->seqid == 0) ||
stateidp->seqid == stp->ls_stateid.seqid) &&
-   stateidp->other[0] == stp->ls_stateid.other[0] &&
-   stateidp->other[1] == stp->ls_stateid.other[1])
+   !NFSBCMP(stateidp->other, stp->ls_stateid.other,
+ NFSX_STATEIDOTHER))
break;
}
if (stp == LIST_END(>lf_deleg) ||
@@ -2834,10 +2830,6 @@ tryagain:
/*
 * For Delegate_Cur, search for the matching Delegation,
 * which indicates no conflict.
-* For NFSv4.1/4.2 Claim_Deleg_Cur_FH only provides
-* the clientid, which is the first two "other" elements
-* for the stateid.  This should be sufficient, since there
-* is only one delegation per client and file.
 * An old delegation should have been recovered by the
 * client doing a Claim_DELEGATE_Prev, so I won't let
 * it match and return NFSERR_EXPIRED. Should I let it
@@ -2848,8 +2840,8 @@ tryagain:
(((nd->nd_flag & ND_NFSV41) != 0 &&
stateidp->seqid == 0) ||
stateidp->seqid == stp->ls_stateid.seqid) &&
-   stateidp->other[0] == stp->ls_stateid.other[0] &&
-   stateidp->other[1] == stp->ls_stateid.other[1])
+   !NFSBCMP(stateidp->other, stp->ls_stateid.other,
+   NFSX_STATEIDOTHER))
break;
}
if (stp == LIST_END(>lf_deleg) ||



git: 514773a5486d - main - Skip building libclang_rt when WITHOUT_CLANG is used

2024-04-25 Thread Dimitry Andric
The branch main has been updated by dim:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=514773a5486d1fa4f2d5acb5af1766965c20765b

commit 514773a5486d1fa4f2d5acb5af1766965c20765b
Author: Dimitry Andric 
AuthorDate: 2024-04-25 15:05:29 +
Commit: Dimitry Andric 
CommitDate: 2024-04-25 15:05:29 +

Skip building libclang_rt when WITHOUT_CLANG is used

As noted in bug 277096, when building a pkgbase repository using
WITHOUT_CROSS_COMPILER and WITHOUT_TOOLCHAIN (which sets WITHOUT_CLANG),
the following residual files are left over:

/usr/lib/clang/18/lib/freebsd/libclang_rt.asan-x86_64.so
/usr/lib/clang/18/share/asan_ignore_list.txt
/usr/lib/clang/18/share/cfi_ignore_list.txt
/usr/lib/clang/18/share/msan_ignore_list.txt

This is because the lib/libclang_rt directory is still descended into,
even if WITHOUT_CLANG is used. Fix it by not descending into the
libclang_rt directory in that case.

PR: 277096
Reported by:Siva Mahadevan 
MFC after:  3 days
---
 lib/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Makefile b/lib/Makefile
index cd1476a62d35..6135cff10c15 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -182,7 +182,7 @@ SUBDIR.${MK_LDNS}+= libldns
 SUBDIR.${MK_STATS}+=   libstats
 
 # The libraries under libclang_rt can only be built by clang.
-.if ${COMPILER_TYPE} == "clang"
+.if ${COMPILER_TYPE} == "clang" && ${MK_CLANG} != "no"
 _libclang_rt=  libclang_rt
 .elif (${MK_ASAN} != "no" || ${MK_UBSAN} != "no") && make(all)
 .error Requested build with sanitizers but cannot build runtime libraries!



git: d66399326cb4 - main - kthread: Set *tdptr earlier in kproc_kthread_add()

2024-04-25 Thread Mark Johnston
The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=d66399326cb4f89d1565fb62c1c07974886893c5

commit d66399326cb4f89d1565fb62c1c07974886893c5
Author: Mark Johnston 
AuthorDate: 2024-04-25 13:35:38 +
Commit: Mark Johnston 
CommitDate: 2024-04-25 13:35:38 +

kthread: Set *tdptr earlier in kproc_kthread_add()

See commit ae77041e0714 ("kthread: Set *newtdp earlier in
kthread_add1()") for details.  That commit was incomplete since
g_init()'s first call to kproc_kthread_add() will cause
kproc_kthread_add() to take the `*procptr == NULL` branch, which avoids
kthread_create().

To ensure that the thread pointer is initialized before the thread
starts running, we have to start the kernel process with RFSTOPPED.
We could perhaps go further and use RFSTOPPED only when tdptr != NULL,
but it's probably better to have consistent behaviour.

Reviewed by:olce, kib
Reported by:syzbot+e91e798f3c088215a...@syzkaller.appspotmail.com
MFC after:  1 week
Differential Revision:  https://reviews.freebsd.org/D44927
---
 sys/kern/kern_kthread.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
index 8a84fd70918d..97d10fdb394a 100644
--- a/sys/kern/kern_kthread.c
+++ b/sys/kern/kern_kthread.c
@@ -495,13 +495,21 @@ kproc_kthread_add(void (*func)(void *), void *arg,
struct thread *td;
 
if (*procptr == NULL) {
+   /*
+* Use RFSTOPPED to ensure that *tdptr is initialized before the
+* thread starts running.
+*/
error = kproc_create(func, arg,
-   procptr, flags, pages, "%s", procname);
+   procptr, flags | RFSTOPPED, pages, "%s", procname);
if (error)
return (error);
td = FIRST_THREAD_IN_PROC(*procptr);
if (tdptr)
*tdptr = td;
+   if ((flags & RFSTOPPED) == 0) {
+   thread_lock(td);
+   sched_add(td, SRQ_BORING);
+   }
va_start(ap, fmt);
vsnprintf(td->td_name, sizeof(td->td_name), fmt, ap);
va_end(ap);



Re: git: 4395d3ced5cf - main - Document that gettimeofday() is obsolescent

2024-04-25 Thread Konstantin Belousov
On Thu, Apr 25, 2024 at 09:44:00AM +, Mateusz Piotrowski wrote:
> The branch main has been updated by 0mp:
> 
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=4395d3ced5cfa46df400b5bb9996f9d74476997e
> 
> commit 4395d3ced5cfa46df400b5bb9996f9d74476997e
> Author: Mateusz Piotrowski <0...@freebsd.org>
> AuthorDate: 2024-04-24 11:31:54 +
> Commit: Mateusz Piotrowski <0...@freebsd.org>
> CommitDate: 2024-04-25 09:42:59 +
> 
> Document that gettimeofday() is obsolescent
> 
> Reported by:kaktus
> Reviewed by:kaktus, pstef
> MFC after:  3 days
> Differential Revision:  https://reviews.freebsd.org/D23942
> ---
>  lib/libsys/gettimeofday.2 | 25 -
>  1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/libsys/gettimeofday.2 b/lib/libsys/gettimeofday.2
> index 5b867aaad33c..cfba97149199 100644
> --- a/lib/libsys/gettimeofday.2
> +++ b/lib/libsys/gettimeofday.2
> @@ -25,7 +25,7 @@
>  .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>  .\" SUCH DAMAGE.
>  .\"
> -.Dd May 13, 2021
> +.Dd April 24, 2024
>  .Dt GETTIMEOFDAY 2
>  .Os
>  .Sh NAME
> @@ -41,6 +41,17 @@
>  .Ft int
>  .Fn settimeofday "const struct timeval *tp" "const struct timezone *tzp"
>  .Sh DESCRIPTION
> +.Em Note :
> +The
> +.Nm gettimeofday
> +function
> +.Po but not
> +.Nm settimeofday Pc
> +is obsolescent.
> +See the
> +.Sx STANDARDS
> +section for more details.
> +.Pp
>  The system's notion of the current Greenwich time and the current time
>  zone is obtained with the
>  .Fn gettimeofday
> @@ -121,6 +132,18 @@ A user other than the super-user attempted to set the 
> time.
>  .Xr ctime 3 ,
>  .Xr timeradd 3 ,
>  .Xr clocks 7
> +.Sh STANDARDS
> +The
> +.Nm gettimeofday
> +function is considered obsolescent and its usage discouraged by
> +.\" XXX: This should be replaced in the future when an appropriate argument 
> to
> +.\" the St macro is available: -p1003.1-2017
> +.No IEEE Std 1003.1-2008, 2017 Edition (\\(LqPOSIX.1\\(Rq) .
> +Application should use the
> +.Xr clock_gettime 2
> +function instead as
> +.Nm gettimeofday
> +might be removed in the future.
Obviously gettimeofday(2) is not going to be removed even in the far future.

>  .Sh HISTORY
>  The
>  .Fn gettimeofday



git: 42255af64a54 - main - checkstyle9: Allow a space between "*" and _*restrict

2024-04-25 Thread Mateusz Piotrowski
The branch main has been updated by 0mp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=42255af64a5471a2668e3a0552d82639e1f70ee4

commit 42255af64a5471a2668e3a0552d82639e1f70ee4
Author: Mateusz Piotrowski <0...@freebsd.org>
AuthorDate: 2024-04-23 10:29:02 +
Commit: Mateusz Piotrowski <0...@freebsd.org>
CommitDate: 2024-04-25 09:51:25 +

checkstyle9: Allow a space between "*" and _*restrict

Before the change, we would get errors like this:

ERROR: "foo * bar" should be "foo *bar"
#369: FILE: foobar.c:369:
+barbaz(char * __restrict s,

Reviewed by:des, imp
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D44911
---
 tools/build/checkstyle9.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/build/checkstyle9.pl b/tools/build/checkstyle9.pl
index 7fa02bcabc97..99fd354fbacf 100755
--- a/tools/build/checkstyle9.pl
+++ b/tools/build/checkstyle9.pl
@@ -202,6 +202,7 @@ our $Sparse = qr{
 # Notes to $Attribute:
 our $Attribute = qr{
const|
+   _*restrict|
volatile|
QEMU_NORETURN|
QEMU_WARN_UNUSED_RESULT|



git: 177ba183076b - main - sync.8: Document that the "sync dance" is not a thing

2024-04-25 Thread Mateusz Piotrowski
The branch main has been updated by 0mp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=177ba183076bd6fe6b29b1d657b954cca256506b

commit 177ba183076bd6fe6b29b1d657b954cca256506b
Author: Mateusz Piotrowski <0...@freebsd.org>
AuthorDate: 2024-04-23 14:12:45 +
Commit: Mateusz Piotrowski <0...@freebsd.org>
CommitDate: 2024-04-25 09:49:50 +

sync.8: Document that the "sync dance" is not a thing

People still believe that it is essential to run sync(8) a couple of
times before a reboot/halt. Document that this has not been necessary
for a long time now.

Reviewed by:imp, bcr, Pau Amma 
MFC after:  3 days
Differential Revision:  https://reviews.freebsd.org/D33233
---
 bin/sync/sync.8 | 30 +-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/bin/sync/sync.8 b/bin/sync/sync.8
index d7a11c9fd217..fcd07ca72240 100644
--- a/bin/sync/sync.8
+++ b/bin/sync/sync.8
@@ -26,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 31, 1993
+.Dd April 25, 2024
 .Dt SYNC 8
 .Os
 .Sh NAME
@@ -69,3 +69,31 @@ A
 .Nm
 utility appeared in
 .At v4 .
+.Pp
+On systems older than
+.Bx 4.0 ,
+commands like
+.Xr reboot 8
+and
+.Xr halt 8
+were unavailable.
+The shutdown procedure involved running
+.Nm ,
+waiting for the lights to stop,
+and turning off the machine.
+.Pp
+Issuing three separate
+.Nm
+commands (one line each) was a placebo that would generally suffice in
+.At v7
+machines that were otherwise quiesced systems.
+It replaced the one-per-line
+.Nm
+as a substitute for waiting.
+.Pp
+.Bx 4.0
+introduced
+.Xr reboot 2
+and
+.Xr sync 2
+which rendered this trick obsolete.



git: 4395d3ced5cf - main - Document that gettimeofday() is obsolescent

2024-04-25 Thread Mateusz Piotrowski
The branch main has been updated by 0mp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4395d3ced5cfa46df400b5bb9996f9d74476997e

commit 4395d3ced5cfa46df400b5bb9996f9d74476997e
Author: Mateusz Piotrowski <0...@freebsd.org>
AuthorDate: 2024-04-24 11:31:54 +
Commit: Mateusz Piotrowski <0...@freebsd.org>
CommitDate: 2024-04-25 09:42:59 +

Document that gettimeofday() is obsolescent

Reported by:kaktus
Reviewed by:kaktus, pstef
MFC after:  3 days
Differential Revision:  https://reviews.freebsd.org/D23942
---
 lib/libsys/gettimeofday.2 | 25 -
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/lib/libsys/gettimeofday.2 b/lib/libsys/gettimeofday.2
index 5b867aaad33c..cfba97149199 100644
--- a/lib/libsys/gettimeofday.2
+++ b/lib/libsys/gettimeofday.2
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 13, 2021
+.Dd April 24, 2024
 .Dt GETTIMEOFDAY 2
 .Os
 .Sh NAME
@@ -41,6 +41,17 @@
 .Ft int
 .Fn settimeofday "const struct timeval *tp" "const struct timezone *tzp"
 .Sh DESCRIPTION
+.Em Note :
+The
+.Nm gettimeofday
+function
+.Po but not
+.Nm settimeofday Pc
+is obsolescent.
+See the
+.Sx STANDARDS
+section for more details.
+.Pp
 The system's notion of the current Greenwich time and the current time
 zone is obtained with the
 .Fn gettimeofday
@@ -121,6 +132,18 @@ A user other than the super-user attempted to set the time.
 .Xr ctime 3 ,
 .Xr timeradd 3 ,
 .Xr clocks 7
+.Sh STANDARDS
+The
+.Nm gettimeofday
+function is considered obsolescent and its usage discouraged by
+.\" XXX: This should be replaced in the future when an appropriate argument to
+.\" the St macro is available: -p1003.1-2017
+.No IEEE Std 1003.1-2008, 2017 Edition (\\(LqPOSIX.1\\(Rq) .
+Application should use the
+.Xr clock_gettime 2
+function instead as
+.Nm gettimeofday
+might be removed in the future.
 .Sh HISTORY
 The
 .Fn gettimeofday