Skip to contentSkip to conversation

sg_set_buf

DISCUSSION J. Bruce Fields 3 participants 6 messages Oct 18, 2016 – Oct 21, 2016 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

The NFS code is using sg_set_buf to turn a bit of stack menory into a scatterlist it can pass to the crypto code. That started BUG()ing as of ac4e97abce9b "scatterlist: sg_set_buf() argument must be in linear mapping".

Is that BUG() being overly strict, or is this something we should never have been doing in the first place?

--b.

#1 lore raw
Quoted 7 lines · J. Bruce Fields

The NFS code is using sg_set_buf to turn a bit of stack menory into a scatterlist it can pass to the crypto code. That started BUG()ing as of ac4e97abce9b "scatterlist: sg_set_buf() argument must be in linear mapping".

Is that BUG() being overly strict, or is this something we should never have been doing in the first place?

In general we use scatterlists to pass dma addresses to hardware, so yes, they should not point to the stack.

#2 lore raw
Quoted 11 lines · Christoph Hellwig
Quoted 7 lines · J. Bruce Fields

The NFS code is using sg_set_buf to turn a bit of stack menory into a scatterlist it can pass to the crypto code. That started BUG()ing as of ac4e97abce9b "scatterlist: sg_set_buf() argument must be in linear mapping".

Is that BUG() being overly strict, or is this something we should never have been doing in the first place?

In general we use scatterlists to pass dma addresses to hardware, so yes, they should not point to the stack.

The crypto code isn't actually doing that though, is it?

(Or is there a chance it could be passing the data to separate crypto hardware? Do people do that these days?)

--b.

#3 lore raw
Quoted 4 lines · J. Bruce Fields

The crypto code isn't actually doing that though, is it?

(Or is there a chance it could be passing the data to separate crypto hardware? Do people do that these days?)

Yes, there are tons of crypto accelarators, and they are built around using struct scatterlist.

#4 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · J. Bruce Fields

The crypto code isn't actually doing that though, is it?

(Or is there a chance it could be passing the data to separate crypto hardware? Do people do that these days?)

Yes, there are tons of crypto accelarators, and they are built around using struct scatterlist.

OK, thanks.

Turns out there are several places in the kerberos code where it just needs to encrypt one small checksum or sequence number, and it's been doing that on the stack.

For now I'll just sprinkle kmalloc()'s all over. Eventually we'll need to find something better.

--b.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 6 lines · J. Bruce Fields

Turns out there are several places in the kerberos code where it just needs to encrypt one small checksum or sequence number, and it's been doing that on the stack.

For now I'll just sprinkle kmalloc()'s all over. Eventually we'll need to find something better.

I agree that it would be nice to be able to hash small objects on the stack. But unless I've missed something there is no way to do that without using struct scatterlist. I've added linux-crypto to the cc list to confirm that I really didn't miss anything.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html